/// <summary> /// Opens user selected spelling list. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Instance containing event data.</param> /// <created>art2m,5/17/2019</created> /// <changed>art2m,5/17/2019</changed> private void OnMenuSpellOpenSpellingList_Click(object sender, EventArgs e) { var mwc = new MisspelledWordsCollection(); mwc.ClearCollection(); using (var openDlg = new OpenFileDialog()) { openDlg.ShowDialog(); SpellingPropertiesClass.SpellingListPath = openDlg.FileName; SpellingPropertiesClass.OpenedSpellingList = true; SpellingPropertiesClass.CreatingNewSpellingList = false; this.lstWords.Items.Clear(); if (!this.GetWordsFromFile()) { return; } this.SetButtonsEnabledState_OpenSpellingListButtonStateClicked(); this.ChangeControlsBackgroundColors(); } }
/// <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(); var slc = new SpellingListClass(); if (slc.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); }