protected override void Dispose(bool disposing) { if (disposing && RibbonDesigner.Current == null) { foreach (RibbonItem item in _items) { item.Dispose(); } _dropDownButton.Dispose(); _sensor.Dispose(); } 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 && RibbonDesigner.Current == null) { try { foreach (RibbonItem item in _items) { item.Dispose(); } } catch (InvalidOperationException) { if (!IsOpenInVisualStudioDesigner()) { throw; } } _dropDownButton.Dispose(); _sensor.Dispose(); } base.Dispose(disposing); }