Ejemplo n.º 1
0
 private void OnNowPlayingChanged(Win32EventArgs args)
 {
     Log("OnCurrentPlaybackChanged");
     addNowPlaying();
 }
Ejemplo n.º 2
0
        private void OnWMReceived(Win32EventArgs args)
        {
            var w32Data = new Incoming(args);

            NewLogMessage(String.Format(
                "### {0} => {1}", w32Data.ReceivedCommand, w32Data.Payload
            ));

            switch (w32Data.ReceivedCommand) {
                case ApiCmd.Received.CONNECT:
                    int to = Convert.ToInt32(w32Data.Payload);
                    HWndTo = new IntPtr(to);
                    IsConnected = to > 0;
                    ConnectedToHost(null);
                    break;
                case ApiCmd.Received.STATE:
                    switch ((ApiCmd.LoadState) Convert.ToInt32(w32Data.Payload)) {
                        case ApiCmd.LoadState.MLS_CLOSED:
                            break;
                        case ApiCmd.LoadState.MLS_CLOSING:
                            break;
                        case ApiCmd.LoadState.MLS_LOADED:
                            break;
                        case ApiCmd.LoadState.MLS_LOADING:
                            break;
                    }
                    break;
                case ApiCmd.Received.PLAYMODE:
                    switch ((ApiCmd.PlayState) Convert.ToInt32(w32Data.Payload)) {
                        case ApiCmd.PlayState.PS_PLAY:
                            Playing(args);
                            if (!timer.Enabled) timer.Start();
                            break;
                        case ApiCmd.PlayState.PS_PAUSE:
                            Pausing(args);
                            if(timer.Enabled) timer.Stop();
                            break;
                        case ApiCmd.PlayState.PS_STOP:
                            Stopping(args);
                            if (timer.Enabled) timer.Stop();
                            break;
                        case ApiCmd.PlayState.PS_UNUSED:
                            break;
                    }
                    break;
                case ApiCmd.Received.NOWPLAYING:
                    NowPlaying = new PlayInfo();

                    string[] info = w32Data.Payload.Split('|');
                    if (!String.IsNullOrEmpty(info[0]))
                        NowPlaying.Title = info[0];
                    if (!String.IsNullOrEmpty(info[1]))
                        NowPlaying.Author = info[1];
                    if (!String.IsNullOrEmpty(info[2]))
                        NowPlaying.Description = info[2];
                    if (!String.IsNullOrEmpty(info[3]))
                        NowPlaying.Path = info[3];
                    if (!String.IsNullOrEmpty(info[4]))
                        NowPlaying.Duration = info[4];

                    ChangingCurrentPlayback(args);
                    break;
                case ApiCmd.Received.LISTSUBTITLETRACKS:
                    ListingSubtitles(args);
                    break;
                case ApiCmd.Received.LISTAUDIOTRACKS:
                    ListingAudioPids(args);
                    break;
                case ApiCmd.Received.CURRENTPOSITION:
                case ApiCmd.Received.NOTIFYSEEK:
                    if (w32Data.Payload.Contains(".")) {
                        NowPlaying.CurrentSecond = Convert.ToInt32(
                            w32Data.Payload.Substring(0, w32Data.Payload.IndexOf('.'))
                        );
                    } else {
                        NowPlaying.CurrentSecond = Convert.ToInt32(w32Data.Payload);
                    }
                    if (NotifyingSeek != null)
                        NotifyingSeek(args);
                    break;
                case ApiCmd.Received.NOTIFYENDOFSTREAM:
                    if (timer.Enabled) timer.Stop();
                    EndingPlayback(args);
                    break;
                case ApiCmd.Received.PLAYLIST:
                    break;
                default:
                    break;
            }
        }
Ejemplo n.º 3
0
 private void OnConnected(Win32EventArgs args)
 {
     StatusMessage = STATUS_CONNECTED;
 }