QueryStatus not firing



Hi all.

I'm hoping someone can help me with this Add-in programming issue.
I'm having a problem with in that QueryStatus does not seem to fire
until Exec has run at least once.

I have a command in the item and code window context menu that is
supposed to show up only for certain file types (for now.. ones with
'DAL_' in the filename.) What happens is that the command shows up
for every thing, that is it does not hide as it is supposed top. When
the command is run once, however, and Exec runs, then it behaves
correctly and the command in the context menu only shows up for the
correct files.

When I set a breakpoint in the first line of code inside QueryStatus,
I see that for some reason it simply is not firing until I select the
command from the context menu and then from that point on QueryStatus
fires.

I don't think the code is helpful in the problem, since the problem I
think is that QueryStatus doesn't fire until Exec fires at least
once.. but here is some of the relevant code just in case..

public void QueryStatus(string commandName,
vsCommandStatusTextWanted neededText, ref vsCommandStatus status, ref
object commandText)
{
if (commandName ==
"MyAddin1.Connect.SolnExplContextMenuCS")
{
if
(_applicationObject.ActiveDocument.Name.IndexOf("DAL_") == -1)
status = (vsCommandStatus)
(vsCommandStatus.vsCommandStatusInvisible |
vsCommandStatus.vsCommandStatusUnsupported);
else
status =
(vsCommandStatus)vsCommandStatus.vsCommandStatusSupported |
vsCommandStatus.vsCommandStatusEnabled;
}
}


public void Exec(string commandName, vsCommandExecOption
executeOption, ref object varIn, ref object varOut, ref bool handled)
{
handled = false;
if(executeOption ==
vsCommandExecOption.vsCommandExecOptionDoDefault)
{
handled = true;
if (commandName ==
"MyAddin1.Connect.SolnExplContextMenuCS")
RegenerateSingleFile();
}

}


Thanks in advance!

Jeff

.



Relevant Pages

  • Re: How Necessary is an Agent?
    ... writing or to writing in general. ... She threw it on the fire, and, even ... Duinn I command The Morrigan. ... woman's voice, but deep and guttural. ...
    (rec.arts.sf.composition)
  • Re: Need help updating access db
    ... use parameters instead...this is a big potential risk ... will ever fire... ... command, added to fire the insert command and deleted to fire the delete ... > Sub Page_Load ...
    (microsoft.public.dotnet.general)
  • Re: Question rephrazed - is there a to dynamically alter a Forms Post?
    ... A Command Button will always post back when you click it. ... fire on the server depends on what you clicked and how your event delegates ... >Sorry for the confusion, I'm learning the intracacies of .NET as I go. ... >fire a single event handler and differentiate based on the Command ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Addin for Server Explorer
    ... The QueryStatus should be called. ... an add-in. ... Productivity add-ins for Visual Studio ... // Create a Command with name SolnExplContextMenuCS ...
    (microsoft.public.vsnet.ide)
  • Re: call a proc from c
    ... is it possible to launch a tcl procedure (fire) containing tk command from c. ...
    (comp.lang.tcl)