internal AddinConfigurationDialog(Settings settings)
     : this()
 {
     m_appSettings = settings;
     m_allCharactersRefinerSettings = new AllCharactersRefinerSettings(settings);
     LoadConfigurations();
 }
 private void OnRefineAllCharactersSettingsChanged(AllCharactersRefinerSettings refineAllCharSettings)
 {
     if (RefineAllSettingsChanged != null)
     {
         var e = new RefineAllSettingsChangedEventArgs {
             Settings = refineAllCharSettings
         };
         RefineAllSettingsChanged(e);
     }
 }
        private void SaveConfigurations()
        {
            #region Spell-Check Settings

            SpellCheckerConfig spellCheckerInternalConfig = GetSpellCheckSettings();

            if (OnSpellCheckSettingsChanged(spellCheckerInternalConfig))
            {
                m_appSettings.SpellChecker_UserDictionaryPath = spellCheckerInternalConfig.DicPath;
                m_appSettings.SpellChecker_EditDistance       = spellCheckerInternalConfig.EditDistance;
                m_appSettings.SpellChecker_MaxSuggestions     = spellCheckerInternalConfig.SuggestionCount;

                m_appSettings.PreprocessSpell_CorrectBe      = cbPrespellCorrectBe.Checked;
                m_appSettings.PreprocessSpell_CorrectPrefix  = cbPrespellCorrectPrefixes.Checked;
                m_appSettings.PreprocessSpell_CorrectPostfix = cbPrespellCorrectSuffixes.Checked;

                Debug.Assert(listViewUserDictionaries.Items.Count > 0);

                if (listViewUserDictionaries.Items.Count > 0)
                {
                    m_appSettings.SpellChecker_MainDictionaryPath     = GetFileNameFromItem(listViewUserDictionaries.Items[0]);
                    m_appSettings.SpellChecker_MainDictionarySelected = listViewUserDictionaries.Items[0].Checked;

                    var sbPaths        = new StringBuilder();
                    var sbDescs        = new StringBuilder();
                    int selectionFlags = 0;
                    for (int i = 1; i < listViewUserDictionaries.Items.Count; ++i)
                    {
                        sbPaths.AppendFormat("{0};", GetFileNameFromItem(listViewUserDictionaries.Items[i]));
                        sbDescs.AppendFormat("{0};", GetDescriptionFromItem(listViewUserDictionaries.Items[i]));

                        if (listViewUserDictionaries.Items[i].Checked)
                        {
                            selectionFlags = selectionFlags | (1 << (i - 1));
                        }
                    }

                    m_appSettings.SpellChecker_CustomDictionaries              = sbPaths.ToString();
                    m_appSettings.SpellChecker_CustomDictionariesDescription   = sbDescs.ToString();
                    m_appSettings.SpellChecker_CustomDictionariesSelectionFlag = selectionFlags;
                }
            }

            #endregion

            #region Storing All-Chars-Refiner settings

            m_allCharactersRefinerSettings           = GetAllCharsRefinerSettings();
            m_appSettings.RefineCategoriesFlag       = (int)m_allCharactersRefinerSettings.NotIgnoredCategories;
            m_appSettings.RefineIgnoreListConcated   = m_allCharactersRefinerSettings.GetIgnoreListAsString();
            m_appSettings.RefineHalfSpacePositioning = m_allCharactersRefinerSettings.RefineHalfSpacePositioning;
            m_appSettings.RefineNormalizeHeYe        = m_allCharactersRefinerSettings.NormalizeHeYe;
            m_appSettings.RefineLongHeYeToShort      = m_allCharactersRefinerSettings.ConvertLongHeYeToShort;
            m_appSettings.RefineShortHeYeToLong      = m_allCharactersRefinerSettings.ConvertShortHeYeToLong;

            #endregion

            #region Storing Word-Completion Settings

            UpdateWordCompletionSettings();
            m_appSettings.WordCompletionCompleteWithoutHotKey = cbWCCompleteWithoutHotkey.Checked;
            m_appSettings.WordCompletionInsertSpace           = cbWCInsertSpace.Checked;
            if (rbWCShowAllWords.Checked)
            {
                m_appSettings.WordCompletionSugCount = -1;
            }
            else
            {
                m_appSettings.WordCompletionSugCount = (int)numUpDownWCWordCount.Value;
            }

            m_appSettings.WordCompletionMinWordLength = (int)numUpDownWCMinWordLength.Value;
            m_appSettings.WordCompletionFontSize      = (int)numUpDownWCFontSize.Value;

            #endregion

            #region Automatic Update and Report

            m_appSettings.LogReport_AutomaticReport = rdoSendReportAccept.Checked;

            #endregion

            m_appSettings.Save();

            OnRefineAllCharactersSettingsChanged(m_allCharactersRefinerSettings);
        }