private void CreateQuestionEditCommand() { this.questionEdit = new RelayCommand <TestItem>(item => { try { TestItemEditView win = new TestItemEditView(item); if (win.ShowDialog() ?? false) { this.selectedItem = item; this.items.Remove(this.selectedItem); item.Question = win.Question; item.Answer = win.Answer; item.Example = win.Example; this.items.Add(item); } this.SelectedQuestion = null; base.RaisePropertyChanged("SelectedQuestion"); base.RaisePropertyChanged("Questions"); } catch (Exception ex) { ApplicationErrorHandler.HandleException(ex); } }); }
private void CreateQuestionAddCommand() { this.questionAdd = new RelayCommand(() => { try { TestItemEditView win = new TestItemEditView(); if (win.ShowDialog() ?? false) { TestItem item = new TestItem() { Question = win.Question, Answer = win.Answer, Example = win.Example }; this.AddItem(item); } } catch (Exception ex) { ApplicationErrorHandler.HandleException(ex); } }); }