Getting Started with Rx for Windows Phone

Rx types reside in the Microsoft.Phone.Reactive namespace.

The key to using Rx is to understand the two principal interfaces: IObserver and IObservable. Rx’s IObservable and IObserver are analogous to IEnumerable and IEnumerator, except for one key difference: They do not block.

Rx allows you to create an IObservable object from an event. In the following excerpt, an IObservable is created using the IGeoLocator instance’s PositionChanged event:

IObservable<IEvent<PositionChangedProxyEventArgs>> observable    = Observable.FromEvent<GeoPositionChangedProxyEventArgs>(        ev => geoLocator.PositionChanged += ev,        ev => geoLocator.PositionChanged -= ev);

By supplying ...

Get Windows® Phone 8 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.