Jetski5822
Programmer
Hey all okay heres the problem, i right click in the code window and get the context menu up with 2 of my added function. Now im trying to refresh there status's and it does not appear to be doing it. Im refreshing them based on rules defined in my clsStatus Class.
Hope you guys can help Code below;
Thanks
Nick
p.s. the one im trying to refresh is
within the public void QueryStatus
Hope you guys can help Code below;
Thanks
Nick

p.s. the one im trying to refresh is
Code:
if(commandName == "WigglesPlugin.Connect.BenchmarkLN")
{
status = StatusLN.DetermineStatus(status);
}
within the public void QueryStatus
Code:
public void QueryStatus(string commandName, EnvDTE.vsCommandStatusTextWanted neededText, ref EnvDTE.vsCommandStatus status, ref object commandText)
{
if(neededText == EnvDTE.vsCommandStatusTextWanted.vsCommandStatusTextWantedNone)
{
if(commandName == "WigglesPlugin.Connect.WigglesPlugin")
{
status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported/vsCommandStatus.vsCommandStatusEnabled;
}
if(commandName == "WigglesPlugin.Connect.BenchmarkFN")
{
status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported/vsCommandStatus.vsCommandStatusEnabled;
}
if(commandName == "WigglesPlugin.Connect.BenchmarkLN")
{
status = StatusLN.DetermineStatus(status);
}
}
}
Code:
using System;
using EnvDTE;
namespace WigglesPlugin
{
/// <summary>
/// Summary description for clsStatus.
/// </summary>
public class clsStatus
{
EnvDTE.DTE DTE;
public clsStatus()
{
DTE = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.7.1"); // Get an instance of the currently running Visual Studio .NET IDE.
}
public EnvDTE.vsCommandStatus DetermineStatus(EnvDTE.vsCommandStatus status)
{
TextSelection objSel = (TextSelection) DTE.ActiveDocument.Selection;
//status = vsCommandStatus.vsCommandStatusLatched;
objSel.SelectLine();
string strLineProfiling = objSel.Text.ToString();
objSel.Cancel();
if (strLineProfiling.IndexOf("{") > 0 // strLineProfiling.IndexOf("}") > 0)
{
status = (vsCommandStatus)vsCommandStatus.vsCommandStatusLatched;
}
else if ((strLineProfiling.IndexOf("{")) <= 0 // (strLineProfiling.IndexOf("}")) <= 0)
{
status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported/vsCommandStatus.vsCommandStatusEnabled;
}
return status;
}
}
}