Exemple #1
0
        public void AddSentence()
        {
            CreateSentenceWindowVM vm     = new CreateSentenceWindowVM(this, new Statement());
            CreateSentenceWindow   window = new CreateSentenceWindow(vm);

            window.Owner = Application.Current.MainWindow;
            if (window.ShowDialog() == true)
            {
                InsertStatementConstruct(vm.Statement);
            }
        }
Exemple #2
0
        public void EditConstruct()
        {
            ConstructVM construct = SelectedConstruct;

            if (construct is StatementVM)
            {
                StatementVM            statement = (StatementVM)construct;
                CreateSentenceWindowVM vm        = new CreateSentenceWindowVM(this, (Statement)statement.Model);
                CreateSentenceWindow   window    = new CreateSentenceWindow(vm);
                window.Owner = Application.Current.MainWindow;
                if (window.ShowDialog() == true && vm.Statement != null)
                {
                    StatementVM newStatement = new StatementVM(vm.Statement);
                    InitConstruct(newStatement);
                    int index = constructs.IndexOf(construct);
                    constructs.RemoveAt(index);
                    constructs.Insert(index, newStatement);
                    UpdateModel(true);
                    SelectedConstructItem = newStatement;
                }
            }
            else if (construct is IfThenElseVM)
            {
                EditBranchExternal((IfThenElseVM)construct, Application.Current.MainWindow);
            }
            else if (construct is QuestionConstructVM)
            {
                ChangeSingleQuestionNumberWindowVM vm     = new ChangeSingleQuestionNumberWindowVM((QuestionConstructVM)construct);
                ChangeSingleQuestionNumberWindow   window = new ChangeSingleQuestionNumberWindow(vm);
                window.Owner = Application.Current.MainWindow;
                if (window.ShowDialog() == true)
                {
                    using (UndoTransaction tx = new UndoTransaction(UndoManager))
                    {
                        if (SequenceUtils.RenumberQuestionNumber(this, vm.QuestionNumber))
                        {
                            UpdateModel(false);
                            tx.Commit();
                        }
                    }
                }
            }
        }
 public void EditConstruct()
 {
     ConstructVM construct = SelectedConstruct;
     if (construct is StatementVM)
     {
         StatementVM statement = (StatementVM)construct;
         CreateSentenceWindowVM vm = new CreateSentenceWindowVM(this,  (Statement)statement.Model);
         CreateSentenceWindow window = new CreateSentenceWindow(vm);
         window.Owner = Application.Current.MainWindow;
         if (window.ShowDialog() == true && vm.Statement != null)
         {
             StatementVM newStatement = new StatementVM(vm.Statement);
             InitConstruct(newStatement);
             int index = constructs.IndexOf(construct);
             constructs.RemoveAt(index);
             constructs.Insert(index, newStatement);
             UpdateModel(true);
             SelectedConstructItem = newStatement;
         }
     }
     else if (construct is IfThenElseVM)
     {
         EditBranchExternal((IfThenElseVM)construct, Application.Current.MainWindow);
     }
 }
 public void AddSentence()
 {
     CreateSentenceWindowVM vm = new CreateSentenceWindowVM(this, new Statement());
     CreateSentenceWindow window = new CreateSentenceWindow(vm);
     window.Owner = Application.Current.MainWindow;
     if (window.ShowDialog() == true)
     {
         InsertStatementConstruct(vm.Statement);
     }
 }
 public CreateSentenceWindow(CreateSentenceWindowVM viewModel)
 {
     InitializeComponent();
     this.viewModel = viewModel;
     DataContext    = viewModel;
 }
 public CreateSentenceWindow(CreateSentenceWindowVM viewModel)
 {
     InitializeComponent();
     this.viewModel = viewModel;
     DataContext = viewModel;
 }