Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 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();
         }
     }
 }