private void lblGrammarCode_DoubleClick(object sender, EventArgs e) { if (Word.GrammarCode.IsNotNull()) { using (var dlg = new GrammarCodeFindDialog(Word.GrammarCode)) { if (dlg.ShowDialog() == DialogResult.OK && dlg.Selected.IsNotNull()) { Word.GrammarCode = dlg.Selected; (Word.Session as UnitOfWork).CommitChanges(); if (lblGrammarCode.DataBindings == null || lblGrammarCode.DataBindings.Count == 0) { lblGrammarCode.DataBindings.Add("Text", Word.GrammarCode, "GrammarCodeVariant1"); } lblGrammarCode.Text = dlg.Selected.GrammarCodeVariant1; lblGrammarCode.BackColor = Color.Transparent; } } //var grammarCode = XtraInputBox.Show("Insert grammar's code:", "Grammar Codes", lblGrammarCode.Text); //if (grammarCode.IsNotNullOrEmpty()) { // var gc = new XPQuery<GrammarCode>(Word.Session).Where(x => x.GrammarCodeVariant1 == grammarCode).FirstOrDefault(); // if (gc.IsNotNull()) { // Word.GrammarCode = gc; // (Word.Session as UnitOfWork).CommitChanges(); // lblGrammarCode.Text = gc.GrammarCodeVariant1; // } //} } }
private void lblGrammarCode_Click(object sender, EventArgs e) { if (Word.GrammarCode.IsNotNull() && GrammarCodeClick.IsNotNull()) { GrammarCodeClick(this, Word.GrammarCode); } else { using (var dlg = new GrammarCodeFindDialog(Word.Session)) { if (dlg.ShowDialog() == DialogResult.OK && dlg.Selected.IsNotNull()) { Word.GrammarCode = dlg.Selected; (Word.Session as UnitOfWork).CommitChanges(); lblGrammarCode.DataBindings.Add("Text", Word.GrammarCode, "GrammarCodeVariant1"); lblGrammarCode.BackColor = Color.Transparent; AddGrammarToolTip(Word.GrammarCode); } } //var grammarCode = XtraInputBox.Show("Insert grammar code:", "Grammar Code", ""); //if (grammarCode.IsNotNullOrEmpty()) { // var gc = new XPQuery<GrammarCode>(Word.Session).Where(x => x.GrammarCodeVariant1 == grammarCode).FirstOrDefault(); // if (gc.IsNotNull()) { // Word.GrammarCode = gc; // (Word.Session as UnitOfWork).CommitChanges(); // lblGrammarCode.DataBindings.Add("Text", Word.GrammarCode, "GrammarCodeVariant1"); // } //} } }