QueryStatus not firing
- From: jeff.ranney@xxxxxxxxx
- Date: Fri, 06 Jul 2007 02:04:02 -0700
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
.
- Prev by Date: RE: devenv.exe and others causing stop error (BSOD) 0x50 (Visual Studi
- Next by Date: Properties doesnt show for webforms in "Source view", VS2005 with SP1. Any ideas?
- Previous by thread: RE: devenv.exe and others causing stop error (BSOD) 0x50 (Visual Studi
- Next by thread: Properties doesnt show for webforms in "Source view", VS2005 with SP1. Any ideas?
- Index(es):
Relevant Pages
|