private void UpdateSelectedDate() { var dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); var nulldate = new DateTime(1, 1, 1); if (AllMonth.IsChecked) { AlarmHandler.UpdateDate(nulldate, dt); return; } if (Month1.IsChecked) { AlarmHandler.UpdateDate(dt.AddMonths(-1), dt); return; } if (Month3.IsChecked) { AlarmHandler.UpdateDate(dt.AddMonths(-3), dt); return; } if (Month6.IsChecked) { AlarmHandler.UpdateDate(dt.AddMonths(-6), dt); return; } FlyOut.Visibility = Visibility.Visible; }
private void OK_Click(object sender, RoutedEventArgs e) { FlyOut.Visibility = Visibility.Collapsed; DateTime start; DateTime end; if (!DateTime.TryParse(EndDate.Text, out end)) { end = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); } if (DateTime.TryParse(StartDate.Text, out start)) { AlarmHandler.UpdateDate(start, end); } }