public async void NavigateStream(object sender, ItemClickEventArgs e) { // We are loading App.IsLoading = true; // Get a list of items var trackList = StreamItems.Where(t => t.Type == "track" || t.Type == "track-repost" && t.Type != null).Select(t => t.Track).ToList(); // Get the clicked item var streamItem = (StreamItem)e.ClickedItem; switch (streamItem.Type) { case "track": case "track-repost": if (streamItem.Track != null) { var startPlayback = await PlaybackService.Current.StartMediaPlayback(trackList.ToList(), StreamItems.Token, false, streamItem.Track); if (!startPlayback.success) { await new MessageDialog(startPlayback.message, "Error playing stream.").ShowAsync(); } } break; case "playlist": case "playlist-repost": App.NavigateTo(typeof(Views.Playlist), streamItem.Playlist); break; } // We are not loading App.IsLoading = false; }
public async void PlayShuffleStreamTracks() { // Get a list of items var trackList = StreamItems.Where(t => t.Type == "track" || t.Type == "track-repost" && t.Type != null).Select(t => t.Track).ToList(); // Shuffle and play the items await ShuffleTracksAsync(trackList, StreamItems.Token); }
/// <summary> /// Refreshes the models depending on what /// page is being viewed /// </summary> public void RefreshStreamItems() { // As this process can take a while // we need to enable the loading ring App.IsLoading = true; StreamItems.RefreshItems(); // Now that we are complete, we need to hide // the loading ring. App.IsLoading = false; }
public async void PlayAllStreamTracks() { // We are loading App.IsLoading = true; // Get a list of items var trackList = StreamItems.Where(t => t.Type == "track" || t.Type == "track-repost" && t.Type != null).Select(t => t.Track).ToList(); var startPlayback = await PlaybackService.Current.StartMediaPlayback(trackList.ToList(), StreamItems.Token); if (!startPlayback.success) { await new MessageDialog(startPlayback.message, "Error playing stream.").ShowAsync(); } // We are not loading App.IsLoading = false; }
internal void GetNewsStream(string start = "1", string pageSize = "15", bool refresh = false) { GlobalLoading.Instance.IsLoading = true; try { if (refresh) { StreamItems.Clear(); } StreamItems = Service.GetNewsStream("canucks", start, pageSize); NotifyPropertyChanged("StreamItems"); } catch (Exception) { _errors.Add("news stream"); } }
internal void AddToNewsStream(string start, string pageSize = "15") { GlobalLoading.Instance.IsLoading = true; try { ObservableCollection <NewsStreamItem> newItems = Service.GetNewsStream("canucks", start, pageSize); newItems.CollectionChanged += (o, i) => { IList t = i.NewItems; StreamItems.Add(t.OfType <NewsStreamItem>().Last()); }; NotifyPropertyChanged("StreamItems"); } catch (Exception) { _errors.Add("news stream"); } }