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(); } }
private void Dispose(bool disposing) { ReleaseUnmanagedResources(); if (disposing) { StreamDeckButton.DisposeAll(); _streamDeckBoard.KeyStateChanged -= StreamDeckKeyListener; _streamDeckBoard?.Dispose(); StreamDeckPanels.Remove(this); EventHandlers.DetachStreamDeckListener(this); EventHandlers.DetachStreamDeckConfigListener(this); Closed = true; } }