private void ReportAlarm(object CommandParameter) { if (SelectedTask != null) { ListBoxEntry delay = CommandParameter as ListBoxEntry; //si la task n'existe pas déjà, on l'ajoute if (ReportCollection == null) { ReportCollection = new ObservableCollection <Report>(); } if (!ReportCollection.Any(i => i.TaskID == SelectedTask.ID)) { var _report = new Report { TaskID = SelectedTask.ID, DateModified = DateTime.Now, AlarmDiseable = false }; ReportCollection.Add(_report); } var item = ReportCollection.FirstOrDefault(i => i.TaskID == SelectedTask.ID); if (item != null) { item.ExpirationDate = SelectedTask.datStart.AddMinutes(-SelectedTask.MinuteRemind + delay.MinutesData); } } }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { cboRepeat.ItemsSource = ListBoxEntry.GetDelay(); cboRepeat.SelectedIndex = 0; }