public vsCommandStatus QueryStatus(string commandName) { vsCommandStatus status = vsCommandStatus.vsCommandStatusNinched | vsCommandStatus.vsCommandStatusSupported; if (this.CommandList.ContainsKey(commandName)) { CommandHandle handle = this.CommandList[commandName]; if (handle.StatusMethod != null) { status = handle.StatusMethod.Invoke(); } else { bool found = true; if (found) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } } return(status); }
public void QueryStatus(vsCommandStatusTextWanted NeededText, ref vsCommandStatus StatusOption, ref object CommandText) { StatusOption = _client.IsRunning && Connect.IsSolutionOpened ? vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled : vsCommandStatus.vsCommandStatusSupported; return; }
public void QueryStatus(vsCommandStatusTextWanted NeededText, ref vsCommandStatus StatusOption, ref object CommandText) { StatusOption = _client.IsRunning && Connect.IsSolutionOpened ? vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled : vsCommandStatus.vsCommandStatusSupported; return; }
public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (commandName == GetCommandFullName(COMMAND_VIEWER_COMMAND_NAME)) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; return; } else if (commandName == GetCommandFullName(CLOSE_ALL_DOCUMENTS_COMMAND_NAME)) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; return; } else if (commandName == GetCommandFullName(NPETSHOP_SLN_GENERATOR_COMMAND_NAME)) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; return; } else if (commandName == GetCommandFullName(COLLAPSE_ALL_PROJECTS_COMMAND_NAME)) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; return; } else if (commandName == GetCommandFullName(SHOW_SHORTCUT_LIST_COMMAND_NAME)) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; return; } } }
public vsCommandStatus QueryStatus(string commandName, WSPBuilderHandle WSPTool) { vsCommandStatus status = vsCommandStatus.vsCommandStatusNinched | vsCommandStatus.vsCommandStatusSupported; if (WSPTool.Running) { // The WSPTool is runnig no menu button available status |= vsCommandStatus.vsCommandStatusNinched; } else { if (CommandList.ContainsKey(commandName)) { CommandHandle handle = CommandList[commandName]; if (handle.StatusMethod != null) { status = handle.StatusMethod.Invoke(); } else { bool found = true; if (found) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } } } return(status); }
/// <summary> /// 转换命令状态 /// </summary> /// <param name="cmdViewStatus"></param> /// <returns></returns> public static vsCommandStatus Convert2VsCmdStatus(CommandViewStatus cmdViewStatus) { vsCommandStatus status = vsCommandStatus.vsCommandStatusSupported;; switch (cmdViewStatus) { case CommandViewStatus.Enabled: status |= vsCommandStatus.vsCommandStatusEnabled; break; case CommandViewStatus.Disabled: status = vsCommandStatus.vsCommandStatusSupported; break; case CommandViewStatus.Visible: status |= vsCommandStatus.vsCommandStatusEnabled; break; case CommandViewStatus.Invisible: status |= vsCommandStatus.vsCommandStatusInvisible; break; default: status = vsCommandStatus.vsCommandStatusInvisible; break; } return(status); }
/// <summary> /// Queries the status. /// </summary> /// <param name="commandName">ProjectName of the command.</param> /// <param name="neededText">The needed text.</param> /// <param name="status">The status option.</param> /// <param name="commandText">The command text.</param> public void QueryStatus( string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { try { if (neededText != vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { return; } if (this.commandInfos.Any(vsCommandInfo => vsCommandInfo.Command.Name == commandName)) { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } catch (Exception exception) { string message = string.Format("commandName={0} exceptionMessage={1}", commandName, exception.Message); TraceService.WriteLine("CommandManager::QueryStatus " + message); } }
public override void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { base.QueryStatus(commandName, neededText, ref status, ref commandText); if (!m_addInSettings.ShowOpenModelButton) { status = status | vsCommandStatus.vsCommandStatusInvisible; } }
public override void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { base.QueryStatus(commandName, neededText, ref status, ref commandText); if (!m_addInSettings.ShowSchemaExportButton || (!m_solutionManager.IsSchemaExportProjectAvailable && m_addInSettings.HideSchemaExportButtonIfProjectUnavailable)) { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusInvisible; } }
public void QueryStatus(vsCommandStatusTextWanted NeededText, ref vsCommandStatus StatusOption, ref object CommandText) { StatusOption = vsCommandStatus.vsCommandStatusInvisible | vsCommandStatus.vsCommandStatusUnsupported; //var config = Path.Combine(Path.Combine(Environment.GetFolderPath(_client.GetAppDataFolder()), "MightyMoose"), "AutoTest.config"); //StatusOption = File.Exists(config) || Connect.IsSolutionOpened // ? vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled // : vsCommandStatus.vsCommandStatusSupported; }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param name='commandName'>The name of the command to determine state for.</param> /// <param name='neededText'>Text that is needed for the command.</param> /// <param name='status'>The state of the command in the user interface.</param> /// <param name='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (Factory.GetCommands().Any(cmd => commandName == _addIn.ProgID + "." + cmd.Id)) { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } }
public void QueryStatus(vsCommandStatusTextWanted NeededText, ref vsCommandStatus StatusOption, ref object CommandText) { StatusOption = vsCommandStatus.vsCommandStatusInvisible | vsCommandStatus.vsCommandStatusUnsupported; //var config = Path.Combine(Path.Combine(Environment.GetFolderPath(_client.GetAppDataFolder()), "MightyMoose"), "AutoTest.config"); //StatusOption = File.Exists(config) || Connect.IsSolutionOpened // ? vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled // : vsCommandStatus.vsCommandStatusSupported; }
public bool ComandState(vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { commandText = Caption; if (IDE.ApplicationObject.ActiveDocument != null) commandText = Caption + " [" + IDE.ApplicationObject.ActiveDocument.Name + "]"; return false; }
public void QueryStatus(vsCommandStatusTextWanted NeededText, ref vsCommandStatus StatusOption, ref object CommandText) { Logger.Write("client running = " + _client.IsRunning); Logger.Write("soution opened = " + Connect.IsSolutionOpened); StatusOption = _client.IsRunning && Connect.IsSolutionOpened ? vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled : vsCommandStatus.vsCommandStatusSupported; return; }
public void QueryStatus(vsCommandStatusTextWanted NeededText, ref vsCommandStatus StatusOption, ref object CommandText) { Logger.Write("client running = " + _client.IsRunning); Logger.Write("soution opened = " + Connect.IsSolutionOpened); StatusOption = _client.IsRunning && Connect.IsSolutionOpened ? vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled : vsCommandStatus.vsCommandStatusSupported; return; }
protected virtual vsCommandStatus Status() { vsCommandStatus result = vsCommandStatus.vsCommandStatusNinched | vsCommandStatus.vsCommandStatusSupported; if (this.DTEInstance.Application.Solution.IsOpen) { result = vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported; } return(result); }
public vsCommandStatus GetCommandStatus() { vsCommandStatus cs = vsCommandStatus.vsCommandStatusUnsupported; if (System.IO.File.Exists(Common.chDTE.Solution.FileName)) { cs = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } return(cs); }
void IDTCommandTarget.QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus statusOption, ref object commandText) { vsCommandStatus statusOptionCopy = statusOption; object commandTextCopy = commandText; ShellProxy.Instance.InvokeHook(hooks => hooks.HandleQueryStatus(commandName, neededText, ref statusOptionCopy, ref commandTextCopy)); statusOption = statusOptionCopy; commandText = commandTextCopy; }
public void QueryStatus( string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText ) { if ( neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone ) { if ( commandName == "SSMSAddin.Connect.SSMSAddin" ) { status = ( vsCommandStatus )vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (VS_AddIn.notNull()) if(neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (VS_AddIn.showCommand(commandName)) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported|vsCommandStatus.vsCommandStatusEnabled; return; } } }
public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText != vsCommandStatusTextWanted.vsCommandStatusTextWantedNone || !_gitPlugin.CanHandleCommand(commandName)) return; if (_gitPlugin.IsCommandEnabled(commandName)) status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; else status = vsCommandStatus.vsCommandStatusSupported; }
public void QueryStatus(string CmdName, vsCommandStatusTextWanted NeededText, ref vsCommandStatus StatusOption, ref object CommandText) { vsCommandStatus vsCommandStatu; if (CmdName == "dg.Sql.SchemaGeneratorAddIn.Connect.GenerateDalFromSelection") { if (NeededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { vsCommandStatu = (SchemaGenerator.HasSelection(this._applicationObject) ? vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled : vsCommandStatus.vsCommandStatusSupported); StatusOption = vsCommandStatu; } } }
public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText != vsCommandStatusTextWanted.vsCommandStatusTextWantedNone || !_gitPlugin.CanHandleCommand(commandName)) return; if (_gitPlugin.IsCommandEnabled(commandName)) status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; else status = vsCommandStatus.vsCommandStatusSupported; }
/// <summary> /// Implements the QueryStatus method of the IDTCommandTarget interface. This is called /// when the command's availability is updated /// </summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (commandName == "CSVSAddInCommandBarUI.Connect.CSVSAddInCommandBarUI") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; return; } } }
public bool QueryStatus(String strCommandName, ref vsCommandStatus StatusOption) { if (strCommandName.CompareTo("CodeBeautifier.Connect." + m_strCommandName) == 0) { StatusOption = (vsCommandStatus)(vsCommandStatus.vsCommandStatusSupported); if (Status()) { StatusOption = StatusOption | (vsCommandStatus)vsCommandStatus.vsCommandStatusEnabled; } return(true); } return(false); }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus( string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (commandName == "SSMSHistorizer.Connect.SSMSHistorizer") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; return; } } }
public virtual void QueryStatus(string cmdName , vsCommandStatusTextWanted neededText , ref vsCommandStatus statusOption , ref object commandText ) { switch (neededText) { case vsCommandStatusTextWanted.vsCommandStatusTextWantedNone: { if (null != _application.Debugger && _application.Debugger.DebuggedProcesses.Count > 0) { statusOption = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } break; } }
public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (commandName == "Slam.VisualStudio.Addin.Connect.Slam") { status = (vsCommandStatus)vsCommandStatus. vsCommandStatusSupported | vsCommandStatus. vsCommandStatusEnabled; return; } } }
protected override vsCommandStatus Status() { vsCommandStatus status = vsCommandStatus.vsCommandStatusNinched | vsCommandStatus.vsCommandStatusSupported; if (this.DTEInstance.SelectedProject != null) { WSPFileHandle wspHandle = new WSPFileHandle(this.DTEInstance); if (wspHandle.WspFilename != null) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } return(status); }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This /// is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (commandName == "FwAddin.Connect.GotoFunctionHeaderDown" || commandName == "FwAddin.Connect.GotoFunctionHeaderUp" || commandName == "FwAddin.Connect.InsertMethodHeader" || commandName == "FwAddin.Connect.ToggleHAndCpp") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; return; } } }
public void QueryStatus(string cmdName, vsCommandStatusTextWanted neededText, ref vsCommandStatus statusOption, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (cmdName == addInInstance.ProgID + "." + VIEWER_COMMAND_NAME) { statusOption = (vsCommandStatus)(vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); return; } else { statusOption = vsCommandStatus.vsCommandStatusUnsupported; return; } } }
public override void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (m_solutionManager.IsEnabled && m_addInSettings.ShowPropertyMapper && m_application.ActiveDocument != null && (m_application.ActiveDocument.Name.Contains("DaoImpl") || !m_addInSettings.OnlyEnableCodeGenInDaoImpl) ) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported; if (IsCommandAvailable(false)) { status = status | vsCommandStatus.vsCommandStatusEnabled; } } else { status = (vsCommandStatus)(vsCommandStatus.vsCommandStatusInvisible | vsCommandStatus.vsCommandStatusUnsupported); } }
/// <summary> /// Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated /// </summary> /// <param name="neededText">Text that is needed for the command.</param> /// <param name="status">The state of the command in the user interface.</param> /// <param name="commandText">Text requested by the neededText parameter.</param> internal void OnQueryStatus(vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (_queryStatus != null) { VSMenuQueryStatusEventArgs e = new VSMenuQueryStatusEventArgs(); e.NeededText = neededText; e.Status = status; e.CommandText = commandText; _queryStatus(this, e); status = e.Status; } else if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } }
internal void OnQueryStatus(vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (this._queryStatus != null) { VSMenuQueryStatusEventArgs vSMenuQueryStatusEventArgs = new VSMenuQueryStatusEventArgs(); vSMenuQueryStatusEventArgs.NeededText = neededText; vSMenuQueryStatusEventArgs.Status = status; vSMenuQueryStatusEventArgs.CommandText = commandText; this._queryStatus(this, vSMenuQueryStatusEventArgs); status = vSMenuQueryStatusEventArgs.Status; } else { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { status = (vsCommandStatus)3; } } }
private vsCommandStatus QueryStatusForEditWsdl() { vsCommandStatus status = vsCommandStatus.vsCommandStatusInvisible; UIHierarchy uiHierarchy = (UIHierarchy)applicationObject.Windows.Item( DteConstants.vsWindowKindSolutionExplorer).Object; foreach (UIHierarchyItem item in (Array)uiHierarchy.SelectedItems) { string itemName = item.Name; if (itemName.IndexOf(".wsdl") > -1) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported; AppLog.LogMessage("Edit WSDL command is enabled."); break; } } return(status); }
protected override vsCommandStatus Status() { vsCommandStatus status = vsCommandStatus.vsCommandStatusNinched | vsCommandStatus.vsCommandStatusSupported; if (this.DTEInstance.SelectedProject != null) { bool ok = false; SelectedItems items = this.DTEInstance.Application.SelectedItems; if (items != null) { foreach (SelectedItem item in items) { ProjectPaths projectPaths = new ProjectPaths(this.DTEInstance.GetProject(item)); if (projectPaths.DoSharePointRootExist()) { ok = true; if (item.ProjectItem != null) { string featurefilename = item.ProjectItem.Properties.Item("FullPath").Value.ToString(); string path = Path.GetFullPath(featurefilename); if (!path.StartsWith(projectPaths.PathSharePointRoot, StringComparison.InvariantCultureIgnoreCase)) { ok = false; break; } } } } } if (ok) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } return(status); }
void IDTCommandTarget.QueryStatus(string cmdName , vsCommandStatusTextWanted neededText , ref vsCommandStatus statusOption , ref object commandText ) { statusOption = vsCommandStatus.vsCommandStatusUnsupported; ICommand command = null; _vsCommandTextToCommandMap.TryGetValue(cmdName, out command); if (null != command) { try { command.QueryStatus(cmdName, neededText, ref statusOption, ref commandText); } catch (Exception e) { var commandWindow = _application.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow).Object as CommandWindow; commandWindow.OutputString("QueryStatus on " + cmdName + " failed with exception: " + e.ToString()); } } }
/// <summary> /// 注册命令 /// </summary> /// <param name="cmdName">命令名,唯一,不能有空字符</param> /// <param name="buttonText">命令显示文字</param> /// <param name="toolTip">命令提示</param> /// <param name="useMsoButton">使用系统预定义图标</param> /// <param name="iconIndex">图标索引</param> /// <param name="position">添加命令位置</param> /// <param name="cmdStatus">按钮初始状态 </param> public EnvDTE.Command RegisterCommand(string cmdName, string buttonText, string toolTip, bool useMsoButton, int iconIndex, vsCommandStatus cmdStatus) { Commands2 commands = (Commands2)_dte.Commands; object[] contextGUIDS = new object[] { }; // Add command EnvDTE.Command command = commands.AddNamedCommand2(_addin, cmdName, buttonText, toolTip, useMsoButton, iconIndex, ref contextGUIDS, (int)cmdStatus, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton); if (command == null) { throw new ArgumentNullException(); } return(command); }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (commandName != "PaZu.Connect.PaZuShowHide") { return; } switch (neededText) { case vsCommandStatusTextWanted.vsCommandStatusTextWantedNone: if (jiraWindow != null) { // ReSharper disable BitwiseOperatorOnEnumWihtoutFlags status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; // ReSharper restore BitwiseOperatorOnEnumWihtoutFlags } else { status = vsCommandStatus.vsCommandStatusSupported; } break; } }
/// <summary> /// Queries the status. /// </summary> /// <param name="commandName">ProjectName of the command.</param> /// <param name="neededText">The needed text.</param> /// <param name="status">The status option.</param> /// <param name="commandText">The command text.</param> public void QueryStatus( string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { try { if (neededText != vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { return; } if (this.commandInfos.Any(vsCommandInfo => vsCommandInfo.Command.Name == commandName)) { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } catch (Exception exception) { TraceService.WriteError("CommandManager::QueryStatus exception=" + exception.Message); } }
public void QueryStatus( string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText ) { var action = FindAction(commandName); string text = action.ButtonText; if (action.CanExecute() && neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } string updatedText = action.ButtonText; if (text == updatedText) { return; } var attr = (MenuAttribute)action.GetType().GetCustomAttributes(typeof(MenuAttribute), false).FirstOrDefault(); if (attr != null) { string commandBarName = attr.CommandBar; var commandBar = ((CommandBars)Application.CommandBars)[commandBarName]; CommandBarControl control = commandBar.Controls[text]; if (control != null) { control.Caption = updatedText; } } }
protected override vsCommandStatus Status() { vsCommandStatus status = vsCommandStatus.vsCommandStatusNinched | vsCommandStatus.vsCommandStatusSupported; if (this.DTEInstance.SelectedProject != null) { ProjectPaths projectPaths = new ProjectPaths(this.DTEInstance.SelectedProject); string[] dllFiles = Directory.GetFiles(projectPaths.OutputPathDLL, "*.dll"); foreach (string dllPath in dllFiles) { if (dllPath.EndsWith("Microsoft.SharePoint.Search.dll", StringComparison.InvariantCultureIgnoreCase) || dllPath.EndsWith("Microsoft.Office.Server.Search.dll", StringComparison.InvariantCultureIgnoreCase)) { // Do not include Microsoft dlls continue; } status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; break; } } return(status); }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if(neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if(commandName == "SaveSomeFiles.Connect.SaveSomeFiles") { if (_applicationObject.Mode == vsIDEMode.vsIDEModeDebug) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported; } else { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } return; } } }
private Command _AddIndividualCommand(Commands2 cmds, vsCommandStatus statusValue, ICommand c) { object[] contextGUIDS = new object[] { }; vsCommandStyle style = vsCommandStyle.vsCommandStylePict; String buttonText = c.CommandText; String toolTip = c.CommandText; Command command = cmds.AddNamedCommand2(_addInInstance , c.CommandText , buttonText , toolTip , false , null , ref contextGUIDS , (int)statusValue , (int)style , vsCommandControlType.vsCommandControlTypeButton ); return command; }
public bool ComandState(vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { return false; }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if(neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if(commandName == "NewGuid.Connect.NewGuid") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported|vsCommandStatus.vsCommandStatusEnabled; return; } } }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { SwitchAddin.Instance.QueryStatus(commandName, neededText, ref status); }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if(neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if(commandName == "VS2010TestResultPublisher.Connect.VS2010TestResultPublisher") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported|vsCommandStatus.vsCommandStatusEnabled; return; } } }
public void QueryStatus(string CmdName, vsCommandStatusTextWanted NeededText, ref vsCommandStatus StatusOption, ref object CommandText) { if (CmdName == null) { throw new ArgumentNullException("CmdName"); } if (NeededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (this.availableRefactorOptions.ContainsKey(CmdName)) { this.availableRefactorOptions[CmdName].QueryStatus(CmdName, NeededText, ref StatusOption, ref CommandText, applicationObject); } } }
internal void HandleQueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus statusOption, ref object commandText) { if (QueryStatus != null) QueryStatus(commandName, neededText, ref statusOption, ref commandText); }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { status = vsCommandStatus.vsCommandStatusSupported; if (_applicationObject.ActiveDocument != null) { if (commandName == "Emmet4VsAddin.Connect.wrap_with_abbreviation") { TextSelection selection = _applicationObject.ActiveDocument.Selection as TextSelection; if (selection.Text != "") { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } else { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } } }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if(neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if(commandName == "DBMLUpdate.Connect.DBMLUpdate") { if(_applicationObject.Solution.IsOpen) { if(_applicationObject.ActiveDocument != null && _applicationObject.ActiveDocument.FullName.EndsWith(".dbml", StringComparison.InvariantCultureIgnoreCase)) status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; else status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported; } else status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported; return; } } }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (commandName.StartsWith(_addInInstance.ProgID + ".")) { status = (vsCommandStatus)(vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); } else { status = vsCommandStatus.vsCommandStatusUnsupported; } } }
public void QueryStatus(string CmdName, vsCommandStatusTextWanted NeededText, ref vsCommandStatus StatusOption, ref object CommandText) { try { Logger.LogMessage(CmdName); if (NeededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (CmdName == "UTG.Connect.TestAddIn") { StatusOption = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; return; } } #region Notes: //VS uses this to determine what our addin should do as environment changes..open new files, solutions, docs and so on... //Set when button must be available... //Check for our command being quired... //Make is available when the code window is showing certain files #endregion //This section requires refactoring if (NeededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if(CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.PROJECT_SOLUTION_COMMAND_NAME) { StatusOption = (vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); } else if (CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.CODEWINDOW_TOKEN_COMMAND_NAME) { if (_applicationObject != null && _applicationObject.ActiveWindow != null && _applicationObject.ActiveWindow.Document != null) { string currentFile = _applicationObject.ActiveWindow.Document.FullName.ToLower(); //Change this so that each supported language returns its extension so that we can add all extensions to a list where we simply would search if extension exists if (currentFile.EndsWith(".cs") || currentFile.EndsWith(".vb")) { TextSelection sel = (TextSelection)_applicationObject.ActiveDocument.Selection; //current scope FileCodeModel2 fcm = (FileCodeModel2)_applicationObject.ActiveDocument.ProjectItem.FileCodeModel; //Noticed that null happens on metadata files... if (fcm == null) { StatusOption = vsCommandStatus.vsCommandStatusSupported; return; } CodeElement ce = CodeExaminor.FindInnerMostCodeElement(fcm.CodeElements, sel.TopPoint); if (ce != null && !sel.Text.Equals(string.Empty) && IsSupported(ce)) StatusOption = (vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); else StatusOption = vsCommandStatus.vsCommandStatusSupported; } else { StatusOption = vsCommandStatus.vsCommandStatusSupported; } } } else if (CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.CODEWINDOW_TEST_METHOD_COMMAND_NAME) { if (_applicationObject != null && _applicationObject.ActiveWindow != null && _applicationObject.ActiveWindow.Document != null) { string currentFile = _applicationObject.ActiveWindow.Document.FullName.ToLower(); //Change this so that each supported language returns its extension so that we can add all extensions to a list where we simply would search if extension exists if (currentFile.EndsWith(".cs") || currentFile.EndsWith(".vb")) { TextSelection sel = (TextSelection)_applicationObject.ActiveDocument.Selection; //current scope FileCodeModel2 fcm = (FileCodeModel2)_applicationObject.ActiveDocument.ProjectItem.FileCodeModel; //Noticed that null happens on metadata files... if (fcm == null) { StatusOption = vsCommandStatus.vsCommandStatusSupported; return; } CodeElement ce = CodeExaminor.FindInnerMostCodeElement(fcm.CodeElements, sel.TopPoint); if (ce != null && !UTGManagerAndExaminor.ProjectExaminar.IsUnitTestProject(ce.ProjectItem.ContainingProject, this.testFramework.FrameworkTestAttributes)) { StatusOption = vsCommandStatus.vsCommandStatusSupported; return; } if (ce != null && !sel.Text.Equals(string.Empty) && ce is CodeFunction) StatusOption = (vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); else StatusOption = vsCommandStatus.vsCommandStatusSupported; } else { StatusOption = vsCommandStatus.vsCommandStatusSupported; } } } else if (CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.CODEWINDOW_TEST_CLASS_COMMAND_NAME || CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.CODEWINDOW_PARTCOVER_COMMAND_NAME) { if (_applicationObject != null && _applicationObject.ActiveWindow != null && _applicationObject.ActiveWindow.Document != null) { string currentFile = _applicationObject.ActiveWindow.Document.FullName.ToLower(); //Change this so that each supported language returns its extension so that we can add all extensions to a list where we simply would search if extension exists if (currentFile.EndsWith(".cs") || currentFile.EndsWith(".vb")) { TextSelection sel = (TextSelection)_applicationObject.ActiveDocument.Selection; //current scope FileCodeModel2 fcm = (FileCodeModel2)_applicationObject.ActiveDocument.ProjectItem.FileCodeModel; //Noticed that null happens on metadata files... if (fcm == null) { StatusOption = vsCommandStatus.vsCommandStatusSupported; return; } CodeElement ce = CodeExaminor.FindInnerMostCodeElement(fcm.CodeElements, sel.TopPoint); if (ce != null && !UTGManagerAndExaminor.ProjectExaminar.IsUnitTestProject(ce.ProjectItem.ContainingProject, this.testFramework.FrameworkTestAttributes)) { StatusOption = vsCommandStatus.vsCommandStatusSupported; return; } if (ce != null && !sel.Text.Equals(string.Empty) && ce is CodeClass) StatusOption = (vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); else StatusOption = vsCommandStatus.vsCommandStatusSupported; } else { StatusOption = vsCommandStatus.vsCommandStatusSupported; } } } else if (CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.CODEWINDOW_ATTACH_COMMAND_NAME) { if (_applicationObject != null && _applicationObject.ActiveWindow != null && _applicationObject.ActiveWindow.Document != null) { string currentFile = _applicationObject.ActiveWindow.Document.FullName.ToLower(); //Change this so that each supported language returns its extension so that we can add all extensions to a list where we simply would search if extension exists if (currentFile.EndsWith(".cs") || currentFile.EndsWith(".vb")) { //current scope FileCodeModel2 fcm = (FileCodeModel2)_applicationObject.ActiveDocument.ProjectItem.FileCodeModel; //Noticed that null happens on metadata files... if (fcm == null) { StatusOption = vsCommandStatus.vsCommandStatusSupported; return; } TextSelection sel = (TextSelection)_applicationObject.ActiveDocument.Selection; CodeElement ce = CodeExaminor.FindInnerMostCodeElement(fcm.CodeElements, sel.TopPoint); if (ce != null && !UTGManagerAndExaminor.ProjectExaminar.IsUnitTestProject(ce.ProjectItem.ContainingProject, this.testFramework.FrameworkTestAttributes)) { StatusOption = vsCommandStatus.vsCommandStatusSupported; return; } StatusOption = (vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); } else { StatusOption = vsCommandStatus.vsCommandStatusSupported; } } } else if (CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.CODEWINDOW_PROJECT_COMMAND_NAME) { if (_applicationObject != null && _applicationObject.ActiveWindow != null && _applicationObject.ActiveWindow.Document != null) { //Here we are doing this to try and disable this command if the file open is not a codefilemodel file //like metedata files... FileCodeModel2 fcm = (FileCodeModel2)_applicationObject.ActiveDocument.ProjectItem.FileCodeModel; if (fcm == null) { StatusOption = vsCommandStatus.vsCommandStatusSupported; return; } string currentFile = _applicationObject.ActiveWindow.Document.FullName.ToLower(); //Change this so that each supported language returns its extension so that we can add all extensions to a list where we simply would search if extension exists if (currentFile.EndsWith(".cs") || currentFile.EndsWith(".vb")) { StatusOption = (vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); } else { StatusOption = vsCommandStatus.vsCommandStatusSupported; } } } else if (CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.PROJECT_COMMAND_NAME || CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.PROJECT_PARTCOVER_COMMAND_NAME) { UIHierarchy hierarchy = _applicationObject.ToolWindows.SolutionExplorer; if (hierarchy != null && hierarchy.SelectedItems != null) { Object[] hierarchySelectedItems = (Object[])hierarchy.SelectedItems; foreach (UIHierarchyItem hirarchySelectedItem in hierarchySelectedItems) { if (hirarchySelectedItem.Object is Project) { if (CanRunUnitTestProjectCommand((Project)hirarchySelectedItem.Object)) { StatusOption = (vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); } else { StatusOption = vsCommandStatus.vsCommandStatusSupported; } } } } } else if (CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.PROJECT_COMMAND_ERROR_CLEAR_NAME) { UIHierarchy hierarchy = _applicationObject.ToolWindows.SolutionExplorer; if (hierarchy != null && hierarchy.SelectedItems != null) { Object[] hierarchySelectedItems = (Object[])hierarchy.SelectedItems; foreach (UIHierarchyItem hirarchySelectedItem in hierarchySelectedItems) { if (hirarchySelectedItem.Object is Project) { ErrorListProvider tvErrorListProvider = GetErrorListProvider(); if (tvErrorListProvider.Tasks.Count > 0) { StatusOption = (vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); } else { StatusOption = vsCommandStatus.vsCommandStatusSupported; } } } } } else if (CmdName == _addInInstance.ProgID + "." + UTGHelper.CommonStrings.PROJECT_SYNC_REF_COMMAND_NAME) { UIHierarchy hierarchy = _applicationObject.ToolWindows.SolutionExplorer; if (hierarchy != null && hierarchy.SelectedItems != null) { Object[] hierarchySelectedItems = (Object[])hierarchy.SelectedItems; foreach (UIHierarchyItem hirarchySelectedItem in hierarchySelectedItems) { if (hirarchySelectedItem.Object is Project) { if (IsProjectReferencesSynced()) { StatusOption = vsCommandStatus.vsCommandStatusSupported; } else { if (CanRunUnitTestProjectCommand((Project)hirarchySelectedItem.Object)) { StatusOption = (vsCommandStatus.vsCommandStatusEnabled | vsCommandStatus.vsCommandStatusSupported); } else { StatusOption = vsCommandStatus.vsCommandStatusSupported; } } } } } } } } catch (Exception ex) { Logger.LogException(ex); ErrorHandler.HandleException(ex); } }
public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (commandName == _addInInstance.ProgID + "." + COMMAND_NAME) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; return; } } }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param name='commandName'>The name of the command to determine state for.</param> /// <param name='neededText'>Text that is needed for the command.</param> /// <param name='status'>The state of the command in the user interface.</param> /// <param name='commandText'>Text requested by the neededText parameter.</param> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (commandName == COMMANDNAMESPACE + "." + POPUP_MENU_NAME_MINIFIER) { status = vsCommandStatus.vsCommandStatusInvisible; ProjectItem projectItem = this.App.SelectedItems.Item(1).ProjectItem; if (EngineManager.IsHandledWithoutHint(projectItem.FileName())) { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } else { string path = projectItem.FileName(); if (this.IsLessFile(path) || this.IsCoffeeScriptFile(path) || this.IsCssFile(path) || this.IsJsFile(path)) { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } } } if (commandName == COMMANDNAMESPACE + "." + POPUP_MENU_NAME_JSHINT) { status = vsCommandStatus.vsCommandStatusInvisible; ProjectItem projectItem = this.App.SelectedItems.Item(1).ProjectItem; string path = projectItem.FileName(); if (this.IsJsFile(path)) { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } if (commandName == COMMANDNAMESPACE + "." + POPUP_MENU_NAME_CSSLINT) { status = vsCommandStatus.vsCommandStatusInvisible; ProjectItem projectItem = this.App.SelectedItems.Item(1).ProjectItem; string path = projectItem.FileName(); if (this.IsCssFile(path)) { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } }
private void _default_querystatus_handler(vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; }
public void QueryStatus(string commandName, vsCommandStatusTextWanted NeededText, ref vsCommandStatus StatusOption, ref object CommandText) { var handler = GetHandler(commandName); if (handler != null) handler.QueryStatus(NeededText, ref StatusOption, ref CommandText); }
/// <summary>Implements the QueryStatus method of the IDTCommandTarget interface. This is called when the command's availability is updated</summary> /// <param term='commandName'>The name of the command to determine state for.</param> /// <param term='neededText'>Text that is needed for the command.</param> /// <param term='status'>The state of the command in the user interface.</param> /// <param term='commandText'>Text requested by the neededText parameter.</param> /// <seealso class='Exec' /> public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { if (commandName == "Mfconsulting.Vsprj2make.Connect.CreateMake") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } if (commandName == "Mfconsulting.Vsprj2make.Connect.GenMDFiles") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } if (commandName == "Mfconsulting.Vsprj2make.Connect.GenDistUnit") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } if (commandName == "Mfconsulting.Vsprj2make.Connect.PrjxToCsproj") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } if (commandName == "Mfconsulting.Vsprj2make.Connect.RunOnMono") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } if (commandName == "Mfconsulting.Vsprj2make.Connect.Options") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } if (commandName == "Mfconsulting.Vsprj2make.Connect.ExploreCurrSln") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } if (commandName == "Mfconsulting.Vsprj2make.Connect.ExploreCurrDoc") { status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } } }
public void QueryStatus(string commandName, vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref object commandText) { if (neededText == vsCommandStatusTextWanted.vsCommandStatusTextWantedNone) { switch (commandName.Replace(Command.COMMAND_PREFIX, "")) { case Command.MENU_BAR_EXPORT_COMMAND_NAME: if (_applicationObject.Solution.IsOpen && DependenciesAreLoaded()) status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; else status = vsCommandStatus.vsCommandStatusSupported; return; } } }