/// <summary> /// 释放当前实例 /// </summary> protected override void Dispose(bool fromIDisposableDispose) { if (fromIDisposableDispose) { _button.ExplicitDisposing -= OnButtonDisposing; _button.Dispose(); _dockableForm.GotFocus -= OnFormGotFocus; _dockableForm = null; } }
/// <summary> /// Occurs when the page is closed /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event argument</param> private void OnPageClosed(object sender, FormClosedEventArgs e) { DockableFormInfo info = GetPageInfo((Form)sender); Guid id = info.Id; Form form = info.DockableForm; UnitButton button = GetButton(form); button.Dispose(); EventHandler <FormEventArgs> handler = FormClosed; if (handler != null) { FormEventArgs args = new FormEventArgs(form, id); handler(this, args); } }