private void UpdateCommander(object sender, EventArgs e) { // activePane is initialized to editorView. When the QueryWindow is activated, // this handler is fired, so we only want to use 'sender' when either editorView // or resultsView fires this handler. if (sender is IEditor) { activePane = (IEditor)sender; } commander.SetWorker(this); commander.AdvancedControls.IsEnabled = (activePane == editorView); commander.ConnectControls.IsEnabled = true; commander.ExecuteControls.IsEnabled = driver.IsExecuting; commander.PasteControls.IsEnabled = activePane.CanPaste; commander.RedoControls.IsEnabled = activePane.CanRedo; commander.SaveControls.IsEnabled = !activePane.IsSaved; commander.SelectControls.IsEnabled = activePane.HasSelection; commander.TextControls.IsEnabled = activePane.HasContent; commander.UndoControls.IsEnabled = activePane.CanUndo; commander.SetChecker("ToggleWhitespace", activePane.WhitespaceVisible); commander.SetChecker("ToggleResultsPane", !splitContainer.Panel2Collapsed); if (!editorView.IsExecutable) { commander.SqlControls.IsEnabled = false; } if (ResultTargetChanged != null) { ResultTargetChanged(sender, new ResultTargetChangedEventArgs(resultTarget)); } }
private void DoUpdateCommander(object sender, EventArgs e) { commander.SetWorker(this); commander.AdvancedControls.IsEnabled = false; commander.ConnectControls.IsEnabled = true; commander.ExecuteControls.IsEnabled = false; commander.PasteControls.IsEnabled = CanPaste; commander.RedoControls.IsEnabled = false; commander.SaveControls.IsEnabled = !IsSaved; commander.SelectControls.IsEnabled = HasSelection; commander.TextControls.IsEnabled = false; commander.UndoControls.IsEnabled = false; commander.SetChecker("ToggleWhitespace", false); commander.SetChecker("ToggleResultsPane", false); commander.SqlControls.IsEnabled = false; }