Пример #1
0
        private void addTask_MouseDown(object sender, MouseButtonEventArgs e)
        {
            // 產生項目
            price price = new price();

            //放至清單中
            TaskList.Children.Add(price);
        }
Пример #2
0
        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);
            }
        }