/// <summary> /// Dispose the current instance /// </summary> /// <param name="fromIDisposableDispose">dispose was called from IDisposable.Dispose</param> protected override void Dispose(bool fromIDisposableDispose) { if (fromIDisposableDispose) { _button.ExplicitDisposing -= OnButtonDisposing; _button.Dispose(); _dockableForm.GotFocus -= OnFormGotFocus; _dockableForm = null; } }
public void TabButtonConstructor() { tlog.Debug(tag, $"TabButtonConstructor START"); TabButtonStyle style = new TabButtonStyle() { BackgroundColor = Color.Cyan, }; var testingTarget = new TabButton(style); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <TabButton>(testingTarget, "Should return TabButton instance."); testingTarget.Dispose(); tlog.Debug(tag, $"TabButtonConstructor END (OK)"); }
/// <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; TabButton button = GetButton(form); button.Dispose(); EventHandler <FormEventArgs> handler = FormClosed; if (handler != null) { FormEventArgs args = new FormEventArgs(form, id); handler(this, args); } }