_dispSolutionEvents_BeforeClosingEventHandler 委托
此 API 支持 .NET Framework 基础结构,不适合在代码中直接使用。
处理在解决方案关闭之前激发的事件。
命名空间: EnvDTE
程序集: EnvDTE(在 EnvDTE.dll 中)
语法
声明
<ComVisibleAttribute(False)> _
Public Delegate Sub _dispSolutionEvents_BeforeClosingEventHandler
[ComVisibleAttribute(false)]
public delegate void _dispSolutionEvents_BeforeClosingEventHandler()
[ComVisibleAttribute(false)]
public delegate void _dispSolutionEvents_BeforeClosingEventHandler()
[<ComVisibleAttribute(false)>]
type _dispSolutionEvents_BeforeClosingEventHandler =
delegate of unit -> unit
JScript 不支持委托。
备注
SolutionEvents 对象可能超出范围,进行垃圾回收后关闭解决方案。若要保留对此对象的引用,请在您实现解决方案事件处理程序的类中声明私有变量。
示例
public class Connect : IDTExtensibility2
{
private SolutionEvents _solnEvents;
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
_solnEvents = _applicationObject.Events.SolutionEvents;
_solutionBeforeClosingEventHandler = new _dispSolutionEvents_BeforeClosingEventHandler(this.SolutionBeforeClosing);
_solnEvents.BeforeClosing += _solutionBeforeClosingEventHandler;
}
private _dispSolutionEvents_BeforeClosingEventHandler _solutionBeforeClosingEventHandler
private void SolutionBeforeClosing()
{
System.Windows.Forms.MessageBox.Show("SolutionBeforeClosing");
}
}