Nokia MixRadio: Show Gigs And Mix Task

In this article we will learn how to search for future music shows and events using the Nokia MixRadio launcher.

Introduction

In this article we will learn how to search for future music shows and events using the Nokia MixRadio launcher. To do this we will use the Show Gigs Task of the MixRadio launcher. This launcher is based on the MixRadio API . It allows you to get all the information of future events for any given artist or search for a term from your app into the Nokia MixRadio app.

Show Gigs Task

Use the following procedure to use this task in your application:

  1. First include the reference of the Nokia MixRadio API "Nokia.Music.Wp8.dll" in your project.
  2. Create a new Show Gigs Task.
  3. Set the search term in the task.
  4. Finally show the task using the show method.

Use the following to create a new show gigs task:

    ShowGigsTask task = new ShowGigsTask();

Now set the artist name.

    task.SearchTerms = "A R Rehman";

Finally use the Show method to open the Nokia mix app and show the artist details.

    task.Show();

Show Gigs Task Example

XAML

<phone:PhoneApplicationPage

    x:Class="Demo.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"

    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    FontFamily="{StaticResource PhoneFontFamilyNormal}"

    FontSize="{StaticResource PhoneFontSizeNormal}"

    Foreground="{StaticResource PhoneForegroundBrush}"

    SupportedOrientations="Portrait" Orientation="Portrait"

    shell:SystemTray.IsVisible="True">

 

    <!--LayoutRoot is the root grid where all page content is placed-->

    <Grid x:Name="LayoutRoot" Background="Transparent">

        <Grid.RowDefinitions>

            <RowDefinition Height="Auto"/>

            <RowDefinition Height="*"/>

        </Grid.RowDefinitions>

 

        <!--TitlePanel contains the name of the application and page title-->

        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">

            <TextBlock Text="Demo" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>

            <TextBlock Text="MixRadio Demo" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>

        </StackPanel>

 

        <!--ContentPanel - place additional content here-->

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

            <TextBox Name="srchTxt" HorizontalAlignment="Left" Height="72" Margin="0,10,0,0" TextWrapping="Wrap" Text="Enter Artist Name" VerticalAlignment="Top" Width="456"/>

            <TextBox Name="idTxt" HorizontalAlignment="Left" Height="72" isEnabled="false" Margin="0,82,0,0" TextWrapping="Wrap" Text="Enter Mix ID" VerticalAlignment="Top" Width="456"/>

            <Button Content="View Events" Click="viewEventsBtnClick" HorizontalAlignment="Left" Margin="268,193,0,0" VerticalAlignment="Top" Width="178"/>

        </Grid>

    </Grid>

</phone:PhoneApplicationPage>

C# - Code Behind

Before using the following code you need to install the Nokia MixRadio API in your application.

To install the MixRadio package in your project use the following command line:

PM> Install-Package NokiaMusic

After successful installation you will see the log similar to this:

Attempting to resolve dependency 'SharpGIS.GZipWebClient (≥ 1.4.0.0)'.

Attempting to resolve dependency 'Newtonsoft.Json (≥ 5.0.6)'.

Installing 'SharpGIS.GZipWebClient 1.4.0.0'.

Successfully installed 'SharpGIS.GZipWebClient 1.4.0.0'.

Installing 'Newtonsoft.Json 5.0.6'.

Successfully installed 'Newtonsoft.Json 5.0.6'.

Installing 'NokiaMusic 3.2.0'.

Successfully installed 'NokiaMusic 3.2.0'.

Adding 'SharpGIS.GZipWebClient 1.4.0.0' to Demo.

Successfully added 'SharpGIS.GZipWebClient 1.4.0.0' to Demo.

Adding 'Newtonsoft.Json 5.0.6' to Demo.

Successfully added 'Newtonsoft.Json 5.0.6' to Demo.

Adding 'NokiaMusic 3.2.0' to Demo.

Successfully added 'NokiaMusic 3.2.0' to Demo.

Now here is the actual code behind:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Navigation;

using Microsoft.Phone.Controls;

using Microsoft.Phone.Shell;

using Demo.Resources;

 

namespace Demo

{

    public partial class MainPage : PhoneApplicationPage

    {

        // Constructor

        public MainPage()

        {

            InitializeComponent();

        }

 

        private void viewEventsBtnClick(object sender, RoutedEventArgs e)

        {

            Nokia.Music.Tasks.ShowGigsTask mixApp = new Nokia.Music.Tasks.ShowGigsTask();

            mixApp.SearchTerm = srchTxt.Text.Trim();  // Set the Mix Artist or

            mixApp.Show();

        }

    }

}

 

Show Mix Task

This task allows you to launch a MixRadio App to listen to free mixes.

C# Code

The following code will launch a MixRadio app using the show mix task.

        private void viewMixBtnClick(object sender, RoutedEventArgs e)

        {

            Nokia.Music.Tasks.ShowMixTask mixApp = new Nokia.Music.Tasks.ShowMixTask();

            mixApp.Show();

        }

Output

 

 
 
 
  
Summary

That's all for this article. In my next article I will cover the rest of the methods of the MixRadio Launcher. In the case of any doubt then feel free to ask in the comments.