/// <summary> /// Display user select dialog box for user to select name. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Instance containing the event data.</param> /// <created>art2m,5/17/2019</created> /// <changed>art2m,5/17/2019</changed> private void OnUserSelectMenuItem_Click(object sender, EventArgs e) { SpellingPropertiesClass.UserName = string.Empty; using (var dlgUser = new UserSelectDialogBox()) { var dlgResult = dlgUser.ShowDialog(); if (DialogResult.OK != dlgResult) { return; } SpellingListClass.SpeakString("Hello " + SpellingPropertiesClass.UserName + "!"); this.SetControlsState_AfterUserSelectOrAddUser(); } }
/// <summary> /// Check to see if the word is all ready contained in the list box. /// </summary> /// <param name="word">The word to be added to the list box.</param> /// <returns>True if no duplicate word found in the list box else false.</returns> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private bool CheckListBoxForWord(string word) { this.duplicate = new List <string>(); foreach (var item in this.lstWords.Items) { this.duplicate.Add(item.ToString()); } if (!SpellingListClass.CheckDuplicateWord(this.duplicate, word)) { return(false); } this.cboWord.Text = string.Empty; this.cboWord.Focus(); return(true); }
/// <summary> /// Get spelling words from file and place into collection for editing. /// </summary> /// <returns>true if words added to the collection else false.</returns> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private bool GetWordsFromFile() { var slc = new SpellingListClass(); if (!slc.ReadHeader(SpellingPropertiesClass.SpellingListPath)) { return(false); } var srw = new SpellingReadWriteClass(); if (!srw.ReadFile(SpellingPropertiesClass.SpellingListPath)) { return(false); } this.FillListBoxWithWordsList(); return(true); }
/// ******************************************************************************** /// <summary> /// Select user so can display this users spelling lists. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Instance containing the event data.</param> /// <created>art2m,5/22/2019</created> /// <changed>art2m,5/23/2019</changed> /// ******************************************************************************** private void OnSelectUserButton_Click(object sender, EventArgs e) { SpellingPropertiesClass.UserName = string.Empty; using (var dlgInput = new UserCreateNew()) { var dlgResult = dlgInput.ShowDialog(); if (DialogResult.OK != dlgResult) { return; } SpellingListClass.SpeakString("Hello " + SpellingPropertiesClass.UserName + "!"); } AddNewUserToUserNameFile(); this.SetControlsState_AfterUserSelectOrAddUser(); }
/// <summary> /// Display input box for user to enter new user name. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Instance containing the event data.</param> /// <created>art2m,5/17/2019</created> /// <changed>art2m,5/17/2019</changed> private void OnUserAddNewMenuItem_Click(object sender, EventArgs e) { SpellingPropertiesClass.UserName = string.Empty; using (var dlgInput = new UserCreateNew()) { var dlgResult = dlgInput.ShowDialog(); if (DialogResult.OK != dlgResult) { return; } SpellingListClass.SpeakString("Hello " + SpellingPropertiesClass.UserName + "!"); } AddNewUserToUserNameFile(); // this.SetControlsState(true); }
/// <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); }
/// <summary> /// add the word to spelling list box /// </summary> /// <param name="word">The word to be added.</param> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private void AddWordToListBox() { var word = this.cboWord.Text.Trim(); if (!ValidationClass.ValidateSpellingWord(word)) { this.SetButtonsEnabledState_AddToListButtonClicked(); this.ChangeControlsBackgroundColors(); return; } if (!this.AddWordToListBox(word)) { return; } this.SetButtonsEnabledState_AddToListButtonClicked(); this.ChangeControlsBackgroundColors(); this.SetTabOrderAddWordToList(); this.SetTabOrderAddNewWordButton(); if (this.CheckListBoxForWord(word)) { this.SetAddingWordProperties(); return(false); } // If true found duplicate word. if (!this.CheckWordSpelling(word)) { return(false); } this.lstWords.Items.Add(word); SpellingListClass.SpeakString(word); this.SetAddingWordProperties(); return(true); }
/// <summary> /// add the word to spelling list box. add word user entered in combo box /// to the list box. /// </summary> /// <param name="word">The word to be added.</param> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private void AddWordToListBox() { var word = this.cboWord.Text.Trim(); if (string.IsNullOrEmpty(word)) { this.SetButtonsEnabledState_AddToListButtonClicked(); this.ChangeControlsBackgroundColors(); return; } var spwc = new SpellingWordsCollection(); bool has = spwc.Any(cus => names.Contains(cus.FirstName)); if (this.CheckListBoxForWord(word)) { this.SetAddingWordProperties(); return; } // If true found duplicate word. if (!this.CheckWordSpelling(word)) { return; } this.lstWords.Items.Add(word); SpellingListClass.SpeakString(word); this.SetAddingWordProperties(); this.SetButtonsEnabledState_AddToListButtonClicked(); this.ChangeControlsBackgroundColors(); this.SetTabOrderAddWordToList(); this.SetTabOrderAddNewWordButton(); return(true); }
/// <summary> /// add the word to spelling list box /// </summary> /// <param name="word">The word to be added.</param> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private bool AddWordToListBox(string word) { if (this.CheckListBoxForWord(word)) { this.SetAddingWordProperties(); return(false); } // If true found duplicate word. if (!this.CheckWordSpelling(word)) { return(false); } this.lstWords.Items.Add(word); SpellingListClass.SpeakString(word); this.SetAddingWordProperties(); return(true); }
/// <summary> /// add the word to spelling list box. add word user entered in combo box /// to the list box. /// </summary> /// <param name="word">The word to be added.</param> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private void AddWordToListBox() { var word = this.cboWord.Text.Trim(); if (string.IsNullOrEmpty(word)) { this.SetButtonsEnabledState_AddToListButtonClicked(); this.ChangeControlsBackgroundColors(); return; } // Do not add word to list box if it all ready contains the word. if (this.CheckListBoxForWord(word)) { this.SetAddingWordProperties(); return; } // Validate word user is adding has correct spelling. if (!this.CheckWordSpelling(word)) { return; } // say word to validate to user word is being added to the list box. SpellingListClass.SpeakString(word); this.SetAddingWordProperties(); this.SetButtonsEnabledState_AddToListButtonClicked(); this.ChangeControlsBackgroundColors(); this.SetTabOrderAddWordToList(); this.SetTabOrderAddNewWordButton(); }
/// <summary> /// add the word to spelling list box. add word user entered in combo box /// to the list box. /// </summary> /// <param name="word">The word to be added.</param> /// <created>art2m,5/12/2019</created> /// <changed>art2m,5/12/2019</changed> private void AddWordToListBox() { var word = this.cboWord.Text.Trim(); if (string.IsNullOrEmpty(word)) { this.SetButtonsEnabledState_AddToListButtonClicked(); this.ChangeControlsBackgroundColors(); return; } if (this.CheckListBoxForWord(word)) { this.SetAddingWordProperties(); return; } // If true found duplicate word. if (!this.CheckWordSpelling(word)) { return; } SpellingListClass.SpeakString(word); this.SetAddingWordProperties(); this.SetButtonsEnabledState_AddToListButtonClicked(); this.ChangeControlsBackgroundColors(); this.SetTabOrderAddWordToList(); this.SetTabOrderAddNewWordButton(); }
/// <summary> /// Display all of the users spelling list in the list box. /// </summary> /// <created>art2m,5/22/2019</created> /// <changed>art2m,5/22/2019</changed> private void DisplayUsersSpellingList() { var dirPath = SpellingListClass.CheckDictionary(); }