Example #1
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();
        }
Example #2
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();
        }
Example #3
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();
        }
Example #4
0
 /// <summary>
 /// Launches play mix task.
 /// </summary>
 /// <param name="sender">Play Mix Task button</param>
 /// <param name="e">Event arguments</param>
 private async void PlayMixTask(object sender, RoutedEventArgs e)
 {
     PlayMixTask task = new PlayMixTask();
     task.ArtistName = "Coldplay";
     await task.Show();
 }
Example #5
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);
 }