我使用“Visual Studio 插件”向导创建了一个新的插件项目,现在,我正在尝试添加一些事件处理程序:
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
_applicationObject.Events.BuildEvents.OnBuildBegin += BuildEvents_OnBuildBegin;
_applicationObject.Events.BuildEvents.OnBuildDone += BuildEvents_OnBuildDone;
_applicationObject.Events.SelectionEvents.OnChange += SelectionEvents_OnChange;
_applicationObject.Events.DocumentEvents.DocumentOpened += DocumentEvents_DocumentOpened;
_applicationObject.Events.DocumentEvents.DocumentSaved += DocumentEvents_DocumentSaved;
}
但无论我做什么,我的处理程序都不会被执行!
我瞎了吗?我是否必须做任何其他事情来注册这些处理程序,或者为什么它不起作用?