_dispSolutionEvents_BeforeClosingEventHandler 委派
這個應用程式開發介面支援 .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");
}
}