Consuming Live OData feed in Silverlight WCF RIA Services hosted on Windows Azure, Windows Phone 8 & Windows Store app

Windows Azure supports Silverlight Business Applications(WCF RIA Services) as web role application. In order to work with WCF RIA services , enterprise business apps have rich support with OData endpoints, WCF Data Services, WCF Domain services(ADO.NET Entity Frameworks) , LINQ to SQL in order to connect with backend on-premise SQL Server or SQL Azure database. So, in current article, implemented a simple Silverlight enterprise business app running on Windows azure executing via live WCF OData endpoints while the same service can be consumed on Windows Phone 8 & Windows Store app without changing any major coding implementations.

Lets check the application architecture first which consists of a Windows Azure app running on dev fabric , Silverlight WCF RIA service app, Windows Phone 8 app & Windows Store app developed in VS 2012 ultimate platform.


  • Next , lets check about the architecture viewpoint of the Silverlight Business app running on Windows Azure. For consuming live OData feed , we have used the MSTeched 2010 Live feed which can be accessed @
  • Consume the OData feed as Service Reference & configure with LINQ query to specify the modules from the feed.

LINQ Query Sample:


from  g in Speakers


g.SpeakerID > 1620



select  g



  • Lets check the Silverlight client to consume the OData feed with asynchronous task library.

var ctx = newODataTENA10Entities(newUri(”, UriKind.Absolute));

var qry = from g in ctx.Speakers

where g.SpeakerID > 1620

orderby g.SpeakerFirstName

select g;

var coll = newDataServiceCollection<Speaker>();

coll.LoadCompleted += newEventHandler<LoadCompletedEventArgs>(coll_LoadCompleted);


DataContext = coll;

  • Lets check the silverlight web business app consuming live OData feed using WCF Data services & LINQ displaying MS Tech 2010 speakers list.



  • Similarly migrate the Silverlight Business app into Windows Azure platform & host as web role application.
  • OData feed can be consumed to any standard windows client like Windows Phone, Sharepoint , Windows Store, Azure Appfabric Service Bus.
  • Next, Lets add a new Windows Phone 8 Panorama application with our existing solution & add few code to consume the live OData feed & add service reference to work with WCF data services. For VS 2010, Windows Phone 7.1/ Windows Phone 8 apps, we need to work withSystem.Data.Services.Client.dll which can be obtained from here .
  • Add the following code to MainPage.xaml.cs in order to consume the live service from OData endpoint to Windows Phone.


private void MainPage_Loaded(object sender, RoutedEventArgs e)


var ctx = newODataTENA10Entities(newUri(;));

var coll = newDataServiceCollection<Speaker>(ctx);

lst.ItemsSource = coll;

coll.LoadCompleted += new  EventHandler<LoadCompletedEventArgs>(coll_LoadCompleted);

    var qry = “/Speakers”;

coll.LoadAsync(new Uri(qry, UriKind.Relative));


void coll_LoadCompleted(object sender, LoadCompletedEventArgs e)


if (e.Error != null)






  • Lets add one more project to consume the live OData feed on Windows Store Metro Style app to display Teched 2010 speakers list.
  • Since , Windows Phone 8 & Windows Store shares the same kernel structure , so same code can be applied for Windows Phone 8 & Windows Store apps developed as per as developed same class library, same UI structure & same architecture pattern (MVVM Model).
  • In Windows Store apps, the same code for Windows Phone 8 app can be applied in order to get live OData services feed on surface.
  • The OData Client library for Windows Store app can be downloaded from here


Building Interactive Alarm Clock for Windows Phone

Alarm Clock is an interactive tool for Windows Phone, Windows Surface (Win RT) devices available on marketplace which majorly focus on Alarm settings, Time Settings, execute alarm under locked screen. This article majorly focused on implementing an interactive Alarm Clock for Windows Phone 7.5 & 8 devices having Alarm Clock settings under locked screen, snooze alarm by pressing anywhere on main screen of the app & clock in 24X7 format.


  • The default main screen simply shows up the current time on 12 hour/24 hour basis with seconds time display on enhancement with necessary settings options.


  • Once you click on set alarm option , you would find the alarm time setting option which is based on TimePicker control for Windows Phone.



  • Once time is set, you are good to go & check the Alarm settings on your main screen. The same effects under lock screen too while you can lock the screen from the app itself.

lock screen

  • Next, Check the main settings options for this app which has clock setting on 24X7 basis along with vibrations options during alarm bell ringing. Initially all the settings have to be stored on Isolated Storage.

setting pane

  • The apps background color is changable & you can set your own forefround colors & themes based on phone settings. Alarm Time can be snoozed by pressing anywhere on main screen & displayed under locked screen itself.


  • The Alarm Sound can be changed based on user choice , for this you need write your own class as SoundEffects.cs :

using  System;

using  System.Net;

using  System.Windows;

using  System.Windows.Controls;

using  System.Windows.Documents;

using  System.Windows.Ink;

using  System.Windows.Input;

using  System.Windows.Media;

using  System.Windows.Media.Animation;

using  System.Windows.Shapes;

using  System.Windows.Resources;

using  Microsoft.Xna.Framework.Audio;

using  System.IO;

namespace  AlarmClock


public static class SoundEffects


public static void Initialize()


     StreamResourceInfo info;

info = App.GetResourceStream(newUri(“Audio/whistle.wav”, UriKind.Relative));

Alarm = SoundEffect.FromStream(info.Stream);

CompositionTarget.Rendering += delegate(object sender, EventArgs e)


Microsoft.Xna.Framework. FrameworkDispatcher.Update();


Microsoft.Xna.Framework. FrameworkDispatcher.Update();


public static SoundEffect Alarm { get; privateset; }



  • The complete Interactive Alarm Clock app for Windows Phone 7.5 & Windows Phone 8 source code  is shared here.
%d bloggers like this: