public async Task RemoveNoteAsync() { if (SelectedNote == null || NotesCollection.Count <= 0) { return; } await Task.FromResult(NotesCollection.Remove(SelectedNote)); SelectedNote = NotesCollection.LastOrDefault(); }
private async void DeleteButton_Click(object sender, RoutedEventArgs e) { ContentDialog deleteFileDialog = new ContentDialog { Title = "Delete note permanently?", Content = "If you delete this note, you won't be able to recover it. Do you want to delete it?", PrimaryButtonText = "Delete", CloseButtonText = "Cancel" }; ContentDialogResult result = await deleteFileDialog.ShowAsync(); if (result == ContentDialogResult.Primary) { NotesCollection.Remove((sender as FrameworkElement).Tag as Note); ((sender as FrameworkElement).Tag as Note).Delete(App.Context, App.ShowToastNotification); } }
public void DeleteNote(AnnouncementsNote note) { NoteAnnouncementsRepository.Instance.Service.Delete(note.noteID); NotesCollection.Remove(note); }