Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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();
     }
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 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;
     }
 }
Esempio n. 5
0
 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;
 }
Esempio n. 6
0
 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;
 }