/// <summary>
 /// Save preference values
 /// </summary>
 protected override void SavePreferences()
 {
     SpellingSettings.RealTimeSpellChecking      = realTimeSpellChecking;
     SpellingSettings.CheckSpellingBeforePublish = checkSpellingBeforePublish;
     SpellingSettings.EnableAutoCorrect          = enableAutoCorrect;
     SpellingSettings.Language = language;
     SpellingSettings.FireChangedEvent();
 }
예제 #2
0
 /// <summary>
 /// Save preference values
 /// </summary>
 protected override void SavePreferences()
 {
     SpellingSettings.IgnoreUppercase            = ignoreUppercase;
     SpellingSettings.IgnoreWordsWithNumbers     = ignoreWordsWithNumbers;
     SpellingSettings.RealTimeSpellChecking      = realTimeSpellChecking;
     SpellingSettings.CheckSpellingBeforePublish = checkSpellingBeforePublish;
     SpellingSettings.EnableAutoCorrect          = enableAutoCorrect;
     SpellingSettings.Language = language;
     SpellingSettings.FireChangedEvent();
 }
예제 #3
0
        public SpellingPreferencesPanel(SpellingPreferences preferences)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            _labelDictionaryLanguage.Text    = Res.Get(StringId.DictionaryLanguageLabel);
            _groupBoxGeneralOptions.Text     = Res.Get(StringId.SpellingPrefOptions);
            _checkBoxRealTimeChecking.Text   = Res.Get(StringId.SpellingPrefReal);
            _checkBoxIgnoreNumbers.Text      = Res.Get(StringId.SpellingPrefNum);
            _checkBoxIgnoreUppercase.Text    = Res.Get(StringId.SpellingPrefUpper);
            _checkBoxCheckBeforePublish.Text = Res.Get(StringId.SpellingPrefPub);
            _checkBoxAutoCorrect.Text        = Res.Get(StringId.SpellingPrefAuto);
            PanelName = Res.Get(StringId.SpellingPrefName);

            // set panel bitmap
            PanelBitmap = _spellingPanelBitmap;

            // initialize preferences
            spellingPreferences = preferences;
            spellingPreferences.PreferencesModified += new EventHandler(spellingPreferences_PreferencesModified);

            // core options
            _checkBoxIgnoreUppercase.Checked    = spellingPreferences.IgnoreUppercase;
            _checkBoxIgnoreNumbers.Checked      = spellingPreferences.IgnoreWordsWithNumbers;
            _checkBoxCheckBeforePublish.Checked = spellingPreferences.CheckSpellingBeforePublish;
            _checkBoxRealTimeChecking.Checked   = spellingPreferences.RealTimeSpellChecking;
            _checkBoxAutoCorrect.Checked        = spellingPreferences.EnableAutoCorrect;

            // initialize language combo
            _comboBoxLanguage.BeginUpdate();
            _comboBoxLanguage.Items.Clear();
            SpellingCheckerLanguage currentLanguage = spellingPreferences.Language;

            SpellingLanguageEntry[] languages = SpellingSettings.GetInstalledLanguages();
            Array.Sort(languages, new SentryLanguageEntryComparer(CultureInfo.CurrentUICulture));

            foreach (SpellingLanguageEntry language in languages)
            {
                int index = _comboBoxLanguage.Items.Add(language);
                if (language.Language == currentLanguage)
                {
                    _comboBoxLanguage.SelectedIndex = index;
                }
            }
            // defend against invalid value
            if (_comboBoxLanguage.SelectedIndex == -1)
            {
                Debug.Fail("Language in registry not supported!");
            }
            _comboBoxLanguage.EndUpdate();

            ManageSpellingOptions();

            // hookup to changed events to update preferences
            _checkBoxIgnoreUppercase.CheckedChanged    += new EventHandler(checkBoxIgnoreUppercase_CheckedChanged);
            _checkBoxIgnoreNumbers.CheckedChanged      += new EventHandler(checkBoxIgnoreNumbers_CheckedChanged);
            _checkBoxCheckBeforePublish.CheckedChanged += new EventHandler(checkBoxCheckBeforePublish_CheckedChanged);
            _checkBoxRealTimeChecking.CheckedChanged   += new EventHandler(checkBoxRealTimeChecking_CheckedChanged);
            _checkBoxAutoCorrect.CheckedChanged        += new EventHandler(checkBoxAutoCorrect_CheckedChanged);

            _comboBoxLanguage.SelectedIndexChanged += new EventHandler(comboBoxLanguage_SelectedIndexChanged);
        }