Skip to main content

Posts

Showing posts from July, 2011

SilverlightSerializer MissingMethodException on WP7

I wanted to start a list of common reasons why Silverlight Serializer throws the MissingMethodException exception. First off you need to make sure you've got a WP7 build of the Silverlight Serializer - you can get a copy from the WP7Contrib code base if you don't want to build your own. Classes causing MissingMethodException exception: System.Uri, System.Globalization.CultureInfo To correct the issue for the above classes you will have to implement a classes that acts a serialization proxy, the one shown below is for System.Uri. [Serializer(typeof(Uri))] public sealed class SerializeUri : ISerializeObject {     public object[] Serialize(object target)     {         return new object[] { ((Uri) target).ToString() };     }     public object Deserialize(object[] data)     {         return new Uri((string) data[0]);     } } As said I'm going to try and keep this upto date as I come across framework classes not supported.

WP7Contrib: Transient caching with In Memory Cache Provider

Rich  and I are currently working on a WP7 application based around local content stored on the device.   This content consists of a database and a set of flat files per logical item.   The content for the application can contain many of these logical items; this is determined by the user when purchasing the application.   The content is either installed along with the application at purchase or is downloaded afterwards. The application is completely self-contained and read-only – it doesn't allow modification of content. The application in theory has n number of these logical items; each logical item is queried for a set of data.   This data consists of information extracted from a database and flat files.   Once the data has been extracted it is then mapped into the required model.   This process could be repeated n number of times whilst the application is being used.   There is a time penalty in accessing the flat files & database to get the data. This process is an id

WP7Contrib: Bing Maps REST Services Wrapper - Deep Dive

Following on from Rich's post introducing the Bing Maps Service in the WP7Contrib I'm going to explain in more detail how we built this service and how to use the API. Before I get into the details let’s get some background on what is provided by Microsoft out of the box.  Microsoft provides multiple APIs for programmatically integrating maps and map data into your WP7 applications as well as the UI based controls included in the Microsoft.Phone.Controls.Maps namespace. The APIs are designed to used in conjunction with the UI controls to annotate the visual elements of Bing Maps. The Bing Maps has it's own area up on MSDN, here . Microsoft supports both SOAP and REST APIs for accessing location, imagery, route and services information.  Each implementation has its own taxonomy and these are heavily influenced by the underlying protocol (as much as you can call REST a protocol).  The only advantage we can currently see with using the SOAP implementation over REST is

WP7Contrib: Timing out HTTP requests on Windows Phone 7

This code uses change set #68097 of the WP7Contrib -  http://wp7contrib.codeplex.com/SourceControl/changeset/changes/68097 When doing communications over HTTP we often want to set a timeout for the response.  We want the ability to handle the timeout in a timely manner when the communication with a remote server has taken too long. When using the full version of the .Net framework we have the ability to control this precisely using the HttpWebRequest.Timeout property. The default value is set to 100 seconds. Unfortunately the ability to change this property is not supported on the Windows Phone 7 platform and I suspect the value is set to 100 seconds (should test this hypothesis). Looking around on the internet there are several approaches to get around this problem using the DispatcherTimer class and explicitly disposing of the request when the timeout has been exceeded, see an example  here . When using our ResourceClient to do RESTful communication over HTTP we can leverage the