Get a flying start with Windows Phone 7 - NDC2010
-
Upload
jonas-folleso -
Category
Technology
-
view
2.010 -
download
5
description
Transcript of Get a flying start with Windows Phone 7 - NDC2010
AGENDA:- TDD- RX & ASYNC- MVVM & IOC- BLEND 4- LOCATION- NOTIFICATION
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/2
07
92
78
7@
N0
0/2
24
86
23
39
1/
KNOW SILVERLIGHT?
THEN YOU KNOW WP7!
FLIGHTS NORWAY
MONITORARRIVALS AND
DEPARTURES
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/sv
en
werk
/2
18
18
49
28
0/
FLIGHTS NORWAY
WHAT WE ARE GOING TO
BUILD
TDD
FUNDAMENTALPRACTICE
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/m
ad
_hou
se_p
hoto
gra
ph
y/
44
40
87
13
80
/
WP7SILVERLIGHT 3
.NET 4.0
3 RUNTIMESMAKES
THINGS HARD
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/ta
mb
ako
/39
74
80
93
61
/
• Unit Testing and TDD is a waste of time
• Silverlight Unit Test Framework from
Microsoft
• Silverlight Port of NUnit
• Assembly Sharing
• Other
9
13
5
12
Sales
Waste of Time
SLUT
Nunit
Other
Assembly Shar-ing
TDD IS ALL ABOUT
FLOW
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/ze
non
line/3
43
13
65
55
6/
FASTER FEEDBACK CYCLE FOR
SILVERLIGHT TDD
TDDDEMO
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/in
fom
ofo
/14
05
30
34
78
/
RESTSERVICES
WITH FLIGHT INFORMATION
http://flydata.avinor.no/http://open.bekk.no/2009/12/13/hva-skjer-nar-man-gir-bort-flydata-gratis/
http://flydata.avinor.no/XmlFeed.asp?airport=OSL<?xml version="1.0" encoding="iso-8859-1"?><airport name="OSL"> <flights lastUpdate="2010-06-14T06:29:12"> <flight uniqueID="1054121"> <airline>DY</airline> <flight_id>DY422</flight_id> <dom_int>D</dom_int> <schedule_time>2010-06-12T08:55:00</schedule_time> <arr_dep>D</arr_dep> <airport>MOL</airport> </flight> </flights></airport>
http://flydata.avinor.no/airlineNames.asp
<?xml version="1.0" encoding="iso-8859-1"?><airlineNames> <airlineName code="AA" name="American Airlines"/> <airlineName code="AAF" name="Aigle Azur"/> <airlineName code="AAG" name="Atlantic Airlines"/> <airlineName code="AAT" name="Austrian Airtransport"/> <!-- ... --></airlineNames>
http://flydata.avinor.no/airportNames.asp
<?xml version="1.0" encoding="iso-8859-1"?><airportNames> <airportName code="OSD" name="Østersund"/> <airportName code="OSH" name="Oshkosh"/> <airportName code="OSI" name="Osijek"/> <airportName code="OSK" name="Oskarshamn"/> <airportName code="OSL" name="Oslo"/> <!-- ... --></airportNames>
http://flydata.avinor.no/flightStatuses.asp
<?xml version="1.0" encoding="iso-8859-1"?><flightStatuses> <flightStatus code="N" statusTextEn="New info" /> <flightStatus code="E" statusTextEn="New time" /> <flightStatus code="D" statusTextEn="Departed" /> <flightStatus code="A" statusTextEn="Arrived" /> <flightStatus code="C" statusTextEn="Cancelled" /></flightStatuses>
ALL NETWORKING
IN SILVERLIGHT IS
ASYNCHRONOUS
RX
MAKING ASYNC
PROGRAMMING
LESS DIFFICULT
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/ad
ew
ale
_osh
ineye/3
59
01
40
05
1/
COMPOSING ASYNCHRONOU
S AND EVENT-BASED
PROGRAMS USING
OBSERVABLE COLLECTIONS
var move = Observable.FromEvent(LayoutRoot, "MouseMove");var down = Observable.FromEvent(LayoutRoot, "MouseLeftButtonDown");var up = Observable.FromEvent(LayoutRoot, "MouseLeftButtonUp");
IObservable<Point> whereUserIsDragging = move.SkipUntil(down) .TakeUntil(up) .Repeat() .Select(e => e.EventArgs.GetPosition(LayoutRoot));
whereUserIsDragging.Subscribe(p => Paint(p.X, p.Y));
RX DEMO
MVVM
PATTERN FOR BINDABLE UI
Data Model
VIEW
XAML
Code-BehindEvent
Handlers
APP LOGIC IN CODE BEHIND IS HARD TO TEST
AND MAINTAIN
Data Model
VIEW
XAML
Code-Behind
VIEW MODEL
State + Operations
Change notification
Data-binding and commands
SEPARATE USINGMVVM
COMMUNICATION
App Service
View Model
App Service View Model
View Model
View Model
View Model View Model
EVENT AGGREGATOR
App Service
App Service
View Model View Model
View Model
View Model
View Model View Model
Event Aggregator
Message
VIEW MODEL COMMUNICATION
Data Model
View
XAML
Code-Behin
d
Data Model
View
XAML
Code-Behind
Message
View Model
State + Operations
View Model
State + Operations
View
XAML
Code-Behind
View Model
State + Operations
Publish messages
Subscribe to messages
Event Aggregator
MVVM SHOULD BE LIGHT WEIGHT
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/tr
eeh
ou
se1
97
7/2
89
24
17
80
5/
http://mvvmlight.codeplex.com/
MVVM DEMO
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/2
07
92
78
7@
N0
0/2
24
86
23
39
1/
DI
KEEP THINGS SEPARATE
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/om
arr
un
/46
72
53
12
53
/in
/ph
oto
stre
am
More in-depth information:The Dependency Inversion Principle Applied
Fredrik Kalseth, Friday 10:20
DI LETS YOU INJECT
EXTERNALDEPENDENCIE
S
IMPORTANT TECHNIQUE ON WP7 TO
SIMULATE SENSORS
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/h
ow
zey/2
88
04
55
76
2/
ISOLATED STORAGE
FOR SIMPLE DATA STORAGE
NOSQLFOR WP7?
DI &ISOLATED STORAGE
DEMO
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/om
arr
un
/46
72
53
12
53
/in
/ph
oto
stre
am
METRO DESIGN
LANGUAGE
PIVOT CONTROL
HUB CONTROL
BLEND 4DEMO
LOCATION AWARENESSIS KEY WHEN
ON THE GO
SAME API IN .NET 4 &
WP7
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/p
hoto
gra
ham
/19
83
24
03
1/
LOCATION AWARENESS
DEMO
PUSH NOTIFICATIONS
KEEP YOU INFORMED
WP7 PUSH NOTIFICATIONS
Microsoft Push
Notification
Services
Your Web Applicatio
n
PUSH CLIENT
Notification Namespaces
Push Library
Your WP Application
1Open Channel
2 Hand off channel
URL
3 Pushmessage
4Push message
PUSH NOTIFICATION
S DEMO
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/ko
zlosk
i/2
30
65
10
52
0/
SUMMARY:- TDD- RX & ASYNC- MVVM & IOC- BLEND 4- LOCATION- NOTIFICATION
htt
p:/
/ww
w.fl
ickr
.com
/ph
oto
s/2
07
92
78
7@
N0
0/2
24
86
23
39
1/
FORK ME ON GITHUB
http://github.com/follesoe/FlightsNorway