110,534
社区成员
发帖
与我相关
我的任务
分享
public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
{
handled = false;
if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
{
if (commandName == "MyAddin1.Connect.MyAddin1")
{
handled = true;
object obj = null;
Windows2 windows2 = _applicationObject.Windows as Windows2;
string assemblyPath = @"C:\Users\****\Desktop\MyAddin1\MyAddin1\bin\Debug\WindowsFormsControlLibrary1.dll";
obj = null;
Window window = windows2.CreateToolWindow2(_addInInstance, assemblyPath, "WindowsFormsControlLibrary1.UserControl1", "test", "{7EC14943-8160-4be9-9103-67D9B381AFD4}", ref obj);
EnvDTE80.Events2 events = (EnvDTE80.Events2)_applicationObject.Events;
WindowVisibilityEvents winEvents = events.get_WindowVisibilityEvents(window);
winEvents.WindowHiding += new _dispWindowVisibilityEvents_WindowHidingEventHandler(winEvents_WindowHiding);
window.IsFloating = false;
window.Linkable = false;
window.Visible = true;
return;
}
}
}
void winEvents_WindowHiding(Window Window)
{
if (!Window.Visible)
return;
System.Windows.Forms.MessageBox.Show(Window.Caption + " is closing");
}