Example #1
0
 private static void Delete(NoteTreeItem sender, RoutedEventArgs e)
 {
     if (ReferenceEquals(MainWindow.GetInstance.NotesTree.SelectedItem, sender))
     {
         MainWindow.GetInstance.SetActiveNote(null);
         sender.IsSelected = false;
     }
     MainWindow.GetInstance.NotesTree.Items.Remove(sender);
     MainWindow.GetInstance.NotesRepository.MarkAsDeleted(sender.NoteId);
 }
Example #2
0
        private static void Rename(NoteTreeItem sender, RoutedEventArgs e)
        {
            var dialog = new CreateNoteDialog();

            if (dialog.ShowDialog() == true)
            {
                var title = dialog.Result().Title;
                MainWindow.GetInstance.NotesRepository.UpdateNote(new NoteUpdateArgs
                {
                    Id    = sender.NoteId,
                    Title = title
                });
                sender.Header = title;
            }
        }