Ejemplo n.º 1
0
        void BtnAddOnClick(object sender, System.Windows.RoutedEventArgs e)
        {
            EditCustomDictionaryDialog dlg = new EditCustomDictionaryDialog();

            dlg.Title = "Add Custom Dictionary";

            if (dlg.ShowDialog() == true)
            {
                CustomDictionary dict = new CustomDictionary();
                dict.Name             = dlg.txtName.Text;
                dict.DecodedUserWords = dlg.txtUserWords.Text;
                dict.CaseSensitive    = (bool)dlg.chkCaseSensitive.IsChecked;

                SetDictionary(dict.Name, dict);
                RefreshCustomDictionaryList();
                SpellCheckManager.Reset(); // Clear the cache.
            }
        }
Ejemplo n.º 2
0
        private void BtnEditOnClick(object sender, RoutedEventArgs routedEventArgs)
        {
            string dictName = GetSelectedDictionaryName();

            CustomDictionary dict = GetDictionary(dictName);

            EditCustomDictionaryDialog dlg = new EditCustomDictionaryDialog();

            dlg.txtName.Text               = dict.Name;
            dlg.txtUserWords.Text          = dict.DecodedUserWords;
            dlg.chkCaseSensitive.IsChecked = dict.CaseSensitive;

            if (dlg.ShowDialog() == true)
            {
                bool changes = false;
                if (dlg.txtName.Text != dict.Name)
                {
                    RemoveDictionary(dict.Name);
                    dict.Name = dlg.txtName.Text;
                    changes   = true;
                }
                if (dict.DecodedUserWords != dlg.txtUserWords.Text)
                {
                    dict.DecodedUserWords = dlg.txtUserWords.Text;
                    changes = true;
                }

                if (dict.CaseSensitive != dlg.chkCaseSensitive.IsChecked)
                {
                    dict.CaseSensitive = (bool)dlg.chkCaseSensitive.IsChecked;
                    changes            = true;
                }

                if (changes)
                {
                    SetDictionary(dict.Name, dict);
                }
                RefreshCustomDictionaryList();
                SpellCheckManager.Reset(); // Clear the cache.
            }
        }