Presented on: “Discover Best in You “ and Windows Azure

This weekend was exciting I presented two different sessions on entirely two different topics in two different cities.

C-SharpCorner Delhi Chapter Meet: 21st September 2013

Read C# Corner Delhi Chapter Meet, 21 September, 2013: Official Recap

I tried new thing in this chapter meet and presented on a non-technical topic. I presented on “Discover Best in you”.

image

In my session I conducted two exercise for the audience and they loved that. Find slides from my presentation below,

 

I hope attendees liked this session and I am motivated to conduct more of this kind presentation.

Join C-Sharpcorner Delhi Chapter here to attend future events

 

Lovely Professional University, Jalandhar- 22nd September 2013

Yes first time I visited Punjab and I must say I had great time presenting there. There was an event centred on Windows Azure and I had an opportunity to introduce Windows Azure and Cloud Computing to young students. It was introductory kind of session and I enjoyed it most. I always look forward to talk to students.

All together it was exciting week for me. Looking forward for next month community engagement.

About these ads

Windows Azure Blog Posts 100 Not Out

image

I love Windows Azure. I have been growing as professional with Windows Azure. I am excited as kid writing this and informing you that yea I have blogged more than 100 posts on Windows Azure.

Read All Windows Azure Blog Posts here

image

I wrote first blog posts on Windows Azure back on 16th November 2009 with following title

Step by Step walkthrough to create first application for cloud (Windows Azure)

And my latest blog post on Windows I wrote today morning. It is on Windows Azure Mobile Service

Fetching Windows Azure Mobile Services Data in XAML based Windows Store Application

In my journey to 100+ blog posts I touched upon all part of Windows Azure like Windows Azure Hosted Services, Table, Queues, Blobs, SQL Azure, and Windows Azure Mobile Services etc. I am very happy seeing Windows Azure is progressing as platform. Recent addition of Active Directory on Windows Azure is one of my favourite. I try to see Windows Azure always as developer. I put developer touch in Windows Azure. I have authored many posts like exposing Management API operations as WCF SOAP Service etc. I am committed to continue writing on Windows Azure along with other technologies.

Read All Windows Azure Blog Posts here

I complete this post by thanking my readers. Long live Windows Azure. Let us go on cloud way.

Fetching Windows Azure Mobile Services Data in XAML based Windows Store Application

In last post we started learning about Windows Azure Mobile Service in XAML based Windows Store Application. Read it here

In last post we learnt

  • Configuring Window Azure Mobile Service in portal
  • Consuming Windows Azure Mobile Service in Windows Store Application
  • Insert a record from application in Windows Azure Mobile Service data table.

In this post we will take a look on fetching records from table. I recommend you to follow Part 1 of this series here . I will start from where I left in part 1.

Let us design application page. There are two buttons. On click of first button we will fetch all data. On click of second button filtered data will fetched. Let us design application page as following


<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" >
 <Grid.RowDefinitions>
 <RowDefinition Height="*" />
 <RowDefinition Height="*" />

 </Grid.RowDefinitions>

<StackPanel Orientation="Vertical" Grid.Row="0">
 <Button x:Name="btnFetch" Click="btnFetch_Click_1" Content="Get Data" Height="72" Width="233"/>
 <GridView x:Name="lstBloggers" >
 <GridView.ItemTemplate>
 <DataTemplate>
 <StackPanel Orientation="Horizontal">
 <TextBlock Text="{Binding Name}" />
 <TextBlock Text="{Binding Technology}" />
 </StackPanel>
 </DataTemplate>
 </GridView.ItemTemplate>
 </GridView>
 </StackPanel>
 <StackPanel Orientation="Vertical" Grid.Row="1">
 <StackPanel Orientation="Horizontal">
 <TextBox x:Name="txtSearch" Height="59" Width="436" />
 <Button x:Name="btnFilterfetch" Click="btnFilterfetch_Click_1" Content="Get Filtered Data" Height="72" Width="233"/>
 </StackPanel>
 <ListView x:Name="lstFilterBloggers" Margin="368,20,271,-599">
 <ListView.ItemTemplate>
 <DataTemplate>
 <StackPanel Orientation="Horizontal">
 <TextBlock Text="{Binding Name}" />
 <TextBlock Text="{Binding Technology}" />
 </StackPanel>
 </DataTemplate>
 </ListView.ItemTemplate>
 </ListView>
 </StackPanel>
 </Grid>

Yes this is not one of the best UI we can create but any way creating highly immersive UI is not purpose of this post. Right now UI will look like below image

image

Now to fetch all the records you need to follow following steps

Define Global variables


MobileServiceClient client;
 MobileServiceCollectionView<TechBloggers> items;
 MobileServiceCollectionView<TechBloggers> filteredItems;
 IMobileServiceTable<TechBloggers> bloggerstable;


You need to create mobile service table client in application. That can be created as following


public MainPage()
 {
 this.InitializeComponent();
 MobileServiceClient client = new MobileServiceClient("https://youappurl", "appkey");
 bloggerstable = client.GetTable<TechBloggers>();

 }

&nbsp;

Next you need to create entity class representing table from the Windows Azure Mobile Service. Let us create entity class as following. We are creating entity class TechBloggers.


public class TechBloggers
 {
 public int id { get; set; }
 [DataMember(Name="name")]
 public string Name { get; set; }
 [DataMember(Name = "technology")]
 public string Technology { get; set; }

}

On click event of button you can fetch all data from Mobile Service Table as following


private void btnFetch_Click_1(object sender, RoutedEventArgs e)
 {

items = bloggerstable.ToCollectionView();
 lstBloggers.ItemsSource = items;

}

You can fetch filtered data as following. We are filtering data on search term given in textbox.

private void btnFilterfetch_Click_1(object sender, RoutedEventArgs e)
 {
 filteredItems = bloggerstable.Where
 (blogger => blogger.Technology == txtSearch.Text)
 .ToCollectionView();
 lstFilterBloggers.ItemsSource = filteredItems;

 }

&nbsp;

When you run application you will find all data and filtered data as following

image

In this way we can fetch data from Windows Azure Mobile Service. In next post we will get into update and deletion of record. I hope this post useful. Thanks for reading.