rx forwp7

18
Slalom Confidential Becoming an Rx Pusher on WP7 Jim Wooley Consultant

Upload: jim-wooley

Post on 10-May-2015

445 views

Category:

Sports


2 download

TRANSCRIPT

Page 1: Rx forwp7

1 Slalom ConfidentialSlalom Confidential

Becoming an Rx Pusher

on WP7

Jim WooleyConsultant

Page 2: Rx forwp7

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

Page 3: Rx forwp7

3 Slalom Confidential

CADRE5

The Hardest Problems Solved By the Best Engineers

Page 4: Rx forwp7

4 Slalom Confidential

Reactive Framework

“Rx is a library for composing asynchronous and event-based programs using

observable collections.”

Page 5: Rx forwp7

5 Slalom Confidential

Observable Collection - Common Uses

Page 6: Rx forwp7

6 Slalom Confidential

Flavors of Rx

JavaScript

Page 7: Rx forwp7

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

Page 8: Rx forwp7

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

Page 9: Rx forwp7

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

Page 10: Rx forwp7

10 Slalom Confidential

MOVING FROM ENUMERABLE TO OBSERVABLEdemo

Page 11: Rx forwp7

11 Slalom Confidential

Rx Interfaces

Page 12: Rx forwp7

12 Slalom Confidential

COMPOSING WITH EVENTSdemo

Page 13: Rx forwp7

13 Slalom Confidential

Observable Events

First Class ObjectsDisposableSupports DI/IOCMockable

Page 14: Rx forwp7

14 Slalom Confidential

Asynchronous Service Requests

Randomizer service

BeginRollDieIObservable<int>

Throttle

UI Thread

Page 15: Rx forwp7

15 Slalom Confidential

ASYNCHRONOUS SERVICESdemo

Page 16: Rx forwp7

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

Page 17: Rx forwp7

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

Page 18: Rx forwp7

18 Slalom Confidential

Jim Wooley@jimwooley

http://www.ThinqLinq.com

questions