/// <summary> /// Event when TextBox in ToolBar is input the search condition. /// Display the search result window after system search the object. /// </summary> /// <param name="sender">TextBox.</param> /// <param name="e">KeyPressEventArgs</param> private void m_text_KeyPress(object sender, KeyPressEventArgs e) { if (!m_searchMenu.Enabled) return; if (e.KeyChar == (char)Keys.Enter) { if (string.IsNullOrEmpty(m_text.Text)) return; if (m_cnd == null) m_cnd = new SearchCriteriaBuilderDialog(this); m_cnd.Show(); m_cnd.Search(m_text.Text); } else if (e.KeyChar == (char)Keys.Escape) { m_cnd.Close(); } }
/// <summary> /// Event when the search button is clicked. /// Display the search result window after system search the object. /// </summary> /// <param name="sender">Button.</param> /// <param name="e">EventArgs.</param> private void Search(object sender, EventArgs e) { if (!m_searchMenu.Enabled) return; if (string.IsNullOrEmpty(m_text.Text)) return; if (m_cnd == null) m_cnd = new SearchCriteriaBuilderDialog(this); m_cnd.Show(); m_cnd.Search(m_text.Text); }
/// <summary> /// the action of clicking [Search] menu. /// </summary> /// <param name="sender">object(ToolStripMenuItem)</param> /// <param name="e">EventArgs</param> public void ShowSearchWindow(object sender, EventArgs e) { SearchCriteriaBuilderDialog cnd = new SearchCriteriaBuilderDialog(this); using (cnd) { cnd.ShowDialog(); } }