示例#1
0
        public void ChangeQuestionNumbers()
        {
            ChangeMultipleQuestionNumberWindowVM vm     = new ChangeMultipleQuestionNumberWindowVM(this);
            ChangeMultipleQuestionNumberWindow   window = new ChangeMultipleQuestionNumberWindow(vm);

            window.Owner = Application.Current.MainWindow;
            if (window.ShowDialog() == true)
            {
                using (UndoTransaction tx = new UndoTransaction(UndoManager))
                {
                    if (SequenceUtils.RenumberQuestionNumbers(this, vm.QuestionNumbers))
                    {
                        UpdateModel(false);
                        tx.Commit();
                    }
                }
            }
        }
示例#2
0
 private void MoveConstruct(int fromIndex, int toIndex)
 {
     using (UndoTransaction tx = new UndoTransaction(UndoManager))
     {
         ConstructVM fromConstruct = Constructs[fromIndex];
         ConstructVM toConstruct   = Constructs[toIndex];
         if (RenumberQuestionNo && fromConstruct is QuestionConstructVM && toConstruct is QuestionConstructVM)
         {
             QuestionNumberVM fromQuestionNumber = new QuestionNumberVM((QuestionConstructVM)fromConstruct);
             fromQuestionNumber.AfterValue = toConstruct.No;
             QuestionNumberVM toQuestionNumber = new QuestionNumberVM((QuestionConstructVM)toConstruct);
             toQuestionNumber.AfterValue = fromConstruct.No;
             List <QuestionNumberVM> questionNumbers = new List <QuestionNumberVM>();
             questionNumbers.Add(fromQuestionNumber);
             questionNumbers.Add(toQuestionNumber);
             SequenceUtils.RenumberQuestionNumbers(this, questionNumbers);
         }
         Constructs.Move(fromIndex, toIndex);
         UpdateModel(false);
         tx.Commit();
     }
     FocusCell();
 }