Пример #1
0
        private void CleanRecordsFromDateMenuItem_Click(object sender, RoutedEventArgs e)
        {
            // TO-DO: Add a dialog to let user choose instead of the magic number
            ConfigDialog dialog = new ConfigDialog();

            dialog.ShowDialog();
            if (dialog.Ok)
            {
                bool?cleanAllRecords = dialog.CleanAllRecordsCheckBox.IsChecked;
                if (cleanAllRecords == true)
                {
                    CleanHistoryRecord();
                    LoadHistoryRecord();
                }
                else
                {
                    string   timeSpanText = dialog.TimeSpanText;
                    int      day          = int.Parse(timeSpanText);
                    TimeSpan timeSpan     = new TimeSpan(day, 0, 0, 0);
                    CleanHistoryRecord(DateTime.Today - timeSpan);
                    LoadHistoryRecord();
                }
            }
        }
Пример #2
0
 private void CleanRecordsFromDateMenuItem_Click(object sender, RoutedEventArgs e)
 {
     // TO-DO: Add a dialog to let user choose instead of the magic number
     ConfigDialog dialog = new ConfigDialog();
     dialog.ShowDialog();
     if (dialog.Ok)
     {
         bool? cleanAllRecords = dialog.CleanAllRecordsCheckBox.IsChecked;
         if (cleanAllRecords == true)
         {
             CleanHistoryRecord();
             LoadHistoryRecord();
         }
         else
         {
             string timeSpanText = dialog.TimeSpanText;
             int day = int.Parse(timeSpanText);
             TimeSpan timeSpan = new TimeSpan(day, 0, 0, 0);
             CleanHistoryRecord(DateTime.Today - timeSpan);
             LoadHistoryRecord();
         }
     }
 }