Пример #1
0
 public ResultPage(MonthRecordCollection records)
 {
     mRecords = records;
     InitializeComponent();
     expectedWorkHours.DataContext = mRecords.ExpectedWorkHours;
     recordList.ItemsSource = mRecords.Records;
 }
Пример #2
0
 public ResultPage()
 {
     mRecords = MonthRecordCollection.LoadFile("errdata.txt");
     InitializeComponent();
     expectedWorkHours.DataContext = mRecords.ExpectedWorkHours;
     recordList.ItemsSource = mRecords.Records;
 }
 public static MonthRecordCollection LoadFile(String path)
 {
     var result = new MonthRecordCollection();
     var records = AttendanceDate.LoadFile(path);
     foreach (var item in records.Values)
     {
         result.mRecords.Add(new MonthRecord(item));
     }
     result.mYear = result.mRecords[0].Year;
     result.mMonth = result.mRecords[0].Month;
     return result;
 }
Пример #4
0
 private void chooseFileClick(object sender, RoutedEventArgs e)
 {
     OpenFileDialog dlg = new OpenFileDialog();
     dlg.Filter = "Text documents (.txt)|*.txt";
     if (dlg.ShowDialog() == true)
     {
         try
         {
             Records = MonthRecordCollection.LoadFile(dlg.FileName);
             fileName.Text = dlg.FileName;
             yearAndMonth.Text = String.Format("{0}/{1}", Records.Year, Records.Month);
         }
         catch (FileFormatException ex)
         {
             MessageBox.Show(ex.ToString(), "文件格式错误");
         }
     }
 }
Пример #5
0
 public CalendarPage(MonthRecordCollection records)
 {
     mRecords = records;
     this.Loaded += new RoutedEventHandler(CalendarPage_Loaded);
     InitializeComponent();
 }