Exemplo n.º 1
0
        public static void OpenQuizEditor(Quiz quiz = null, string quizPath = null, bool chkRecovery = true)
        {
            var quizEditor = new QuizEditor.QuizEditor(chkRecovery);

            openQuizEditors.Add(quizEditor);
            // Make sure quiz is specified and a recovery quiz hasn't been loaded (which would cause ChangedSinceLastSave to be true)
            if (quiz != null && !quizEditor.ChangedSinceLastSave)
            {
                quizEditor.LoadQuiz(quiz, quizPath);
            }
            quizEditor.Show();
        }
Exemplo n.º 2
0
        public QuizEditorCard(QuizEditor owner, int number)
        {
            InitializeComponent();
            QuizEditor = owner;
            Number     = number;
            RemoveSynonymsEqualToWords();

            ComparisonRules.BeforeDataChanged += (sender, e) =>
            {
                if (QuizEditor.UpdateUndoRedoStacks)
                {
                    QuizEditor.UndoStack.Push(new UndoRedoActionPair(
                                                  new Action[] { ComparisonRules.SetSemiSilentUR(ComparisonRules.Data) },
                                                  new Action[] { ComparisonRules.SetSemiSilentUR(e) },
                                                  "Change comparison rules",
                                                  new OwnerControlData(this, this.Parent)
                                                  ));
                    QuizEditor.UpdateUndoRedoTooltips();
                }

                QuizEditor.ChangedSinceLastSave = true;
            };

            ComparisonRules.AfterDataChanged += (sender, e) =>
            {
                chk_smartComp.CheckStateChanged -= Chk_smartComp_CheckStateChanged;
                if (ComparisonRules.Data.HasFlag(StringComp.SMART_RULES))
                {
                    chk_smartComp.CheckState = CheckState.Checked;
                }
                else if (ComparisonRules.Data == StringComp.Rules.None)
                {
                    chk_smartComp.CheckState = CheckState.Unchecked;
                }
                else
                {
                    chk_smartComp.CheckState = CheckState.Indeterminate;
                }
                chk_smartComp.CheckStateChanged += Chk_smartComp_CheckStateChanged;
                QuizEditor.SetGlobalSmartComparisonState();
            };

            SetTheme();
        }