Example #1
0
        internal void OscMessage(string[] address, List <object> arguments)
        {
            if (address.Length >= 3 && arguments.Count == 1)
            {
                switch (address[2])
                {
                case "tc":
                    Tc?.Invoke(this, new TcEventArgs(arguments[0].ToString()));
                    break;

                case "control":
                    DeckControl control;
                    if (Enum.TryParse(arguments[0].ToString(), out control))
                    {
                        DeckControl?.Invoke(this, new DeckControlEventArgs(control));
                    }
                    break;

                case "state":
                    DeckState state;
                    if (Enum.TryParse(arguments[0].ToString(), out state))
                    {
                        DeckState?.Invoke(this, new DeckStateEventArgs(state));
                    }
                    break;

                case "connected":
                    bool isConnected;
                    if (bool.TryParse(arguments[0].ToString(), out isConnected))
                    {
                        IsConnected = isConnected;
                    }
                    break;

                case "frames_left":
                    if (arguments[0] is long)
                    {
                        FramesLeft?.Invoke(this, new FramesLeftEventArgs((long)arguments[0]));
                    }
                    break;

                default:
                    Debug.WriteLine($"Unrecognized message: {string.Join("/", address)}:{string.Join(",", arguments)}");
                    break;
                }
            }
        }