public WeeklyPlanning(string month) { InitializeComponent(); CBList_WeeklyProject.Add(new WeeklyProjectItem()); CBList_WeeklyProject[0].Set_CheckBox(CheckBox_WeekProject); CBList_WeeklyProject[0].Set_TextBox(textBox1); Object_distance = CheckBox_WeekProject.Location.X - textBox1.Location.X; CBList_WeeklyProject[0].Get_TextkBox().TextChanged += ProjectTextBox_Changed; CBList_WeeklyProject[0].Get_TextkBox().KeyDown += ProjectKeyDown_Enter; close_PrePage = true; _file_name = month + "//Weekly_Project.txt"; _month = month; SaveProject _Save = new SaveProject(_file_name); string[] str = _Save.Read_Project(); if (str.Length == 0) { CBList_WeeklyProject[0].Get_TextkBox().Text = "Project"; Str_WeeklyProjtect.Add("Project"); Str_WeeklyProjtect.Add("Unchecked"); } else { CBList_WeeklyProject[0].Get_TextkBox().Text = str[0]; if (string.Compare("Checked", str[1], true) == 0) { CBList_WeeklyProject[0].Get_CheckBox().Checked = true; } else { CBList_WeeklyProject[0].Get_CheckBox().Checked = false; } Str_WeeklyProjtect.Add(str[0]); Str_WeeklyProjtect.Add(str[1]); } for (int i = 2; i < str.Length; i = i + 2) { Str_WeeklyProjtect.Add(str[i]); Str_WeeklyProjtect.Add(str[i + 1]); Add_ObjectItem(); CBList_WeeklyProject[CBList_WeeklyProject.Count - 1].Get_TextkBox().Text = str[i]; if (string.Compare("Checked", str[i + 1], true) == 0) { CBList_WeeklyProject[CBList_WeeklyProject.Count - 1].Get_CheckBox().Checked = true; } else { CBList_WeeklyProject[CBList_WeeklyProject.Count - 1].Get_CheckBox().Checked = false; } } }
private void InitProject() { Cnt_MonPlan = 0; Cnt_YearPlan = 0; Mon_RevBnt.Add(new MorningPlanningButton()); Year_RevBnt.Add(new MorningPlanningButton()); MorningPlanningButton InitialMbnt = new MorningPlanningButton(); MorningPlanningButton Mbnt = new MorningPlanningButton(); InitialMbnt.label = label4; InitialMbnt.Textbox = textBox2; CopyObjectProperties(ref Mbnt, InitialMbnt); Mon_RevBnt[0].index = 0; Mon_RevBnt[0] = Mbnt; Mon_RevBnt[0].SetInitBntLocation(button1.Location); Mon_RevBnt[0].SetInitLabLocation(label4.Location); Mon_RevBnt[0].SetInitTextBoxLocation(textBox2.Location); Mon_RevBnt[0].Textbox.TextChanged += new System.EventHandler(MonTextBox_TextChange); this.Controls.Remove(label4); this.Controls.Remove(textBox2); this.Controls.Add(Mbnt.label); this.Controls.Add(Mbnt.Textbox); Year_RevBnt[0].label = label2; Year_RevBnt[0].Textbox = textBox1; Year_RevBnt[0].Textbox.TextChanged += new System.EventHandler(YearTextBox_TextChange); Year_RevBnt[0].index = 0; Year_RevBnt[0].SetInitBntLocation(button2.Location); Year_RevBnt[0].SetInitLabLocation(label2.Location); Year_RevBnt[0].SetInitTextBoxLocation(textBox1.Location); Cnt_MonPlan++; Cnt_YearPlan++; //Read Year txt SaveProject _SaveProject = new SaveProject(); string[] str = _SaveProject.Read_YearProject(); for (int i = 0; i < str.Length; i++) { if (i > Cnt_YearPlan - 1) { button2_Click(null, null); } Year_RevBnt[i].Textbox.Text = str[i]; } //Read Mon txt string _file_path = Mon_name + "_Project.txt"; _SaveProject = new SaveProject(_file_path); str = _SaveProject.Read_Project(); for (int i = 0; i < str.Length; i++) { if (i > Cnt_MonPlan - 1) { button1_Click(null, null); } Mon_RevBnt[i].Textbox.Text = str[i]; } //Initial Pie Chart MorningPlanningPieChartInit(); }