private void OnMessageReceived(object?sender, string json)
        {
            StreamDeckEvent?streamDeckEvent = StreamDeckEvent.FromJson(json);

            if (streamDeckEvent == null)
            {
                return;
            }

            switch (streamDeckEvent.Event)
            {
            case EventType.KeyDown:
            case EventType.KeyUp:
            case EventType.WillAppear:
            case EventType.WillDisappear:
            case EventType.TitleParametersDidChange:
            case EventType.DidReceiveSettings:
            case EventType.PropertyInspectorDidAppear:
            case EventType.PropertyInspectorDidDisappear:
                ActionEventReceived?.Invoke(this, (StreamDeckActionEvent)streamDeckEvent);
                break;

            case EventType.DeviceDidConnect:
            case EventType.DeviceDidDisconnect:
            case EventType.ApplicationDidLaunch:
            case EventType.ApplicationDidTerminate:
            case EventType.SendToPlugin:
            case EventType.DidReceiveGlobalSettings:
            case EventType.SystemDidWakeUp:
                PluginEventReceived?.Invoke(this, (StreamDeckPluginEvent)streamDeckEvent);
                break;
            }
        }
Beispiel #2
0
 internal void SendEvent(object o, PluginEventArgs e)
 {
     PluginEventReceived?.Invoke(o, e);
 }