Ejemplo n.º 1
0
        /// <summary>
        ///     Check spelling word for the correct spelling.
        ///     If incorrect spelling the get a list of possible correct spelling.
        /// </summary>
        /// <param name="word">The word to check spelling on.</param>
        /// <returns>True if word is spelled correctly else false.</returns>
        /// <created>art2m,5/10/2019</created>
        /// <changed>art2m,5/10/2019</changed>
        public static bool CheckWordSpelling(string word)
        {
            using (var hunspell = new Hunspell("en_us.aff", "en_us.dic"))
            {
                if (hunspell.Spell(word))
                {
                    return(true);
                }

                mwc.AddItem(word);

                MyMessagesClass.InformationMessage = string.Concat("This word is not spelled correctly:  ", word);
                MyMessagesClass.ShowInformationMessageBox();

                CheckDictionary(word);

                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Check the spelling word user has entered.
        /// </summary>
        /// <param name="word">The word to be checked for spelling.</param>
        /// <returns>True if word is correct else false.</returns>
        /// <created>art2m,5/12/2019</created>
        /// <changed>art2m,5/12/2019</changed>
        private bool CheckWordSpelling(string word)
        {
            var msw = new MisspelledWordsCollection();

            if (SpellingListClass.CheckWordSpelling(word))
            {
                return(true);
            }

            msw.AddItem(word);

            var          msg     = string.Concat("This word is not spelled correctly:  ", word);
            const string Caption = "Spelling Incorrect.";

            MessageBox.Show(msg, Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);

            this.AddSuggestions();

            return(false);
        }