コード例 #1
0
        private void ParseVLC_Message(String message)
        {
            if (message.Length > 19 & message.Substring(0, 13) == "status change")
            {
                // handle status change message
                String inner_message = message.Substring(17);
                inner_message = inner_message.Substring(0, inner_message.IndexOf(" )"));
                String[] state = inner_message.Split(":".ToCharArray(), 2);
                state[1] = state[1].Trim();
                switch (state[0])
                {
                case "play state":
                    if (state[1] == "3")
                    {
                        LogMessage("Playing", null);
                        PlayerState = VLC_State.Playing;
                        ShowHubToast("Playback started", ResourceToBytes(new Uri("/UniteVideoPlugin;component/disc.png", System.UriKind.Relative)), 1);
                        FireIsHubBackgroundTransparent(true);
                        FireUIUpdated();
                        HubText = "";
                        FireHubTextUpdated();
                    }
                    break;

                case "stop state":
                    if (state[1] == "0")
                    {
                        LogMessage("Stopped", null);
                        PlayerState = VLC_State.Stopped;
                        //ShowHubToast("Playback stopped", ResourceToBytes(new Uri("/UniteVideoPlugin;component/disc.png", System.UriKind.Relative)), 1);
                        HubText = "";
                        FireHubTextUpdated();
                        FireIsHubBackgroundTransparent(false);
                        FireUIUpdated();
                    }
                    break;

                case "pause state":
                    if (state[1] == "3")
                    {
                        LogMessage("Paused", null);
                        PlayerState = VLC_State.Paused;
                        ShowHubToast("Playback paused", ResourceToBytes(new Uri("/UniteVideoPlugin;component/disc.png", System.UriKind.Relative)), 1);
                        FireUIUpdated();
                    }
                    break;

                default:
                    break;
                }
            }
        }
コード例 #2
0
        private void ParseVLC_Message(String message)
        {
            if (message.Length > 19 & message.Substring(0, 13) == "status change")
            {
                // handle status change message
                String inner_message = message.Substring(17);
                inner_message = inner_message.Substring(0, inner_message.IndexOf(" )"));
                String[] state = inner_message.Split(":".ToCharArray(), 2);
                state[1] = state[1].Trim();
                switch (state[0])
                {
                case "play state":
                    if (state[1] == "3")
                    {
                        LogMessage("Playing", null);
                        PlayerState = VLC_State.Playing;
                    }
                    break;

                case "stop state":
                    if (state[1] == "0")
                    {
                        LogMessage("Stopped", null);
                        PlayerState = VLC_State.Stopped;
                    }
                    break;

                case "pause state":
                    if (state[1] == "3")
                    {
                        LogMessage("Paused", null);
                        PlayerState = VLC_State.Paused;
                    }
                    break;

                default:
                    LogMessage(state[0], null);
                    LogMessage(state[1], null);
                    break;
                }
            }
        }