private void AddBtn_3_Click(object sender, RoutedEventArgs e) { // Future Fitem = new FutureToDoList(); ToDolist_Future.Children.Add(Fitem); }
private void Window_Loaded(object sender, RoutedEventArgs e) { string[] partsTime = DateTime.Now.ToString().Split('/'); TodayDate1.Text = partsTime[0].ToString(); if (partsTime.Length == 2) { TodayDate2.Text = "." + partsTime[1].ToString(); } else { TodayDate3.Text = ".0"; } string[] DateNow = DateTime.Now.ToString().Split(' '); string[] date = DateNow[0].Split('/'); TodayDate3.Text = date[2].ToString() + "年"; TodayDate2.Text = date[1].ToString() + "月"; TodayDate1.Text = date[0].ToString() + "日"; // ~~~~~今天~~~~~ // 讀檔 string[] Tlines = System.IO.File.ReadAllLines(@"C:\temp\Tdata.txt"); // 逐行產生元件 foreach (string Tline in Tlines) { // 用符號分隔 string[] Tparts = Tline.Split('|'); // 建立元件 TodayToDoList Titem = new TodayToDoList(); Titem.ItemName = Tparts[1]; if (Tparts[0] == "+") { Titem.IsChecked = true; } else { Titem.IsChecked = false; } // 放入到 StackPanel ToDolist_Today.Children.Add(Titem); } // ~~~~~過去~~~~~ string[] Plines = System.IO.File.ReadAllLines(@"C:\temp\Pdata.txt"); // 逐行產生元件 foreach (string Pline in Plines) { // 用符號分隔 string[] Pparts = Pline.Split('|'); // 建立元件 PastNFutureToDoList Pitem = new PastNFutureToDoList(); Pitem.ItemName = Pparts[1]; if (Pparts[0] == "+") { Pitem.IsChecked = true; } else { Pitem.IsChecked = false; } // 放入到 StackPanel ToDolist_Past.Children.Add(Pitem); } // ~~~~~未來~~~~~ string[] Flines = System.IO.File.ReadAllLines(@"C:\temp\Fdata.txt"); // 逐行產生元件 foreach (string Fline in Flines) { // 用符號分隔 string[] Fparts = Fline.Split('|'); // 建立元件 FutureToDoList Fitem = new FutureToDoList(); Fitem.ItemName = Fparts[1]; if (Fparts[0] == "+") { Fitem.IsChecked = true; } else { Fitem.IsChecked = false; } // 放入到 StackPanel ToDolist_Future.Children.Add(Fitem); } }