Saturday, July 02, 2011

WP7 + Funbeat API + Reactive Extensions Rx

Started building a sample Windows phone 7 app that are going to consume the Funbeat APIs and show tracks using a ArcGIS for WP7.

Hit some problems with the WP7 project, added a service reference and copied the code from my WPF project, the code did not work. Note to myself: allways start with the smallest subset of an API. The reson the code did not work is that Silverlight and WP7 only support asynchronous calls to a web service.

Well to make life easier Microsoft has shipped WP7 with Reactive Extentions (Rx), (API documentation) that provide support for handling asynchronous calls using observable collections and LINQ-style query operators. Take a look at the HOL for more information on how to use the Rx. So we can add a subscription to the completed event and react when the data gets recived. This is a great thing because the GUI will become more responsive.