Beispiel #1
0
        private void Btn_smartCompSettings_Click(object sender, EventArgs e)
        {
            var smartCompSettings = new SmartComparisonSettings(ComparisonRules.Data);
            var result            = smartCompSettings.ShowDialog();

            if (result == DialogResult.OK)
            {
                ComparisonRules.Data = smartCompSettings.Rules;
            }
        }
Beispiel #2
0
        private void ModifySmartComparisonSettingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var smartCompSettings = new SmartComparisonSettings(flp_cards.Controls.OfType <QuizEditorCard>().Select(x => x.ComparisonRules.Data));
            var result            = smartCompSettings.ShowDialog();
            var undoRedoes        = new List <UndoRedoActionPair>();

            if (result != DialogResult.OK)
            {
                return;
            }

            if (smartCompSettings.chk_ignoreCapitalizationFirstChar.CheckState == CheckState.Checked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.IgnoreFirstCapitalization, true));
            }
            else if (smartCompSettings.chk_ignoreCapitalizationFirstChar.CheckState == CheckState.Unchecked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.IgnoreFirstCapitalization, false));
            }


            if (smartCompSettings.chk_ignoreOpeningWhitespace.CheckState == CheckState.Checked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.IgnoreOpeningWhitespace, true));
            }
            else if (smartCompSettings.chk_ignoreOpeningWhitespace.CheckState == CheckState.Unchecked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.IgnoreOpeningWhitespace, false));
            }


            if (smartCompSettings.chk_ignoreEndingWhitespace.CheckState == CheckState.Checked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.IgnoreEndingWhitespace, true));
            }
            else if (smartCompSettings.chk_ignoreEndingWhitespace.CheckState == CheckState.Unchecked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.IgnoreEndingWhitespace, false));
            }


            if (smartCompSettings.chk_ignoreDotsInEnd.CheckState == CheckState.Checked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.IgnoreDotsInEnd, true));
            }
            else if (smartCompSettings.chk_ignoreDotsInEnd.CheckState == CheckState.Unchecked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.IgnoreDotsInEnd, false));
            }


            if (smartCompSettings.chk_treatTextInParenthesisAsSynonym.CheckState == CheckState.Checked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.TreatWordInParenthesisAsOptional, true));
            }
            else if (smartCompSettings.chk_treatTextInParenthesisAsSynonym.CheckState == CheckState.Unchecked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.TreatWordInParenthesisAsOptional, false));
            }


            if (smartCompSettings.chk_treatWordsBetweenSlashAsSynonyms.CheckState == CheckState.Checked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.TreatWordsBetweenSlashAsSynonyms, true));
            }
            else if (smartCompSettings.chk_treatWordsBetweenSlashAsSynonyms.CheckState == CheckState.Unchecked)
            {
                undoRedoes.Add(SetGlobalRuleState(StringComp.Rules.TreatWordsBetweenSlashAsSynonyms, false));
            }

            UndoRedoActionPair undoRedo = new UndoRedoActionPair(undoRedoes.SelectMany(x => x.UndoActions).ToArray(), undoRedoes.SelectMany(x => x.RedoActions).ToArray(),
                                                                 "Global set comparison rules state", new OwnerControlData(this, this.Parent));

            if (undoRedo.UndoActions.Length > 0)
            {
                UndoStack.Push(undoRedo);

                ChangedSinceLastSave = true;
            }

            UpdateUndoRedoTooltips();
            SetGlobalSmartComparisonState();
        }