Пример #1
0
        private async void RadioPlaybackManager_PlaybackStateChanged(object sender, PlaybackStateChangedEventArgs e)
        {
            Debug.WriteLine(string.Format("playbackstate changed: {0}", e.State.ToString()));
            switch (e.State)
            {
            case PlaybackState.Error_MediaInvalid:
                await this.tryWriteToDisplay(this.resourceLoader.GetString("MediaErrorMessage") + "\n" + this.radioPresetManager.CurrentTrack.Name, 0);

                break;

            case PlaybackState.Loading:
                await this.tryWriteToDisplay(this.resourceLoader.GetString("MediaLoadingMessage") + "\n" + this.radioPresetManager.CurrentTrack.Name, 0);

                break;

            case PlaybackState.Playing:
                playbackRetries = 0;
                await this.tryWriteToDisplay(this.resourceLoader.GetString("NowPlayingMessage") + "\n" + this.radioPresetManager.CurrentTrack.Name, 0);

                break;

            case PlaybackState.Ended:
                if (maxRetries > playbackRetries)
                {
                    playChannel(this.radioPresetManager.CurrentTrack);
                }
                else
                {
                    await this.tryWriteToDisplay(this.resourceLoader.GetString("ConnectionFailedMessage") + "\n" + this.radioPresetManager.CurrentTrack.Name, 0);
                }

                break;
            }
        }
Пример #2
0
        private async void RadioPlaybackManager_PlaybackStateChanged(object sender, PlaybackStateChangedEventArgs e)
        {
            switch(e.State)
            {
                case PlaybackState.Error_MediaInvalid:
                    await this.tryWriteToDisplay(this.resourceLoader.GetString("MediaErrorMessage") + "\n" + this.radioPresetManager.CurrentTrack.Name, 0);
                    break;

                case PlaybackState.Loading:
                    await this.tryWriteToDisplay(this.resourceLoader.GetString("MediaLoadingMessage") + "\n" + this.radioPresetManager.CurrentTrack.Name, 0);
                    break;

                case PlaybackState.Playing:
                    playbackRetries = 0;
                    await this.tryWriteToDisplay(this.resourceLoader.GetString("NowPlayingMessage") + "\n" + this.radioPresetManager.CurrentTrack.Name, 0);
                    break;
                case PlaybackState.Ended:
                    if (maxRetries > playbackRetries)
                    {
                        playChannel(this.radioPresetManager.CurrentTrack);
                    }
                    else
                    {
                        await this.tryWriteToDisplay(this.resourceLoader.GetString("ConnectionFailedMessage") + "\n" + this.radioPresetManager.CurrentTrack.Name, 0);
                    }

                    break;
            }
        }