public WordForm(WordDictionary _dictionary, ref GNoun _nounToEdit) { nounToEdit = _nounToEdit; dictionary = _dictionary; InitializeComponent(); if (dictionary.IsExisting(nounToEdit)) { int existingNounId = dictionary.GetNounIdByName(nounToEdit.Singular); nounToEdit = dictionary.GetNounById(existingNounId); updateFormFromNoun(); } else { tBSingularNoun.Text = nounToEdit.Singular; tBPluralNoun.Text = Grammar.GuessPlural(nounToEdit.Singular); } }
private void btnAddEditName_Click(object sender, EventArgs e) { if (tbObjectName.Text == Oobject.newObjectName || string.IsNullOrWhiteSpace(tbObjectName.Text)) { MessageBox.Show(sayObjectMustHaveName); //tbObjectName.Focus(); tbObjectName.Select(); } else { GNoun nounCarrier = tempObject.Noun; WordForm wordForm = new WordForm(wordDictionary, ref nounCarrier); wordForm.FormClosed += new FormClosedEventHandler(WordForm_FormClosed); wordForm.ShowDialog(); tempObject.Noun = nounCarrier; } }