private void addTask_MouseDown(object sender, MouseButtonEventArgs e) { // 產生項目 price price = new price(); //放到清單中 TaskList.Children.Add(price); }
private void Window_Loaded(object sender, RoutedEventArgs e) { string[] lines = System.IO.File.ReadAllLines(@"C:\data.txt"); foreach (string line in lines) { string[] parts = line.Split('|'); price price = new price(); price.date.Text = parts[0]; price.TaskName.Text = parts[1]; price.TaskPrice.Text = parts[2]; TaskList.Children.Add(price); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { // 開檔 string[] lines = System.IO.File.ReadAllLines(@"C:\data.txt"); // 分析每一行 foreach (string line in lines) { // 用 | 符號拆開 string[] parts = line.Split('|'); // 建立 TodoItem price price = new price(); //分別讀取不同部份 price.date.Text = parts[0]; price.TaskName.Text = parts[1]; price.TaskPrice.Text = parts[2]; // 放到清單中 TaskList.Children.Add(price); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { // 開啟檔案 string[] lines = System.IO.File.ReadAllLines(@"D:\GITHIB\accounting\data.txt"); // 分析 foreach (string line in lines) { // 隔開 string[] parts = line.Split('|'); price price = new price(); //讀取 price.date.Text = parts[0]; price.TaskName.Text = parts[1]; price.TaskPrice.Text = parts[2]; //增加項目 TaskList.Children.Add(price); } }