/// <summary> /// Add todo list /// </summary> public void AddToDoList() { var dialog = new ToDoListInputDialog(); dialog.Closing += (s, e) => { if (dialog.DataContext is ToDoListInputViewModel vm && vm.ToDoListItem != null && vm.ToDoListItem.ToDoList.Id > 0) { ToDoListItems.Insert(0, vm.ToDoListItem); } }; dialog.ShowDialogWindow(new ToDoListInputViewModel(dialog)); }
/// <summary> /// Update ToDo List /// </summary> public void UpdateToDoList(object sender) { var toDoListItem = (sender as TextBlock).DataContext as ToDoListItem; var dialog = new ToDoListInputDialog(); dialog.Closing += (s, e) => { if (dialog.DataContext is ToDoListInputViewModel vm && vm.ToDoListItem != null && vm.ToDoListItem.ToDoList.Id > 0) { toDoListItem = vm.ToDoListItem; } }; dialog.ShowDialogWindow(new ToDoListInputViewModel(dialog, toDoListItem)); }