Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing querystatus (addin)

Status
Not open for further replies.

Jetski5822

Programmer
Joined
Jan 24, 2005
Messages
10
Location
GB
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

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;
		}
	}
}
 
okay, It would appear that now it just doesnt refresh properly, it doesnt move down 4 lines , it jsut doesnt refresh properly, hope some one can help me!!!

Thansk Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top