Esempio n. 1
0
        /// <summary>
        /// Launches MixRadio App to show information on a selected product.
        /// </summary>
        /// <param name="id">Id of the product.</param>
        public async void LaunchProduct(string id)
        {
            if (!initialized)
            {
                return;
            }

            ShowProductTask task = new ShowProductTask();
            task.ProductId = id;
            await task.Show();
        }
Esempio n. 2
0
 /// <summary>
 /// Launches MixRadio app to an album view.
 /// </summary>
 /// <param name="sender">"Show in MixRadio" button</param>
 /// <param name="e">Event arguments</param>
 private async void ShowProduct(object sender, RoutedEventArgs e)
 {
     ShowProductTask task = new ShowProductTask() { ClientId = ApiKeys.ClientId, ProductId = this._albumId };
     await task.Show();
 }
Esempio n. 3
0
        /// <summary>
        /// Routes clicks on an MusicItem to the right place...
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns>A boolean indicating if we rooted the object successfully</returns>
        public async Task<bool> RouteItemClick(object item)
        {
            Artist artist = item as Artist;
            if (artist != null)
            {
                string thumb = string.Empty;
                if (artist.Thumb200Uri != null)
                {
                    thumb = HttpUtility.UrlEncode(artist.Thumb200Uri.ToString());
                }

                string musicbrainzId = string.Empty;
                if (!string.IsNullOrEmpty(artist.MusicBrainzId))
                {
                    musicbrainzId = "&" + App.MbIdParam + "=" + artist.MusicBrainzId;
                }

                this.RootFrame.Navigate(new Uri(
                        "/ArtistPage.xaml?" + App.IdParam + "=" + artist.Id
                                      + "&" + App.NameParam + "=" + HttpUtility.UrlEncode(artist.Name)
                                      + "&" + App.ThumbParam + "=" + thumb
                                      + musicbrainzId,
                                      UriKind.Relative));
                return true;
            }

            Product product = item as Product;
            if (product != null)
            {
                if (product.Category == Category.Track)
                {
                    ShowProductTask task = new ShowProductTask() { ClientId = ApiKeys.ClientId, ProductId = product.Id };
                    await task.Show();
                }
                else
                {
                    string thumb = string.Empty;
                    if (product.Thumb200Uri != null)
                    {
                        thumb = HttpUtility.UrlEncode(product.Thumb200Uri.ToString());
                    }

                    this.RootFrame.Navigate(new Uri("/AlbumPage.xaml?" + App.IdParam + "=" + product.Id + "&" + App.NameParam + "=" + HttpUtility.UrlEncode(product.Name) + "&" + App.ThumbParam + "=" + thumb, UriKind.Relative));
                }

                return true;
            }

            Genre genre = item as Genre;
            if (genre != null)
            {
                this.RootFrame.Navigate(new Uri("/GenrePage.xaml?" + IdParam + "=" + genre.Id + "&" + App.NameParam + "=" + HttpUtility.UrlEncode(genre.Name), UriKind.Relative));
                return true;
            }

            MixGroup group = item as MixGroup;
            if (group != null)
            {
                this.RootFrame.Navigate(new Uri("/ShowListPage.xaml?" + ShowListPage.MethodParam + "=" + MethodCall.GetMixes + "&" + IdParam + "=" + group.Id + "&" + NameParam + "=" + HttpUtility.UrlEncode(group.Name), UriKind.Relative));
                return true;
            }

            Mix mix = item as Mix;
            if (mix != null)
            {
                await mix.Play();
                return true;
            }

            return false;
        }
Esempio n. 4
0
 /// <summary>
 /// Launches MixRadio to show details about the product using the ShowProductTask
 /// </summary>
 /// <param name="product">The product.</param>
 /// <returns>An async task to await</returns>
 public static async Task Show(this Product product)
 {
     ShowProductTask task = new ShowProductTask() { ProductId = product.Id };
     await task.Show().ConfigureAwait(false);
 }