public ExternalCommandResult Execute(SelectionSet impliedSelection, ref string errorMessage, ref IList <ObjectId> elementSet) { var s = new StationNavigator(); return(AddinManagerDebuger.DebugInAddinManager(s.NavigateStation, impliedSelection, ref errorMessage, ref elementSet)); }
private async Task <AudioTrack> GetPreviousStation(string name) { try { DISettingsCache cache = Serialize.Open <DISettingsCache>("di.xml"); List <Station> stations = Serialize.Open <List <Station> >("stationcache.xml"); Station nextStation = StationNavigator.GetPreviousStation(name, stations); if (nextStation != null) { TrackListDownloader downloader = new TrackListDownloader(); List <Track> tracks = await downloader.GetTracksForStation(nextStation.JSONID); string trackName = string.Empty; if (tracks != null) { trackName = tracks[0].FullTrackName; } Uri location; if (cache != null && cache.IsPremiumEnabled) { location = new Uri(nextStation.PremiumLocation + "?" + cache.PremiumKey); } else { location = new Uri(nextStation.Location); } return(new AudioTrack(location, trackName, nextStation.Name, string.Empty, null)); } else { return(null); } } catch { return(null); } }
async void Instance_PlayStateChanged(object sender, EventArgs e) { try { Station station = StationNavigator.GetStationByName(BackgroundAudioPlayer.Instance.Track.Artist, MainPageViewModel.Instance.Stations); if (CoreViewModel.Instance.CurrentStation != station) { // Since the station has switched, it makes sense to stop // the recording and prompt the user to enter a name for the // recorded track. if (PlaybackPageViewModel.Instance.IsRecording) { StopRecording(); } CoreViewModel.Instance.CurrentStation = station; TrackListDownloader downloader = new TrackListDownloader(); var result = await downloader.GetTracksForStation(station.JSONID); CoreViewModel.Instance.CurrentStation.NowPlaying = result.First(); result.Remove(result.First()); CoreViewModel.Instance.CurrentStation.TrackList = new ObservableCollection <Track>(result); } if (BackgroundAudioPlayer.Instance.PlayerState == PlayState.TrackReady) { BackgroundAudioPlayer.Instance.Play(); } SetAppropriateImage(false); } catch { Debug.WriteLine("Apparently no internet and track cannot be assigned."); } }
private void NavigateToNextStation() { try { Station station = StationNavigator.GetNextStation(CoreViewModel.Instance.CurrentStation.Name, MainPageViewModel.Instance.Stations.ToList()); if (station == null) { MessageBox.Show("There are no stations after this one, so we can't do the switch.", "Beem", MessageBoxButton.OK); } else { CoreViewModel.Instance.CurrentStation = station; imgFave.Source = Utility.FavoriteImageSetter.GetImage(CoreViewModel.Instance.CurrentStation); CheckCurrentPlayingState(); } } catch { MessageBox.Show("Can't navigate to that station. It looks like that station is missing. Make sure you are connected to a network and try again.", "Beem", MessageBoxButton.OK); } }