Exemple #1
0
        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;
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        /// <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;
        }
Exemple #4
0
        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;
        }
Exemple #5
0
        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");
            }
        }
Exemple #6
0
        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");
            }
        }