private void GetSessionInfo(LoveHateTrackStream stream) { Task .Factory .StartNew(state => { var s = (LoveHateTrackStream)state; SessionInfoResponse response; if (s.TryGetSessionInfo(out response)) { SessionInfo = response; } else { SessionInfo = null; } }, stream) .ContinueWith(task => { if (task.Exception != null) { Logger.Log(task.Exception.ToString(), Category.Exception, Priority.Medium); } }); }
void INavigationAware.OnNavigatedTo(NavigationContext navigationContext) { SearchBarService.Add <LoveHateView>(new SearchBarData { Category = "Love_Or_Hate", WatermarkText = "Love_Or_Hate_Watermark", AutoCompleteProvider = SuggestArtists }); SearchBarService.SetActive(searchBar => searchBar.NavigationUri.OriginalString.StartsWith(typeof(LoveHateView).FullName)); if (!string.IsNullOrEmpty(navigationContext.Parameters[SearchBar.IsFromSearchBarParameter])) { var artistName = navigationContext.Parameters[SearchBar.ValueParameter]; Execute(artistName); } Radio.CurrentTrackChanged += OnCurrentTrackChanged; if (Radio.CurrentTrack != null) { HasTrack = true; } _loveHateTrackStream = Radio.CurrentTrackStream as LoveHateTrackStream; if (_loveHateTrackStream != null) { GetSessionInfo(_loveHateTrackStream); } }
private void EnsureTrackStreamExists() { if (_loveHateTrackStream == null && Radio.CurrentTrack != null) { _loveHateTrackStream = new LoveHateTrackStream(Radio.CurrentTrack.Artist, Radio, ToastService); } }
private void Execute(string artistName) { _loveHateTrackStream = new LoveHateTrackStream(artistName, Radio, ToastService); Radio.Play(_loveHateTrackStream); }