📄 main.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using smartSchedule.ScheduleMethod;
namespace smartSchedule
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class MainForm : System.Windows.Forms.Form
{
private System.Windows.Forms.TabPage tabPage_scheduleshow;
private System.Windows.Forms.TabPage tabPage_config;
private System.Windows.Forms.TabControl tabControl2;
private System.Windows.Forms.TabPage tp_dayview;
private System.Windows.Forms.TabPage tp_weekview;
private System.Windows.Forms.TabPage tp_monthview;
private System.Windows.Forms.TabPage tp_notdoneview;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tp_thingsleft;
private System.Windows.Forms.DataGrid dg_dayview;
private SqlConnection myConn;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.TabPage tp_addSchedule;
private System.Windows.Forms.TextBox taskTitleBox;
private System.Windows.Forms.TextBox taskDetailBox;
private System.Windows.Forms.GroupBox scheduleGroup;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox notifyCheckBox;
private System.Windows.Forms.ComboBox taskPriorityListbox;
private System.Windows.Forms.ComboBox taskTypeListbox;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox notifyTimeSetupBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox periodSetupListBox;
private System.Windows.Forms.DateTimePicker taskDateTimeSetupBox;
private System.Windows.Forms.Button OK;
private System.Windows.Forms.Button Cancel;
private System.Windows.Forms.DataGrid dg_Remain;
private System.Windows.Forms.Button ViewScheduleButton;
private System.Windows.Forms.DateTimePicker SelectDay;
static string ConnString = "data source=localhost;User Id=ScheduleAgent;Password=password;packet size=4096;database=SmartSchedule";
public MainForm()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage_scheduleshow = new System.Windows.Forms.TabPage();
this.tabControl2 = new System.Windows.Forms.TabControl();
this.tp_dayview = new System.Windows.Forms.TabPage();
this.SelectDay = new System.Windows.Forms.DateTimePicker();
this.dg_dayview = new System.Windows.Forms.DataGrid();
this.ViewScheduleButton = new System.Windows.Forms.Button();
this.tp_weekview = new System.Windows.Forms.TabPage();
this.tp_monthview = new System.Windows.Forms.TabPage();
this.tp_thingsleft = new System.Windows.Forms.TabPage();
this.dg_Remain = new System.Windows.Forms.DataGrid();
this.tabPage_config = new System.Windows.Forms.TabPage();
this.tp_addSchedule = new System.Windows.Forms.TabPage();
this.Cancel = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.periodSetupListBox = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.notifyTimeSetupBox = new System.Windows.Forms.ComboBox();
this.taskDateTimeSetupBox = new System.Windows.Forms.DateTimePicker();
this.notifyCheckBox = new System.Windows.Forms.CheckBox();
this.taskPriorityListbox = new System.Windows.Forms.ComboBox();
this.taskTypeListbox = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.scheduleGroup = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.taskTitleBox = new System.Windows.Forms.TextBox();
this.taskDetailBox = new System.Windows.Forms.TextBox();
this.OK = new System.Windows.Forms.Button();
this.tp_notdoneview = new System.Windows.Forms.TabPage();
this.tabControl1.SuspendLayout();
this.tabPage_scheduleshow.SuspendLayout();
this.tabControl2.SuspendLayout();
this.tp_dayview.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dg_dayview)).BeginInit();
this.tp_thingsleft.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dg_Remain)).BeginInit();
this.tp_addSchedule.SuspendLayout();
this.groupBox2.SuspendLayout();
this.scheduleGroup.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.tabPage_scheduleshow,
this.tp_thingsleft,
this.tabPage_config,
this.tp_addSchedule});
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(792, 544);
this.tabControl1.TabIndex = 0;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage_scheduleshow
//
this.tabPage_scheduleshow.Controls.AddRange(new System.Windows.Forms.Control[] {
this.tabControl2});
this.tabPage_scheduleshow.Location = new System.Drawing.Point(4, 21);
this.tabPage_scheduleshow.Name = "tabPage_scheduleshow";
this.tabPage_scheduleshow.Size = new System.Drawing.Size(784, 519);
this.tabPage_scheduleshow.TabIndex = 0;
this.tabPage_scheduleshow.Text = "日程表";
//
// tabControl2
//
this.tabControl2.Alignment = System.Windows.Forms.TabAlignment.Right;
this.tabControl2.CausesValidation = false;
this.tabControl2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.tp_dayview,
this.tp_weekview,
this.tp_monthview});
this.tabControl2.Dock = System.Windows.Forms.DockStyle.Top;
this.tabControl2.Multiline = true;
this.tabControl2.Name = "tabControl2";
this.tabControl2.SelectedIndex = 0;
this.tabControl2.Size = new System.Drawing.Size(784, 528);
this.tabControl2.TabIndex = 1;
//
// tp_dayview
//
this.tp_dayview.BackColor = System.Drawing.Color.LightGray;
this.tp_dayview.Controls.AddRange(new System.Windows.Forms.Control[] {
this.SelectDay,
this.dg_dayview,
this.ViewScheduleButton});
this.tp_dayview.Location = new System.Drawing.Point(4, 4);
this.tp_dayview.Name = "tp_dayview";
this.tp_dayview.Size = new System.Drawing.Size(758, 520);
this.tp_dayview.TabIndex = 0;
this.tp_dayview.Text = "日视图";
//
// SelectDay
//
this.SelectDay.Location = new System.Drawing.Point(440, 488);
this.SelectDay.Name = "SelectDay";
this.SelectDay.TabIndex = 2;
//
// dg_dayview
//
this.dg_dayview.BackColor = System.Drawing.Color.LightGray;
this.dg_dayview.BackgroundColor = System.Drawing.Color.LightGray;
this.dg_dayview.CaptionBackColor = System.Drawing.SystemColors.HotTrack;
this.dg_dayview.CaptionVisible = false;
this.dg_dayview.DataMember = "";
this.dg_dayview.HeaderBackColor = System.Drawing.Color.DarkBlue;
this.dg_dayview.HeaderFont = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.dg_dayview.HeaderForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.dg_dayview.Name = "dg_dayview";
this.dg_dayview.ParentRowsVisible = false;
this.dg_dayview.PreferredColumnWidth = 95;
this.dg_dayview.ReadOnly = true;
this.dg_dayview.Size = new System.Drawing.Size(773, 480);
this.dg_dayview.TabIndex = 0;
//
// ViewScheduleButton
//
this.ViewScheduleButton.Location = new System.Drawing.Point(664, 488);
this.ViewScheduleButton.Name = "ViewScheduleButton";
this.ViewScheduleButton.TabIndex = 1;
this.ViewScheduleButton.Text = "查看";
this.ViewScheduleButton.Click += new System.EventHandler(this.ViewScheduleButton_Click);
//
// tp_weekview
//
this.tp_weekview.Location = new System.Drawing.Point(4, 4);
this.tp_weekview.Name = "tp_weekview";
this.tp_weekview.Size = new System.Drawing.Size(758, 520);
this.tp_weekview.TabIndex = 1;
this.tp_weekview.Text = "周视图";
//
// tp_monthview
//
this.tp_monthview.Location = new System.Drawing.Point(4, 4);
this.tp_monthview.Name = "tp_monthview";
this.tp_monthview.Size = new System.Drawing.Size(758, 520);
this.tp_monthview.TabIndex = 2;
this.tp_monthview.Text = "月视图";
//
// tp_thingsleft
//
this.tp_thingsleft.Controls.AddRange(new System.Windows.Forms.Control[] {
this.dg_Remain});
this.tp_thingsleft.Location = new System.Drawing.Point(4, 21);
this.tp_thingsleft.Name = "tp_thingsleft";
this.tp_thingsleft.Size = new System.Drawing.Size(784, 519);
this.tp_thingsleft.TabIndex = 2;
this.tp_thingsleft.Text = "未完成事项";
//
// dg_Remain
//
this.dg_Remain.BackColor = System.Drawing.Color.LightGray;
this.dg_Remain.BackgroundColor = System.Drawing.Color.LightGray;
this.dg_Remain.CaptionBackColor = System.Drawing.SystemColors.HotTrack;
this.dg_Remain.CaptionVisible = false;
this.dg_Remain.DataMember = "";
this.dg_Remain.HeaderBackColor = System.Drawing.Color.DarkBlue;
this.dg_Remain.HeaderFont = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.dg_Remain.HeaderForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.dg_Remain.Name = "dg_Remain";
this.dg_Remain.ParentRowsVisible = false;
this.dg_Remain.PreferredColumnWidth = 95;
this.dg_Remain.ReadOnly = true;
this.dg_Remain.RowHeadersVisible = false;
this.dg_Remain.Size = new System.Drawing.Size(784, 529);
this.dg_Remain.TabIndex = 1;
//
// tabPage_config
//
this.tabPage_config.Location = new System.Drawing.Point(4, 21);
this.tabPage_config.Name = "tabPage_config";
this.tabPage_config.Size = new System.Drawing.Size(784, 519);
this.tabPage_config.TabIndex = 1;
this.tabPage_config.Text = "系统设置";
//
// tp_addSchedule
//
this.tp_addSchedule.Controls.AddRange(new System.Windows.Forms.Control[] {
this.Cancel,
this.groupBox2,
this.scheduleGroup,
this.OK});
this.tp_addSchedule.Location = new System.Drawing.Point(4, 21);
this.tp_addSchedule.Name = "tp_addSchedule";
this.tp_addSchedule.Size = new System.Drawing.Size(784, 519);
this.tp_addSchedule.TabIndex = 3;
this.tp_addSchedule.Text = "添加日程";
//
// Cancel
//
this.Cancel.Location = new System.Drawing.Point(584, 384);
this.Cancel.Name = "Cancel";
this.Cancel.TabIndex = 11;
this.Cancel.Text = "取消";
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
//
// groupBox2
//
this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.periodSetupListBox,
this.label3,
this.notifyTimeSetupBox,
this.taskDateTimeSetupBox,
this.notifyCheckBox,
this.taskPriorityListbox,
this.taskTypeListbox,
this.label7,
this.label6,
this.label5,
this.label4});
this.groupBox2.Location = new System.Drawing.Point(24, 240);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(744, 128);
this.groupBox2.TabIndex = 10;
this.groupBox2.TabStop = false;
//
// periodSetupListBox
//
this.periodSetupListBox.Items.AddRange(new object[] {
"无重复",
"每天",
"每周",
"每月",
"每年",
"所有工作日",
"所有休息日"});
this.periodSetupListBox.Location = new System.Drawing.Point(384, 49);
this.periodSetupListBox.Name = "periodSetupListBox";
this.periodSetupListBox.Size = new System.Drawing.Size(152, 20);
this.periodSetupListBox.TabIndex = 33;
this.periodSetupListBox.Text = "无重复";
this.periodSetupListBox.Visible = false;
//
// label3
//
this.label3.Location = new System.Drawing.Point(336, 53);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(40, 16);
this.label3.TabIndex = 32;
this.label3.Text = "重复";
this.label3.Visible = false;
//
// notifyTimeSetupBox
//
this.notifyTimeSetupBox.Items.AddRange(new object[] {
"准时提醒",
"提前15分钟",
"提前30分钟",
"提前45分钟",
"提前1小时",
"提前2小时",
"提前6小时",
"提前12小时",
"提前1天",
"提前1周",
"提前1月"});
this.notifyTimeSetupBox.Location = new System.Drawing.Point(56, 96);
this.notifyTimeSetupBox.Name = "notifyTimeSetupBox";
this.notifyTimeSetupBox.Size = new System.Drawing.Size(152, 20);
this.notifyTimeSetupBox.TabIndex = 31;
this.notifyTimeSetupBox.Text = "准时提醒";
//
// taskDateTimeSetupBox
//
this.taskDateTimeSetupBox.CalendarFont = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.taskDateTimeSetupBox.CalendarTitleBackColor = System.Drawing.SystemColors.Desktop;
this.taskDateTimeSetupBox.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.taskDateTimeSetupBox.Location = new System.Drawing.Point(56, 48);
this.taskDateTimeSetupBox.Name = "taskDateTimeSetupBox";
this.taskDateTimeSetupBox.Size = new System.Drawing.Size(248, 21);
this.taskDateTimeSetupBox.TabIndex = 27;
//
// notifyCheckBox
//
this.notifyCheckBox.Checked = true;
this.notifyCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.notifyCheckBox.Location = new System.Drawing.Point(56, 72);
this.notifyCheckBox.Name = "notifyCheckBox";
this.notifyCheckBox.Size = new System.Drawing.Size(152, 24);
this.notifyCheckBox.TabIndex = 29;
this.notifyCheckBox.Text = "需要提示";
this.notifyCheckBox.Click += new System.EventHandler(this.notifyCheckBox_Click);
//
// taskPriorityListbox
//
this.taskPriorityListbox.BackColor = System.Drawing.SystemColors.HighlightText;
this.taskPriorityListbox.Location = new System.Drawing.Point(384, 16);
this.taskPriorityListbox.Name = "taskPriorityListbox";
this.taskPriorityListbox.Size = new System.Drawing.Size(152, 20);
this.taskPriorityListbox.TabIndex = 26;
//
// taskTypeListbox
//
this.taskTypeListbox.BackColor = System.Drawing.SystemColors.HighlightText;
this.taskTypeListbox.Location = new System.Drawing.Point(56, 16);
this.taskTypeListbox.Name = "taskTypeListbox";
this.taskTypeListbox.Size = new System.Drawing.Size(152, 20);
this.taskTypeListbox.TabIndex = 25;
//
// label7
//
this.label7.Location = new System.Drawing.Point(8, 80);
this.label7.Name = "label7";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -