/// <summary> /// Loads information about the current playing song. /// Sets volume and progress according to the information in Spotify. /// Starts the progress counter which is responsible for updating the UI whenever /// the progress changes. /// Starts SignalR connection and subscribes to events. /// </summary> private async Task LoadData() { CurrentlyPlayingSong = await _spotifyApi.GetCurrentlyPlayingSongAsync(); IsPlaying = CurrentlyPlayingSong.is_playing; Volume = CurrentlyPlayingSong.device.volume_percent; Progress = new Progress() { Progress_Ms = CurrentlyPlayingSong.progress_ms, Duration_Ms = CurrentlyPlayingSong.item.duration_ms }; // Starts progress counter _ = Task.Run(() => ProgressCounter()); await SubscribeToHub(); }