コード例 #1
0
ファイル: EditCommand.cs プロジェクト: LigangSun/AppCenter
        protected override void OnExecute(object parameter)
        {
            bool subQuestion = false;

            Question q = null;

            if (parameter != null)
            {
                subQuestion = true;
                q           = parameter as Question;
            }
            else
            {
                subQuestion = false;
                q           = ProjectMgr.Instance.SelectedQuestion;
            }

            if (q == null)
            {
                return;
            }

            QuestionEditWindow questionEditWindow = new QuestionEditWindow(q, subQuestion, false);

            if (questionEditWindow.ShowDialog().Value)
            {
                ProjectMgr.Instance.Changed = true;
            }
        }
コード例 #2
0
        protected override void OnExecute(object parameter)
        {
            if (ProjectMgr.Instance.App == null)
            {
                return;
            }

            ObservableCollection <Question> subQuestionCollection = parameter as ObservableCollection <Question>;

            if (subQuestionCollection == null)
            {
                return;
            }

            SubQuestionTypeDialog subQuestionTypeDlg = new SubQuestionTypeDialog();

            if (subQuestionTypeDlg.ShowDialog().Value)
            {
                QuestionType       type               = subQuestionTypeDlg.SelectedQuestionType;
                Question           question           = ProjectMgr.Instance.CreateQuestion(type);
                QuestionEditWindow questionEditWindow = new QuestionEditWindow(question, true, false);
                if (questionEditWindow.ShowDialog().Value)
                {
                    subQuestionCollection.Add(question);
                    ProjectMgr.Instance.Changed = true;
                }
            }
        }
コード例 #3
0
        protected override void OnExecute(object parameter)
        {
            if (ProjectMgr.Instance.App == null)
            {
                return;
            }

            QuestionType       type               = (QuestionType)Enum.Parse(typeof(QuestionType), parameter as string);
            Question           question           = ProjectMgr.Instance.CreateQuestion(type);
            QuestionEditWindow questionEditWindow = new QuestionEditWindow(question, false, false);

            if (questionEditWindow.ShowDialog().Value)
            {
            }
        }
コード例 #4
0
        protected override void OnExecute(object parameter)
        {
            if (ProjectMgr.Instance.SelectedQuestion == null)
            {
                return;
            }

            Question newQuestion = ProjectMgr.Instance.SelectedQuestion.Clone() as Question;

            newQuestion.Id = Guid.NewGuid().ToString("N");
            QuestionEditWindow editWindow = new QuestionEditWindow(newQuestion, false, true);

            editWindow.ShowDialog();
            //ProjectMgr.Instance.App.Items.Add(newQuestion);
        }