static void OnCommandInputFormClosing(object sender, FormClosingEventArgs e) { if (!_commandInputForm.Canceled) ExecuteCommand(_commandInputForm.Command, _commandInputForm.Arguments); _commandInputForm.FormClosing -= new FormClosingEventHandler(OnCommandInputFormClosing); _commandInputForm = null; }
static void OnCapsKeyDown(KeyHookEventArgs e) { if (_commandInputForm == null) { _commandInputForm = new CommandInputForm(_commandProvider, _commandHistory); _commandInputForm.FormClosing += new FormClosingEventHandler(OnCommandInputFormClosing); _commandInputForm.Show(); } else { _commandInputForm.Cancel(); } }