Esempio n. 1
0
        void SetDictionary()
        {
            SetDictionaryCommand = new CommandBase((parameter, command) =>
            {
                var lang = parameter as string;
                if (string.IsNullOrEmpty(lang))
                {
                    return;
                }

                if (!File.Exists(Path.Combine(App.InitialStartDirectory, "Editor", lang + ".dic")))
                {
                    Model.Window.ShowStatus("Downloading dictionary for: " + lang);
                    if (SpellChecker.DownloadDictionary(lang))
                    {
                        Model.Window.ShowStatus($"Downloaded dictionary: {lang}", Model.Configuration.StatusMessageTimeout);
                    }
                    else
                    {
                        Model.Window.ShowStatusError("Failed to download dictionary.");
                    }
                }

                Model.Configuration.Editor.Dictionary = lang;
                SpellChecker.GetSpellChecker(lang, true); // force language to reset
                Model.Window.ShowStatus($"Spell checking dictionary changed to: {lang}.", Model.Configuration.StatusMessageTimeout);
            });
        }