/// <summary>
        /// Launches Nokia Music app to an album view.
        /// </summary>
        /// <param name="sender">"Show in Nokia Music" button</param>
        /// <param name="e">Event arguments</param>
        private void ShowProduct(object sender, RoutedEventArgs e)
        {
            ShowProductTask task = new ShowProductTask();

            task.ProductId = this._albumId;
            task.Show();
        }
Example #2
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);
 }
Example #3
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();
 }
Example #4
0
        /// <summary>
        /// Routes clicks on an MusicItem to the right place...
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="player">The player if the page has one.</param>
        /// <returns>
        /// A boolean indicating if we rooted the object successfully
        /// </returns>
        public bool RouteItemClick(object item, MediaElement player)
        {
            Artist artist = item as Artist;

            if (artist != null)
            {
                App.RootFrame.Navigate(typeof(DetailPage), artist);
                return(true);
            }

            Product product = item as Product;

            if (product != null)
            {
                if (product.Category == Category.Track)
                {
                    Debug.WriteLine("Track pressed");
                    ShowProductTask task = new ShowProductTask()
                    {
                        ProductId = product.Id
                    };
                    task.Show();
                }
                else if (product.Category == Category.Album)
                {
                    App.RootFrame.Navigate(typeof(DetailPage), product);
                }

                return(true);
            }

            Genre genre = item as Genre;

            if (genre != null)
            {
                App.RootFrame.Navigate(typeof(DetailPage), genre);
                return(true);
            }

            MixGroup group = item as MixGroup;

            if (group != null)
            {
                App.RootFrame.Navigate(typeof(ShowListPage), new ShowListParams(MethodCall.GetMixes, group.Id, group.Name));
                return(true);
            }

            Mix mix = item as Mix;

            if (mix != null)
            {
                mix.Play();
                return(true);
            }

            return(false);
        }
        public void TestProductIdPropertyPersists()
        {
            ShowProductTask task = new ShowProductTask()
            {
                ProductId = TestProductId
            };

            Assert.AreEqual(TestProductId, task.ProductId, "Expected the same ID");
        }
Example #6
0
        /// <summary>
        /// Launches Nokia Music to show details about the product using the ShowProductTask
        /// </summary>
        public void Show()
        {
            ShowProductTask task = new ShowProductTask()
            {
                ProductId = this.Id
            };

            task.Show();
        }
        public void TestShowProductGoesAheadWhenItCan()
        {
            ShowProductTask task = new ShowProductTask()
            {
                AppId = TestAppId, ProductId = TestProductId
            };

            task.Show();
            Assert.Pass();
        }
Example #8
0
        public async Task TestShowProductGoesAheadWhenItCan()
        {
            ShowProductTask task = new ShowProductTask()
            {
                ClientId = TestClientId, ProductId = TestProductId
            };
            await task.Show();

            Assert.Pass();
        }
Example #9
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();
        }
Example #10
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 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());
                }

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

            Product product = item as Product;

            if (product != null)
            {
                if (product.Category == Category.Track)
                {
                    ShowProductTask task = new ShowProductTask()
                    {
                        ProductId = product.Id
                    };
                    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)
            {
                PlayMixTask mixPlayer = new PlayMixTask()
                {
                    MixId = mix.Id
                };
                mixPlayer.Show();
                return(true);
            }

            return(false);
        }
Example #11
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);
        }
        public void TestProductIdPropertyIsRequiredForShow()
        {
            ShowProductTask task = new ShowProductTask();

            task.Show();
        }
Example #13
0
 public async Task TestProductIdPropertyIsRequiredForShow()
 {
     ShowProductTask task = new ShowProductTask();
     await task.Show();
 }