Skip to main content

Posts

Showing posts from February, 2011

WP7Contrib: Isolated Storage Cache Provider

15/04/2001 - The code for this example has been updated - new WP7 build of SilverlightSerializer, this has removed the explicit implementation of ISerializeObject interface from the example model classes. WP7Contrib received it's first question on the discussions forum, it was about how to use the  IsolatedStorageCacheProvider . Rich & I have been using this for a while in development and the question highlighted the lack of examples on how to use some of the stuff we've pushed out. So I thought I would share some insight into the demo I produced to answer the question. You'll find the demo in the 'CacheProviderDemo' in the 'Spikes' directory in the  code-base . It demostrates how to add both value & reference types to the cache, how these gets persisted to isolated storage and how values are purged from the cache. Before I show some code snippets I'll give some background to our thinking about caching. As wikipedia states 'a cache

WP7: Thinking about performance implicitly

It's inevitable as the moon going around the earth - the performance of your Windows Phone 7 app will become an issue during your application development life cycle, hopefully you're using agile practices and therefore this won't happen to late in the process. There is one technique I believe you should always apply to the process and that is ' thinking about performance implicitly '. So I have 3 tips which help me achieve thinking about performance implicitly. The emulator is not your friend - You should as others have pointed out always be testing on a device and not the emulator - the emulator is great for spiking and unit testing but not as environment for building an application, it runs at the speed of the host and I haven't yet managed to find a WP7 phone to match the perf of my 4 * Quad Core machine :) Get the worst device possible -  Okay any device running WP7 will have been certified by MS as acceptable, but there are still great differences b

WP7Contrib: Location Push Model

Anyone who's tried to get your current location of a WP7 device will know this is not as simple as it first appears, the problems really revolve around the frequency at which the location information can be generated by the device (GeoCoordinateWatcher class) and the fact it is generated on the UI thread. Jaime Rodriguez has a very insightful post on the issues, you should read this first if you're not familiar with the issues. For the WP7Contrib we wanted to abstract away the issues and simplify the interface for any developer wanting to get location information. Following the pattern we used for Network Connectivity we use a push model using the MS Reactive Extensions for .Net. We use an observable sequence which returns the current location (latitude & longitude) in one of three ways - the current location, the location by time threshold (seconds or TimeSpan) and the location by distance threshold (metre). The interface for the location service is shown below: pub