Пример #1
0
        protected virtual void OnMediaPlaybackChanged(MediaPlaybackStateChangedEventArgs e)
        {
            ThreadPool.QueueUserWorkItem(m =>
            {
                switch (e.PlaybackState)
                {
                case PlaybackStateCode.Playing:
                    MusicPlaying?.Invoke(this, EventArgs.Empty);
                    break;

                case PlaybackStateCode.Paused:
                    MusicPaused?.Invoke(this, EventArgs.Empty);
                    break;
                }
                MediaPlaybackChanged?.Invoke(this, e);
            });
        }
        public void OnPlaybackStateChanged(RemoteControlPlayState state)
        {
            PlaybackState = state;
            MusicStatus   = state;
            Log.Info("LiveDisplay", "Music state is" + state);
            OnMediaPlaybackChanged(new MediaPlaybackStateChangedKitkatEventArgs
            {
                PlaybackState = state
            });
            switch (state)
            {
            case RemoteControlPlayState.Playing:
                MusicPlaying?.Invoke(null, EventArgs.Empty);
                break;

            case RemoteControlPlayState.Paused:
                MusicPaused?.Invoke(null, EventArgs.Empty);
                break;
            }
        }