Exemplo n.º 1
0
        public void CheckSpelling(string content)
        {
            if (box.IsSpellCheckEnabled)
            {
                ClearLists();

                var matches = Regex.Matches(content, @"\w+[^\s]*\w+|\w");

                foreach (Match match in matches)
                {
                    Words.Add(new Word(match.Value.Trim(), match.Index));
                }

                foreach (var word in Words)
                {
                    bool isIgnored = IgnoredWords.Contains(word);
                    if (!isIgnored)
                    {
                        bool exists = hunSpell.Spell(word.Text);
                        if (exists)
                        {
                            IgnoredWords.Add(word);
                        }
                        else
                        {
                            MisspelledWords.Add(word);
                        }
                    }
                }

                OnPropertyChanged("MisspelledWords");
                OnPropertyChanged("IgnoredWords");
            }
        }
 /// <summary>
 /// Clears the lists.
 /// </summary>
 public void ClearLists()
 {
     try
     {
         Words.Clear();
         MisspelledWords.Clear();
     }
     catch (Exception generalException)
     {
         _logger.Info("Error occurred in ClearLists() " + generalException.ToString());
     }
 }
        /// <summary>
        /// Spells the check.
        /// </summary>
        /// <param name="content">The content.</param>
        public void SpellCheck(string content)
        {
            try
            {
                ClearLists();
                var tempWords = content.Split(' ');
                foreach (var tempWord in tempWords)
                {
                    Words.Add(tempWord.Trim());
                }

                foreach (var word in Words)
                {
                    if (!hunSpell.Spell(word) && checkignorewords(word))
                    {
                        MisspelledWords.Add(word);
                    }
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("Error occurred in SpellCheck() " + generalException.ToString());
            }
        }
Exemplo n.º 4
0
 public void ClearLists()
 {
     Words.Clear();
     MisspelledWords.Clear();
 }