public StreamDeck(StreamDeckButton[] buttons) { if (Constants.ENABLE_BUTTON_CLICK) { this._buttonClickSound = new WMPLib.WindowsMediaPlayer(); this._buttonClickSound.URL = @"Assets\Sounds\button-click.mp3"; this._buttonClickSound.controls.stop(); } // only activate the timer if it's greater than zero if (Constants.BACK_TO_MAIN_TIMER_IN_SECONDS > 0) { this._backToMain = new System.Timers.Timer(); this._backToMain.Interval = (int)TimeSpan.FromSeconds(Constants.BACK_TO_MAIN_TIMER_IN_SECONDS).TotalMilliseconds; this._backToMain.Enabled = true; this._backToMain.Elapsed += new System.Timers.ElapsedEventHandler(BackToMain); } this._streamDeck = StreamDeckSharp.StreamDeck.OpenDevice(); this._streamDeckButtons = buttons; this._streamDeck.KeyStateChanged += this.ButtonClicked; this.DrawButtons(); }
public void Dispose() { this._streamDeck.Dispose(); this._streamDeck = null; }