Esempio n. 1
0
        public override async void KeyPressed(KeyPayload payload)
        {
            Logger.Instance.LogMessage(TracingLevel.INFO, "Key Pressed");

            try
            {
                if (TeamSpeak3Telnet.TS3_CLIENT == null || !TeamSpeak3Telnet.TS3_CLIENT.IsConnected)
                {
                    TeamSpeak3Telnet.SetupTelnetClient(_settings.ApiKey);
                    if (TeamSpeak3Telnet.TS3_CLIENT == null)
                    {
                        return;
                    }
                }

                if (payload.IsInMultiAction)
                {
                    await ToggleMicMuteLocally((int)payload.UserDesiredState);
                }
                else
                {
                    await ToggleMicMuteLocally(payload.State == 1? 0 : 1);
                }
            }
            catch (Exception)
            {
                TeamSpeak3Telnet.TS3_CLIENT?.Dispose();
                TeamSpeak3Telnet.TS3_CLIENT = null;
                await SetInputStatusStateLocally();
            }
        }
        // Button released
        private async void Connection_OnKeyUp(object sender, StreamDeckEventReceivedEventArgs <KeyUpEvent> e)
        {
            await instancesLock.WaitAsync();

            try
            {
                if (instances.ContainsKey(e.Event.Context))
                {
                    KeyPayload payload = new KeyPayload(GenerateKeyCoordinates(e.Event.Payload.Coordinates),
                                                        e.Event.Payload.Settings, e.Event.Payload.State, e.Event.Payload.UserDesiredState, e.Event.Payload.IsInMultiAction);
                    instances[e.Event.Context].KeyReleased(payload);
                }
            }
            finally
            {
                instancesLock.Release();
            }
        }
Esempio n. 3
0
        // Button pressed
        private async void Connection_OnKeyDown(object sender, StreamDeckEventReceivedEventArgs <KeyDownEvent> e)
        {
            await instancesLock.WaitAsync();

            try
            {
#if DEBUG
                Logger.Instance.LogMessage(TracingLevel.DEBUG, $"Plugin Keydown: Context: {e.Event.Context} Action: {e.Event.Action} Payload: {e.Event.Payload?.ToStringEx()}");
#endif

                if (instances.ContainsKey(e.Event.Context))
                {
                    KeyPayload payload = new KeyPayload(GenerateKeyCoordinates(e.Event.Payload.Coordinates),
                                                        e.Event.Payload.Settings, e.Event.Payload.State, e.Event.Payload.UserDesiredState, e.Event.Payload.IsInMultiAction);
                    instances[e.Event.Context].KeyPressed(payload);
                }
            }
            finally
            {
                instancesLock.Release();
            }
        }
        public override async void KeyPressed(KeyPayload payload)
        {
            Logger.Instance.LogMessage(TracingLevel.INFO, "Key Pressed");

            try
            {
                if (TeamSpeak3Telnet.TS3_CLIENT == null || !TeamSpeak3Telnet.TS3_CLIENT.IsConnected)
                {
                    TeamSpeak3Telnet.SetupTelnetClient(_settings.ApiKey);
                    if (TeamSpeak3Telnet.TS3_CLIENT == null)
                    {
                        return;
                    }
                }

                ChannelSwitch();
            }
            catch (Exception)
            {
                TeamSpeak3Telnet.TS3_CLIENT?.Dispose();
                TeamSpeak3Telnet.TS3_CLIENT = null;
            }
        }
 public override void KeyReleased(KeyPayload payload)
 {
 }
Esempio n. 6
0
 /// <summary>
 /// Called when a Stream Deck key is released
 /// </summary>
 public abstract void KeyReleased(KeyPayload payload);
Esempio n. 7
0
 /// <summary>
 /// Called when a Stream Deck key is pressed
 /// </summary>
 public abstract void KeyPressed(KeyPayload payload);