private void RefreshUI() { InvokeOnUIThread(() => { switch (MusicPlayerState) { case MediaPlaybackState.Playing: TelemetryService.WriteEvent("MusicPlaying"); MusicPlayerStatusText = MusicPlayerStatusPlayingText; if (SelectedMediaIndex >= 0 && SelectedMediaIndex < MediaFileCollection.Count) { var selectedFile = MediaFileCollection.ElementAt(SelectedMediaIndex); MusicPlayerStatusText = string.Format(Common.GetLocalizedText("MusicPlayerStatusFormat"), MusicPlayerCurrentlyPlayingText, selectedFile.DisplayName); } break; case MediaPlaybackState.Paused: MusicPlayerStatusText = MusicPlayerStatusPausedText; break; case MediaPlaybackState.Opening: MusicPlayerStatusText = MusicPlayerStatusLoadingText; break; case MediaPlaybackState.Buffering: MusicPlayerStatusText = MusicPlayerStatusLoadingText; break; default: MusicPlayerStatusText = MusicPlayerStatusDefaultText; break; } }); }
private async void RefreshUI() { switch (MusicPlayerState) { case MediaPlaybackState.Playing: TelemetryService.WriteEvent("MusicPlaying"); MusicPlayerStatusText = MusicPlayerStatusPlayingText; break; case MediaPlaybackState.Paused: MusicPlayerStatusText = MusicPlayerStatusPausedText; break; case MediaPlaybackState.Opening: MusicPlayerStatusText = MusicPlayerStatusLoadingText; break; case MediaPlaybackState.Buffering: MusicPlayerStatusText = MusicPlayerStatusLoadingText; break; default: MusicPlayerStatusText = MusicPlayerStatusDefaultText; break; } if (SelectedMediaIndex >= 0 && SelectedMediaIndex < MediaFileCollection.Count) { _currentFile = MediaFileCollection.ElementAt(SelectedMediaIndex); await RefreshMediaInfoAsync(_currentFile); } else { SongTitleText = string.Empty; SongArtistText = string.Empty; SongThumbnailSource = DefaultPicture; } }