Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Reference to event handlers for VsUIHierarchyWindowCmdIds.UIHWCMDID_DoubleClick does not work

$
0
0
I have written the following code in my VS2008 addin

public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
   _applicationObject = (DTE2)application;
   _addInInstance = (AddIn)addInInst;
   ServiceProvider sp = new ServiceProvider((IOleServiceProvider)_applicationObject);

   DTE dte = sp.GetService(typeof(DTE)) as DTE;
   private CommandEvents commandEvents

   if (dte != null) {
      commandEvents = dte.Events.get_CommandEvents(typeof(Microsoft.VisualStudio.VSConstants.VsUIHierarchyWindowCmdIds).GUID, 
                                           (int)Microsoft.VisualStudio.VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_DoubleClick) as CommandEvents;
      
      commandEvents.BeforeExecute += new _dispCommandEvents_BeforeExecuteEventHandler(OnBeforeExecute);
   } 
}

The code executes fine without any problem, but when I double click on an item in VS Solution explorer, the execution control does not come to my OnBeforeExecute method.

I tried this same code for commands like Open (Microsoft.VisualStudio.VSConstants.VSStd97CmdID.Open) and it works fine. Can you please let me know what is wrong?

Regards
ShahinBasheer


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>