示例#1
0
        private void searchMix(object sender, RoutedEventArgs e)
        {
            PlayMixTask task = new PlayMixTask();

            task.ArtistName = MixTextBox.Text;
            task.Show();
        }
示例#2
0
        /// <summary>
        /// Launches play mix task.
        /// </summary>
        /// <param name="sender">Play Mix Task button</param>
        /// <param name="e">Event arguments</param>
        private void PlayMixTask(object sender, RoutedEventArgs e)
        {
            PlayMixTask task = new PlayMixTask();

            task.ArtistName = "Coldplay";
            task.Show();
        }
示例#3
0
 /// <summary>
 /// Launches MixRadio to start a mix for the artist using the PlayMixTask
 /// </summary>
 /// <param name="artist">The artist.</param>
 /// <returns>An async task to await</returns>
 public static async Task PlayMix(this Artist artist)
 {
     PlayMixTask task = new PlayMixTask()
     {
         ArtistId = artist.Id, ArtistName = artist.Name
     };
     await task.Show().ConfigureAwait(false);
 }
示例#4
0
        /// <summary>
        ///     Launches play artist mix task.
        /// </summary>
        /// <param name="artist">The artist name</param>
        static public void PlayArtistMix(string artist)
        {
            var task = new PlayMixTask {
                ArtistName = artist
            };

            task.Show();
        }
示例#5
0
        public void TestMixIdPropertyPersists()
        {
            PlayMixTask task = new PlayMixTask()
            {
                MixId = TestId
            };

            Assert.AreEqual(TestId, task.MixId, "Expected the same ID");
        }
示例#6
0
        public void TestArtistNamePropertyPersists()
        {
            PlayMixTask task = new PlayMixTask()
            {
                ArtistName = TestArtistName
            };

            Assert.AreEqual(TestArtistName, task.ArtistName, "Expected the same name");
        }
示例#7
0
        /// <summary>
        /// Launches Nokia Music to start playback of the mix using the PlayMixTask
        /// </summary>
        public void Play()
        {
            PlayMixTask task = new PlayMixTask()
            {
                MixId = this.Id
            };

            task.Show();
        }
示例#8
0
        /// <summary>
        /// Launches Nokia Music to start a mix for the artist using the PlayMixTask
        /// </summary>
        public void PlayMix()
        {
            PlayMixTask task = new PlayMixTask()
            {
                ArtistName = this.Name
            };

            task.Show();
        }
示例#9
0
        public async Task TestPlayArtistMixGoesAheadWhenItCan()
        {
            PlayMixTask task2 = new PlayMixTask()
            {
                ArtistName = TestArtistName
            };
            await task2.Show();

            Assert.Pass();
        }
示例#10
0
        public void TestPlayMixGoesAheadWhenItCan()
        {
            PlayMixTask task = new PlayMixTask()
            {
                MixId = TestMixId
            };

            task.Show();
            Assert.Pass();
        }
示例#11
0
        public async Task TestPlayMixGoesAheadWithMixId()
        {
            PlayMixTask task = new PlayMixTask()
            {
                MixId = TestId
            };
            await task.Show();

            Assert.Pass();
        }
示例#12
0
        public async Task TestPlayMixGoesAheadWithArtistName()
        {
            PlayMixTask task = new PlayMixTask()
            {
                ArtistName = TestArtistName
            };
            await task.Show();

            Assert.Pass();
        }
        public void TestPlayArtistMixGoesAheadWhenItCan()
        {
            PlayMixTask task2 = new PlayMixTask()
            {
                ArtistName = TestArtistName
            };

            task2.Show();

            Assert.Pass();
        }
示例#14
0
        /// <summary>
        /// Launches MixRadio App to play a mix for a selected artist.
        /// </summary>
        /// <param name="artistName">Name of the artist.</param>
        public async void LaunchArtistMix(string artistName)
        {
            if (!initialized)
            {
                return;
            }

            PlayMixTask task = new PlayMixTask();

            task.ArtistName = artistName;
            await task.Show();
        }
示例#15
0
        /// <summary>
        /// Launches MixRadio App to play a selected mix.
        /// </summary>
        /// <param name="id">Id of the mix.</param>
        public async void LaunchMix(string id)
        {
            if (!initialized)
            {
                return;
            }

            PlayMixTask task = new PlayMixTask();

            task.MixId = id;
            await task.Show();
        }
示例#16
0
        /// <summary>
        /// Launches MixRadio to start playback of the mix using the PlayMixTask
        /// </summary>
        /// <param name="mix">The mix.</param>
        /// <returns>An async task to await</returns>
        public static async Task Play(this Mix mix)
        {
            if (!string.IsNullOrEmpty(mix.Id))
            {
                PlayMixTask task = new PlayMixTask()
                {
                    MixId = mix.Id
                };
                await task.Show().ConfigureAwait(false);

                return;
            }
#if WINDOWS_PHONE
            else if (mix.Seeds.Where(s => s.Type == SeedType.UserId).Count() > 0)
            {
                await new PlayMeTask().Show().ConfigureAwait(false);
                return;
            }
#endif

            if (mix.Seeds != null)
            {
                var artistSeeds = mix.Seeds.Where(s => (s.Type == SeedType.ArtistId || s.Type == SeedType.ArtistName));

                // for now, just take the first artist name - need to support multiple soon though
                var name = artistSeeds.Select(s => s.Name).Where(s => !string.IsNullOrEmpty(s)).FirstOrDefault();
                if (!string.IsNullOrEmpty(name))
                {
                    await new PlayMixTask()
                    {
                        ArtistName = name
                    }.Show().ConfigureAwait(false);
                    return;
                }
            }

            throw new InvalidOperationException();
        }
示例#17
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);
        }
示例#18
0
 public async Task TestMixIdPropertyIsRequiredForShow()
 {
     PlayMixTask task = new PlayMixTask();
     await task.Show();
 }
示例#19
0
        public void TestMixIdPropertyIsRequiredForShow()
        {
            PlayMixTask task = new PlayMixTask();

            task.Show();
        }