/// <summary> /// Release unmanaged and optionally managed resources. /// </summary> /// <param name="disposing">Called from Dispose method.</param> protected override void Dispose(bool disposing) { if (ButtonSpecManager != null) { ButtonSpecManager.Destruct(); ButtonSpecManager = null; } // Must call base class to finish disposing base.Dispose(disposing); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { // Remove any showing tooltip OnCancelToolTip(this, EventArgs.Empty); // Unhook from the parent control _ribbon.ParentChanged += OnRibbonParentChanged; // Unhook from watching any top level window if (_formContainer != null) { _formContainer.Deactivate -= OnRibbonFormDeactivate; _formContainer.Activated -= OnRibbonFormActivated; _formContainer.SizeChanged -= OnRibbonFormSizeChanged; _formContainer.MdiChildActivate -= OnRibbonMdiChildActivate; _formContainer = null; } // Unhook from watching any mdi child window if (_activeMdiChild != null) { _activeMdiChild.SizeChanged -= OnRibbonMdiChildSizeChanged; _activeMdiChild = null; } // Destruct the button manager resources if (ButtonSpecManager != null) { ButtonSpecManager.Destruct(); ButtonSpecManager = null; } } base.Dispose(disposing); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { if (_mementos != null) { // Dispose of all the mementos in the array foreach (IDisposable memento in _mementos) { memento?.Dispose(); } _mementos = null; } if (ButtonSpecManager != null) { ButtonSpecManager.Destruct(); ButtonSpecManager = null; } } base.Dispose(disposing); }