/// <summary> /// Show edit notebook dialog /// </summary> public void EditNotebook(object sender) { var notebook = (Models.Notebook.Notebook)sender; var dialog = new NotebookDialog(); dialog.Closing += (s, e) => { if (dialog.DataContext is AddNotebookViewModel vm && vm.Notebook != null) { SelectedNotebookItem.Notebook = vm.Notebook; } }; dialog.ShowDialogWindow(new AddNotebookViewModel(dialog, notebook)); }
/// <summary> /// Add new notebook dialog /// </summary> public void AddNotebook() { var dialog = new NotebookDialog(); dialog.Closing += (s, e) => { if (dialog.DataContext is AddNotebookViewModel vm && vm.Notebook != null) { if (!NotebookItems.Any(x => x.Notebook == vm.Notebook)) { NotebookItems.Insert(0, new NotebookItem { Notebook = vm.Notebook, EditNotebookCommand = new RelayParameterizedCommand(EditNotebook), DeleteNotebookCommand = new RelayParameterizedCommand(DeleteNotebook) }); } } }; dialog.ShowDialogWindow(new AddNotebookViewModel(dialog)); }