rx forwp7
TRANSCRIPT
1 Slalom ConfidentialSlalom Confidential
Becoming an Rx Pusher
on WP7
Jim WooleyConsultant
2 Slalom Confidential
CodeStock is proudly partnered with:
Send instant feedback on this session via Twitter:
Send a direct message with the room number to @CodeStock d codestock 503 This session is great!
For more information on sending feedback using Twitter while at CodeStock, please see the “CodeStock README” in your CodeStock guide.
RecruitWise and Staff with Excellence - www.recruitwise.jobs
3 Slalom Confidential
CADRE5
The Hardest Problems Solved By the Best Engineers
4 Slalom Confidential
Reactive Framework
“Rx is a library for composing asynchronous and event-based programs using
observable collections.”
5 Slalom Confidential
Observable Collection - Common Uses
6 Slalom Confidential
Flavors of Rx
JavaScript
7 Slalom Confidential
Pulling with Enumerables
var query = from candy in bagOfCandies
where candy.HasNuts
group candy by candy.Name into GroupedCandies
select new {Name = GroupedCandies.Key, CandyCount = GroupedCandies.Count()}; foreach (var aggregate in query) Move Next
Move Next
Move Next
Move Next
False
8 Slalom Confidential
IEnumerator vs. IObserver
public interface IEnumerator{ object Current { get; } bool MoveNext(); void Reset();}
public interface IObserver<T>{ void OnCompleted(); void OnError(Exception exception); void OnNext(T value);}
Blocking
9 Slalom Confidential
Pushing with Observables
var query = from candy in bagOfCandies
where candy.HasNuts
group candy by candy.Name into GroupedCandies
select new {Name = GroupedCandies.Key, CandyCount = GroupedCandies.Count()}; query.Subscribe(group => DoSomething(group)); Subscribe
OnNext
OnNext
OnNext
OnNext
OnNext
OnCompleted
10 Slalom Confidential
MOVING FROM ENUMERABLE TO OBSERVABLEdemo
11 Slalom Confidential
Rx Interfaces
12 Slalom Confidential
COMPOSING WITH EVENTSdemo
13 Slalom Confidential
Observable Events
First Class ObjectsDisposableSupports DI/IOCMockable
14 Slalom Confidential
Asynchronous Service Requests
Randomizer service
BeginRollDieIObservable<int>
Throttle
UI Thread
15 Slalom Confidential
ASYNCHRONOUS SERVICESdemo
16 Slalom Confidential
Further Information
Rx Data Developer Center: http://msdn.microsoft.com/data/gg577609
Reactive Extensions Team Blog: http://blogs.msdn.com/rxteam
Channel9: http://channel9.msdn.com/Tags/Rx
17 Slalom Confidential
Call to Action
Get the bits• Shipped in Windows Phone 7 ROM• Install with NuGet• Download at MSDN Data Developer Center
Join the Community (MSDN forums)http://social.msdn.microsoft.com/Forums/en-US/rx
18 Slalom Confidential
Jim Wooley@jimwooley
http://www.ThinqLinq.com
questions