/// <summary> /// Enable/Disable menu items (Thread safe) /// </summary> /// <param name="enable">True - enable menu items, False - disable</param> /// <history> /// [Curtis_Beard] 01/11/2005 .Net Conversion /// [Curtis_Beard] 07/10/2006 CHG: Disable combo boxes during search /// [Curtis_Beard] 07/12/2006 CHG: make thread safe /// [Curtis_Beard] 07/25/2006 ADD: enable/disable context lines label /// [Curtis_Beard] 10/30/2012 ADD: 28, search within results /// [Curtis_Beard] 05/14/2015 CHG: use ToolStripMenuItem instead of MenuItem /// </history> private void SetSearchState(bool enable) { if (this.InvokeRequired) { SetSearchStateCallBack _delegate = new SetSearchStateCallBack(SetSearchState); this.Invoke(_delegate, new Object[1] { enable }); return; } FileMenu.Enabled = enable; EditMenu.Enabled = enable; ViewMenu.Enabled = enable; ToolsMenu.Enabled = enable; HelpMenu.Enabled = enable; btnSearch.ContextMenu.MenuItems[0].Enabled = (enable && lstFileNames.Items.Count > 0); btnSearch.Enabled = enable; btnCancel.Enabled = !enable; picBrowse.Enabled = enable; PanelOptionsContainer.Enabled = enable; cboFileName.Enabled = enable; cboFilePath.Enabled = enable; cboSearchForText.Enabled = enable; if (enable) btnSearch.Focus(); else btnCancel.Focus(); }
/// <summary> /// Enable/Disable menu items (Thread safe) /// </summary> /// <param name="enable">True - enable menu items, False - disable</param> /// <history> /// [Curtis_Beard] 01/11/2005 .Net Conversion /// [Curtis_Beard] 07/10/2006 CHG: Disable combo boxes during search /// [Curtis_Beard] 07/12/2006 CHG: make thread safe /// [Curtis_Beard] 07/25/2006 CHG: enable/disable context lines label /// </history> private void SetSearchState(bool enable) { BugInfo("Setting SearchState to "); if (this.InvokeRequired) { SetSearchStateCallBack _delegate = new SetSearchStateCallBack(SetSearchState); this.Invoke(_delegate, new Object[1] {enable}); BugInfo("Returned early"); return; } mnuFile.Enabled = enable; mnuEdit.Enabled = enable; mnuTools.Enabled = enable; mnuHelp.Enabled = enable; btnSearch.Enabled = enable; btnCancel.Enabled = !enable; picBrowse.Enabled = enable; pnlSearchOptions.Enabled = enable; lblContextLines.Enabled = enable; cboFileName.Enabled = enable; cboFilePath.Enabled = enable; cboSearchForText.Enabled = enable; if (enable) btnSearch.Focus(); else btnCancel.Focus(); }