//Кнопка Удалить заметку private void XDelNote_Click(object sender, RoutedEventArgs e) { if (DataBaseOfNotes.NoteForShow.Count == 0) { MessageBox.Show("Заметка на удаление не выбрана.", "Информация", MessageBoxButton.OK, MessageBoxImage.Information); return; } DeleteСonfirmation deleteСonfirmation = new DeleteСonfirmation(); if (deleteСonfirmation.ShowDialog() == true) { try { DataBaseOfNotes.AllNotesCollection.Remove(DataBaseOfNotes.NoteForShow[0]); XListBoxAllNotes.Items.Refresh(); } catch { DataBaseOfNotes.NoteForShow.Clear(); ShowNote.ClearDemonstrationWindow(this); SavedAndLoaded.SavingNotes(DataBaseOfNotes.AllNotesCollection); } } }
// Выбор заметки из списка заметок Просмотр на дату private void XListBoxToSeeOnDate_SelectionChanged(object sender, SelectionChangedEventArgs e) { DataBaseOfNotes.NoteForShow.Clear(); DataBaseOfNotes.NoteForShow.Add(XListBoxToSeeOnDate.SelectedValue as SinglNote); ShowNote.Demonstration(DataBaseOfNotes.NoteForShow, this); try { XListBoxAllNotes.SelectedValue = null; } catch { } }
public MainWindow() { InitializeComponent(); SavedAndLoaded.LoadingNotes(DataBaseOfNotes.AllNotesCollection); XListBoxAllNotes.ItemsSource = DataBaseOfNotes.AllNotesCollection; foreach (var e in DataBaseOfNotes.AllNotesCollection) { if (e.TimeOfRepeatRead == DateTime.Now || (e.TimeOfRepeatRead < DateTime.Now && e.TimeOfRepeatRead != DateTime.MinValue)) { if (DataBaseOfNotes.DateNotesCollection.Contains(e) == false) { DataBaseOfNotes.DateNotesCollection.Add(e); } } } XListBoxToSeeOnDate.ItemsSource = DataBaseOfNotes.DateNotesCollection; if (DataBaseOfNotes.NoteForShow.Count != 0) { ShowNote.Demonstration(DataBaseOfNotes.NoteForShow, this); } }