public void RemoveCodeScheme() { if (SelectedCodeScheme == null) { return; } using (UndoTransaction tx = new UndoTransaction(UndoManager)) { StudyUnit.RemoveCodeSchemeFromResponse(SelectedCodeScheme); SelectedCodeScheme.Codes.Clear(); codeSchemes.Remove(SelectedCodeScheme); tx.Commit(); } SelectedCodeScheme = null; }
public void RemoveQuestion() { using (UndoTransaction tx = new UndoTransaction(UndoManager)) { StudyUnit.OnRemoveQuestion(SelectedQuestion); SelectedQuestions.Remove(SelectedQuestion); SelectedQuestionItem = null; ConceptVM concept = SelectedConcept; UpdateModel(false); SelectedConcept = concept; tx.Commit(); } }
public BookVM SelectBookExternal(BookRelation relation) { SelectObjectWindowVM<BookVM> vm = new SelectObjectWindowVM<BookVM>(books); SelectObjectWindow window = new SelectObjectWindow(vm); BookVM book = SelectObjectWindow.Select(Resources.SelectBook, vm) as BookVM; //文献の選択 if (book != null) { using (UndoTransaction tx = new UndoTransaction(UndoManager)) { if (book.Book.FindRelation(relation) == null) { //ViewModelはEditBookWindowが表示されるたびに作りなおされるのでここで生成する必要はない。 book.Book.BookRelations.Add(relation); } StudyUnit.OnRemoveBooks(); tx.Commit(); } } return book; }
public void RemoveBookExternal(BookVM targetBook) { if (targetBook == null) { return; } using (UndoTransaction tx = new UndoTransaction(UndoManager)) { books.Remove(targetBook); StudyUnit.OnRemoveBooks(); tx.Commit(); } if (SelectedBook == targetBook) { SelectedBookItem = null; } }
public BookVM EditBookExternal(BookVM targetBook) { if (targetBook == null) { return null; } BookVM newBook = AddOrEditBook(targetBook.Book, null); if (newBook != null) { using (UndoTransaction tx = new UndoTransaction(UndoManager)) { int index = books.IndexOf(targetBook); books.RemoveAt(index); books.Insert(index, newBook); StudyUnit.OnRemoveBooks(); tx.Commit(); } } return newBook; }
public BookVM AddBookExternal(BookRelation relation) { BookVM newBook = AddOrEditBook(null, relation); if (newBook != null) { using (UndoTransaction tx = new UndoTransaction(UndoManager)) { books.Add(newBook); StudyUnit.OnRemoveBooks(); tx.Commit(); } } return newBook; }