Exemplo n.º 1
0
        private void AddButton(int index, StreamDeckButton button)
        {
            if (button.Action == StreamDeckButtonAction.Blank)
            {
                return;
            }

            bool notification = false;

            if (this._currentNotifications.Count > 0)
            {
                notification = this._currentNotifications.ContainsKey(button.Name.ToLower());
            }
            this._streamDeck.SetKeyBitmap(index, this.CreateBitmap(button.IconPath, button.NotificationIconPath, notification));
        }
Exemplo n.º 2
0
        private void ButtonClicked(object sender, OpenMacroBoard.SDK.KeyEventArgs e)
        {
            if (e.IsDown)
            {
                return;
            }
            if (this._currentButtons.Length < e.Key)
            {
                return;
            }

            // there is some action, so stop the timer
            this.StopBackTimer();

            if (this._buttonClickSound != null)
            {
                this._buttonClickSound.controls.currentPosition = 0;
                this._buttonClickSound.controls.play();
            }

            StreamDeckButton button = null;

            button = this._currentButtons[e.Key];

            // on button click I want to remove the notification
            if (this._currentNotifications.ContainsKey(button.Name.ToLower()))
            {
                // clean up the notifications
                Notifications notification = new Notifications();
                notification.ClearNotifications(this._currentNotifications[button.Name.ToLower()]);

                // remove it from our notification list so we don't recount it.
                this._currentNotifications.Remove(button.Name.ToLower());

                // redraw the button, hopefully without the notification
                this.AddButton(e.Key, button);
            }

            // button actions! Let's do some cool things
            switch (button.Action)
            {
            case StreamDeckButtonAction.OpenProgram:
                this.OpenTarget(button.Target);
                break;

            case StreamDeckButtonAction.KeyPress:
                this.PressKeys(button.KeyPresses);
                break;

            case StreamDeckButtonAction.Folder:
                this.OpenFolder(e.Key);
                break;

            case StreamDeckButtonAction.BackButton:
                this.BackFolder();
                break;

            case StreamDeckButtonAction.ClearNotifications:
                this.ClearNotifications();
                break;
            }

            // I want a timer to reset after a button has been clicked.
            if (this._currentLevel > 0)
            {
                this.StartBackTimer();
            }
        }