Using The GeoCoordinateReactiveService

Having created an Rx wrapper over the GeoCoordinateWatcher on a previous post, in this post I’ll demonstrate how it can be used in a simple application.

The application will display the status of the service, the position and the distance traveled.

For this simple application the service will be exposed as a singleton property of the App class:

public partial class App : Application
    // ...

    public static IGeoCoordinateReactiveService GeoCoordinateService { get; private set; }

    public App()
        // ...


        // ...

    // ...

    private void InitializePhoneApplication()
        // ...

        GeoCoordinateService = new GeoCoordinateReactiveService();

        // ...


    // ...


Getting the status of the service is very simple. It just requires subscribing to the StatusObservable. Since we want to display the status, we need to observe it on the dispatcher before:


For the position we do the same with the PositionObservable:


The distance traveled would seem a bit more complicated because we need to keep track of the last position and calculate the distance traveled on every position change. But this is where the Rx excels with its query operators. If we combine the position observable with the position observable having skipped one position with the zip operator we end up with an observable with the current and previous position. And if we apply a selector, we get the traveled distance:

        (p1, p2) => p1.Location.GetDistanceTo(p2.Location))

You can find the complete implementation of the service and application here.


Implementing The GeoCoordinateWatcher As A Reactive Service

With Rx, events are first class citizens that can be passed around and composed as needed in a very simple way.

Continue reading

How To: Make XAML Content Globalizable When Using Value Converters

(This content was written based on Silverlight for Windows Phone, but might be valid for generic Silverlight.)

There are a many articles on MSDN (and all over the Internet) about globalization and localization of Silverlight applications in general and specifically Windows Phone 7 applications but I haven’t found any that uses a value converter.

Continue reading

People+ For Windows Phone

Recently, I’ve released a Windows Phone application to explore and use contact information.

In this application I used components and/or guidance from:

In future posts, I’ll be showing some tips, tricks and components I’ve used in this application.

People+ for Windows Phone
People+ for Windows Phone

Explore and use your contacts’ information.

Search contacts by:

  • name
  • phone number
  • e-mail address
  • physical address
  • websites
  • company
  • job title
  • significant others
  • children
  • notes

* Trial limitations The trial version is fully functional but will show a purchase reminder and might show ads.

* Application limitations

The Windows Phone system imposes some limitations on application developers.

It is not possible to:

  • access twitter information
  • access linkedin information
  • uniquely identify the contact
  • change or provide access to change the contact information

* Privacy statement This application does not make any use of the contacts information other than displaying and searching it. When ads are displayed, however, device information might be sent to the ad provider (smaato Privacy Policy).

Globalization, Localization And Why My Application Stopped Launching

When I was localizing a Windows Phone application I was developing, I set the argument on the constructor of the AssemblyCultureAttribute for the neutral culture (en-US in this particular case) for my application.

As it was late at night (or early in the dawn Smile) I went to sleep and, on the next day, the application wasn’t launching although it compiled just fine.

I’ll have to confess that it took me a couple of nights to figure out what I had done to my application.

Have you figured out what I did wrong?

The documentation for the AssemblyCultureAttribute states that:

The attribute is used by compilers to distinguish between a main assembly and a satellite assembly. A main assembly contains code and the neutral culture's resources. A satellite assembly contains only resources for a particular culture, as in [assembly:AssemblyCultureAttribute("de")]. Putting this attribute on an assembly and using something other than the empty string ("") for the culture name will make this assembly look like a satellite assembly, rather than a main assembly that contains executable code. Labeling a traditional code library with this attribute will break it, because no other code will be able to find the library's entry points at runtime.

So, what I did was marking the once main assembly as a satellite assembly for the en-US culture which made it impossible to find its entry point.

To set the the neutral culture for the assembly resources I should haveused (and eventually did) the NeutralResourcesLanguageAttribute. According to its documentation:

The NeutralResourcesLanguageAttribute attribute informs the ResourceManager of the application's default culture, and also informs the ResourceManager that the default culture's resources are found in the main application assembly. When looking up resources in the same culture as the default culture, the ResourceManager automatically uses the resources located in the main assembly instead of searching for a satellite assembly. This improves lookup performance for the first resource you load, and can reduce your working set.

GUID Generator: My first Windows Phone application is available on the marketplace

In order to complete the registration as a Windows Phone developer an application needs to be submitted.

Following the advise of Caio, I wrote a GUID Generator. It has now been published and you can get it here.

Have you ever felt the need for a freshly generated GUID?

With this application you can have a freshly generated GUID whenever you want.

A GUID (Globally Unique Identifier) is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated. Do you want o try?

Talking with friends with iPhone and Android phones I became aware that there is no such application for those platforms. How can they live without one?

Free e-Book: Programming Windows Phone 7 Series by Charles Petzold