In our previous article (Windows Azure Mobile Services Preview Announced) we have seen what Windows Azure Mobile Services are what are the uses of this service provided by Microsoft. Now in this tutorial we are going to see how to use the Windows Azure Mobile Services for backend data processing for a Windows 8 Application. Follow the prerequisites of activating the Mobile Services before proceeding with the below steps.
First we need to look that Visual Studio 2012 RTM or any previous release of the Visual Studio 2012 is installed in the local development machine. To start with first login to the Windows Azure Management Portal with a valid subscription which has the Windows Azure Mobile Services Preview activated. Navigate to the Windows Azure Mobile Services tab and click on the NEW button at the bottom as shown in the screen below. [more]
We can see a input form opened with some options that are required to initialize a Mobile Service for our application. Enter the basic information like the end point url, database (We can use existing database or create a new one) and the region as shown in the screen below.
Click on Next button and we can see the options to configure the database where we can provide the details of the new database with some valid login credentials as shown in the screen below.
Clicking on the Finish button will start creating the mobile services and after few seconds we can see the new Mobile Service will be listed in the Management Portal as shown in the screen below.
Click on the Mobile Services and we can see it navigates to the Dashboard home screen which has the Quick start tutorials on using this Windows Azure Mobile Services with Windows 8 Application as shown in the screen below.
Let us start creating a new Windows 8 Application, click on the Create a New Windows 8 Application link and it provides the steps for creating a Mobile Services based Windows 8 App as shown in the screen below.
Is Visual Studio 2012 is not installed, you can install the VS Express for Windows 8 which is of free download. Once the Visual Studio 2012 is ready Install the Mobile Services SDK by clicking on Install Mobile Services SDK. We can see the installation begins as shown in the screen below.
For easy access, let us use the Todo Item table which is available ready made for testing the services, Click on Create TodoItem table button in the portal and we can see the table is created as shown in the screen below.
Open the application in Visual Studio 2012 IDE and we can see the default files that are required to run the application as shown in the screen below.
Open App.Xaml page, in the file we can see a MobileServiceClient class will be initialized with a key, the key plays the important role to authenticate the service with the application as shown in the screen below.
The key can be regenerated anytime in order to change the authentication, but the existing connection will be lost if the key is regenerated and deployed. To regenerate the key we can use the Manage Key section at the bottom of the portal as shown in the screen below.
Now open MainPage.xaml and we can see the code available to insert, delete, update the tasks which is generated by default as shown in the screen below. We can customize or we can follow the procedure to create on our own business process.
Now run the application over the simulator and we can see the application is loaded as shown in the screen below. Input some sample values and see if can able to save the data to the Windows Azure Cloud using the Azure Mobile Services. Run the application to a simulator or local environment of your choice, here we are going to use the Windows 8 simulator as shown in the screen below.
Enter the items of your choice for the task that will be filled with a checkbox at the right panel. Clicking on the checkbox will make the task completed and will be removed from the list as shown in the screen below.
Now go to the management portal and navigate to the Dashboard of Mobile Services component which we created and we can see the data transfer and other metrics which will tell the developer how the data is been transferred. Now navigate to the Data tab at the top and we can see the TodoItem table listed as shown in the screen below.
The table shows the number of indexes available and the number of rows inserted to the cloud database from the Windows 8 Application. Now click on the table will navigate to the data viewer where we can see the data which we entered manually as shown in the screen below.
That’s it from this tutorial, in our upcoming series we will see in detail and explore more on using the Windows Azure Mobile Service effectively.
Hope this information will be useful to you, If interested please don’t forget to connect with me on Twitter, Facebook and GooglePlus for updates. Also subscribe to F5debug Newsletter to get all the updates delivered directly to your inbox. We won’t spam or share your email address as we respect your privacy.