private void Connection_OnSendToPlugin(object sender, streamdeck_client_csharp.StreamDeckEventReceivedEventArgs <streamdeck_client_csharp.Events.SendToPluginEvent> e)
 {
     if (e.Event.Context == ContextId)
     {
         OnSendToPlugin?.Invoke(this, new SDEventReceivedEventArgs <SendToPlugin>(new SendToPlugin(e.Event.Action, e.Event.Context, e.Event.Payload)));
     }
 }
 private void Connection_OnPropertyInspectorDidAppear(object sender, streamdeck_client_csharp.StreamDeckEventReceivedEventArgs <streamdeck_client_csharp.Events.PropertyInspectorDidAppearEvent> e)
 {
     if (e.Event.Context == ContextId)
     {
         OnPropertyInspectorDidAppear?.Invoke(this, new SDEventReceivedEventArgs <PropertyInspectorDidAppear>(new PropertyInspectorDidAppear(e.Event.Action, e.Event.Context, e.Event.Device)));
     }
 }
Beispiel #3
0
        // Used to register and revoke token
        private async void StreamDeckConnection_OnSendToPlugin(object sender, streamdeck_client_csharp.StreamDeckEventReceivedEventArgs <streamdeck_client_csharp.Events.SendToPluginEvent> e)
        {
            var payload = e.Event.Payload;

            if (Connection.ContextId != e.Event.Context)
            {
                return;
            }

            if (payload["property_inspector"] != null)
            {
                switch (payload["property_inspector"].ToString().ToLower())
                {
                case "updateapproval":
                    string approvalCode = (string)payload["approvalCode"];
                    Logger.Instance.LogMessage(TracingLevel.INFO, $"Requesting approval with code: {approvalCode}");
                    TwitchTokenManager.Instance.SetToken(new TwitchToken()
                    {
                        Token = approvalCode, TokenLastRefresh = DateTime.Now
                    });
                    Logger.Instance.LogMessage(TracingLevel.INFO, $"RefreshToken completed. Token Exists: {TwitchTokenManager.Instance.TokenExists}");
                    break;

                case "resetplugin":
                    Logger.Instance.LogMessage(TracingLevel.WARN, $"ResetPlugin called. Tokens are cleared");
                    TwitchTokenManager.Instance.RevokeToken();
                    await SaveSettings();

                    break;
                }
            }
        }
 private void Connection_OnTitleParametersDidChange(object sender, streamdeck_client_csharp.StreamDeckEventReceivedEventArgs <streamdeck_client_csharp.Events.TitleParametersDidChangeEvent> e)
 {
     if (e.Event.Context == ContextId)
     {
         var payload    = e.Event.Payload;
         var newPayload = new TitleParametersPayload(payload.Settings, payload.Coordinates.ToKeyCoordinates(), payload.State, payload.Title, payload.TitleParameters.ToSDTitleParameters());
         OnTitleParametersDidChange?.Invoke(this, new SDEventReceivedEventArgs <TitleParametersDidChange>(new TitleParametersDidChange(e.Event.Action, e.Event.Context, e.Event.Device, newPayload)));
     }
 }
Beispiel #5
0
        private async void StreamDeckConnection_OnSendToPlugin(object sender, streamdeck_client_csharp.StreamDeckEventReceivedEventArgs <streamdeck_client_csharp.Events.SendToPluginEvent> e)
        {
            var payload = e.Event.Payload;

            if (Connection.ContextId != e.Event.Context)
            {
                return;
            }

            if (payload["property_inspector"] != null)
            {
                switch (payload["property_inspector"].ToString().ToLower())
                {
                case "getwindowdetails":
                    await FetchWindowLocation();

                    break;
                }
            }
        }
 private void Connection_OnApplicationDidLaunch(object sender, streamdeck_client_csharp.StreamDeckEventReceivedEventArgs <streamdeck_client_csharp.Events.ApplicationDidLaunchEvent> e)
 {
     OnApplicationDidLaunch?.Invoke(this, new SDEventReceivedEventArgs <ApplicationDidLaunch>(new ApplicationDidLaunch(new Payloads.ApplicationPayload(e.Event.Payload.Application))));
 }
 private void Connection_OnDeviceDidDisconnect(object sender, streamdeck_client_csharp.StreamDeckEventReceivedEventArgs <streamdeck_client_csharp.Events.DeviceDidDisconnectEvent> e)
 {
     OnDeviceDidDisconnect?.Invoke(this, new SDEventReceivedEventArgs <DeviceDidDisconnect>(new DeviceDidDisconnect(e.Event.Device)));
 }
 private void StreamDeckConnection_OnPropertyInspectorDidAppear(object sender, streamdeck_client_csharp.StreamDeckEventReceivedEventArgs <streamdeck_client_csharp.Events.PropertyInspectorDidAppearEvent> e)
 {
     settings.Devices = GHubReader.Instance.GetAllDevices();
     SaveSettings();
 }