protected virtual void Dispose(bool disposing) { if (disposing) { _streamDeckPanel?.Dispose(); } }
protected override void Dispose(bool dispose) { if (dispose) { _cancellationTokenSource?.Dispose(); StackPanelButtonUI.Children.Clear(); EventHandlers.DetachStreamDeckListener(UCStreamDeckButtonAction); EventHandlers.DetachStreamDeckListener(UCStreamDeckButtonFace); EventHandlers.DetachStreamDeckListener(_uiButtonGrid); EventHandlers.DetachStreamDeckConfigListener(_uiButtonGrid); EventHandlers.DetachStreamDeckListener(this); _streamDeckPanel.Dispose(); } }
// Protected implementation of Dispose pattern. protected override void Dispose(bool disposing) { if (!_disposed) { if (disposing) { StackPanelButtonUI.Children.Clear(); SDEventHandler.DetachStreamDeckListener(UCStreamDeckButtonAction); SDEventHandler.DetachStreamDeckListener(UCStreamDeckButtonFace); SDEventHandler.DetachStreamDeckListener(_uiButtonGrid); SDEventHandler.DetachStreamDeckConfigListener(_uiButtonGrid); SDEventHandler.DetachStreamDeckListener(this); SDEventHandler.DetachActionTypeChangedListener(UCStreamDeckButtonFace); AppEventHandler.DetachGamingPanelListener(this); _streamDeckPanel.Dispose(); } _disposed = true; } // Call base class implementation. base.Dispose(disposing); }