an overview of the windows phone 7 platform

73
Windows Phone 7 Jonas Follesø BEKK Avdelingsmøte 02. Desember 2010

Upload: jonas-folleso

Post on 14-Dec-2014

530 views

Category:

Documents


5 download

DESCRIPTION

This presentation gives an overview of the whole Windows Phone 7 platform. It was given at an internal BEKK meeting in December 2010.

TRANSCRIPT

Page 1: An overview of the Windows Phone 7 platform

Windows Phone 7

Jonas Follesø

BEKK Avdelingsmøte 02. Desember 2010

Page 2: An overview of the Windows Phone 7 platform

ABOUT ME

JONAS FOLLESØ[email protected]

http://jonas.follesoe.no

@follesoe

Page 3: An overview of the Windows Phone 7 platform

AGENDA:- WP7 PLATFORM- PHONE APIs- BLEND 4- MARKET PLACE- TDD- RUBY- DEMOS!

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/2

07

92

78

7@

N0

0/2

24

86

23

39

1/

Page 4: An overview of the Windows Phone 7 platform
Page 5: An overview of the Windows Phone 7 platform

WINDOWS PHONE 7

A FRESH START!

Page 6: An overview of the Windows Phone 7 platform

XNA FOR GAMES

SILVERLIGHT FOR APPS

Page 7: An overview of the Windows Phone 7 platform

KNOW SILVERLIGHT?

THEN YOU KNOW WP7!

Page 8: An overview of the Windows Phone 7 platform

HELLO WORLD

DEMO

Page 9: An overview of the Windows Phone 7 platform

METRO DESIGN

LANGUAGE

Page 10: An overview of the Windows Phone 7 platform
Page 11: An overview of the Windows Phone 7 platform
Page 12: An overview of the Windows Phone 7 platform
Page 13: An overview of the Windows Phone 7 platform
Page 14: An overview of the Windows Phone 7 platform
Page 15: An overview of the Windows Phone 7 platform
Page 16: An overview of the Windows Phone 7 platform
Page 17: An overview of the Windows Phone 7 platform
Page 18: An overview of the Windows Phone 7 platform

BLEND 4DEMO

Page 19: An overview of the Windows Phone 7 platform
Page 20: An overview of the Windows Phone 7 platform
Page 21: An overview of the Windows Phone 7 platform
Page 22: An overview of the Windows Phone 7 platform

METRO RESOURCES

• Windows Phone 7 Metro Design UI Book PDF - http://bit.ly/fFPDzw

• UI Design and Interaction Guide for Windows Phone 7 v2.0 - http://bit.ly/b2SUlh

• Design Templates for Windows Phone 7 - http://bit.ly/cNQO8j

Page 23: An overview of the Windows Phone 7 platform

LAUNCHERS & CHOOSERS

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/m

ad

_hou

se_p

hoto

gra

ph

y/

44

40

87

13

80

/

• CameraCaptureTask• EmailAddressChooserTask• EmailComposeTask• MarketplaceDetailTask• MarketplaceHunTask• MarketplaceReviewTask• MarketplaceSearchTask• MediaPlayerLauncher• PhoneCallTask• PhoneNumberChooserTask• PhotoChooserTask• SaveEmailAddressTask• SavePhoneNumberTask• SearchTask• SmsComposeTask• WebBrowserTask

Page 24: An overview of the Windows Phone 7 platform

LAUNCH BUILT IN APP WITH SOME DATA

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/2

86

34

33

2@

N0

5/4

05

47

66

77

0/

Page 25: An overview of the Windows Phone 7 platform

private void smsCompose_Click(object sender, RoutedEventArgs e){ var smsCompose = new SmsComposeTask(); smsCompose.To = "97706660"; smsCompose.Body = "Hello NNUG!"; smsCompose.Show();}

Page 26: An overview of the Windows Phone 7 platform

LAUNCH BUILT IN APP TO CHOOSE

SOME DATA

Page 27: An overview of the Windows Phone 7 platform

private void choose_Click(object sender, RoutedEventArgs e){ var emailChooser = new EmailAddressChooserTask(); emailChooser.Completed += emailChooser_Completed; emailChooser.Show();}

private void emailChooser_Completed(object sender, EmailResult e){ if(e.TaskResult == TaskResult.OK) email.Text = e.Email;}

Page 28: An overview of the Windows Phone 7 platform

CHOSER & LAUCHER

DEMO

Page 29: An overview of the Windows Phone 7 platform

EXECUTION MODEL &

TOMBSTONING

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/9

81

09

48

@N

05

/15

83

50

67

87

/

Page 30: An overview of the Windows Phone 7 platform

NO MULTI TASKING

BUT...

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/n

3p

tun

3r/

33

76

69

74

90

/

Page 31: An overview of the Windows Phone 7 platform

FAST ACTIVATION &

DEACTIVATION

GIVES IMPRESSION OF

APP RUNNING IN

BACKGROUND

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/ci

rox/3

63

28

41

94

/

Page 32: An overview of the Windows Phone 7 platform

THE 4 EVENTS OF THE APP LIFE CYCLE

Application_LaunchingApplication_DeactivatedApplication_ActivatedApplication_Closing

Page 33: An overview of the Windows Phone 7 platform

Launching Running

Closing Deactivating Activating

Chooser/Task/Other

Page 34: An overview of the Windows Phone 7 platform

PERSISTENT DATA

• Data shared by all instances of app

• Save and loaded from Isolated Storage

• Load on start-up, save on user action or when closing

Page 35: An overview of the Windows Phone 7 platform

TRANSIENT STATE

• Data for instance of application

• Stored in State Dictionary

• App or Page level state

Page 36: An overview of the Windows Phone 7 platform

PAGE STATE• Poisition of ScollViewer• Content of TextBox• State of other UI elements

• Managed by State property on Page object

• OnNavigatedTo & OnNavigatedFrom

Page 37: An overview of the Windows Phone 7 platform

protected override void OnNavigatedFrom(NavigationEventArgs e){ State.Add("VerticalOffset", scrollView.VerticalOffset); State.Add("HorizontalOffset", scrollView.HorizontalOffset);}

Page 38: An overview of the Windows Phone 7 platform

protected override void OnNavigatedTo(NavigationEventArgs e){ if(State.ContainsKey("VerticalOffset") && State.ContainsKey("HorizontalOffset")) { scrollView.ScrollToVerticalOffset( Convert.ToDouble(State["VerticalOffset"]));

scrollView.ScrollToHorizontalOffset( Convert.ToDouble(State["HorizontalOffset"])); }}

Page 39: An overview of the Windows Phone 7 platform

APP STATE• State not associated with

spesific page

• Managed by State property on PhoneApplicationService

Page 40: An overview of the Windows Phone 7 platform

private void Application_Deactivated(object sender, DeactivatedEventArgs e){ var viewModel = (ViewModel)RootFrame.DataContext; PhoneApplicationService.Current.State .Add("ExpenceReport", viewModel);}

Page 41: An overview of the Windows Phone 7 platform

private void Application_Launching(object sender, LaunchingEventArgs e){ if(StorageHelper.FileExists("ExpenceReport.xml")) { var viewModel = StorageHelper.Load<ViewModel>("ExpenceReport.xml"); viewModel.IsDirty = false; RootFrame.DataContext = viewModel; } else { RootFrame.DataContext = new ViewModel(); }}

Page 42: An overview of the Windows Phone 7 platform

APP MODEL DEMO

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/n

3p

tun

3r/

33

76

69

74

90

/

Page 43: An overview of the Windows Phone 7 platform

Launching Running

Closing Deactivating Activating

Chooser/Task/Other

Page 44: An overview of the Windows Phone 7 platform

PUSH NOTIFICATIONS

WHEN APP IS NOT RUNNING

Page 45: An overview of the Windows Phone 7 platform

TWO TYPES OF

NOTIFICATIONS

Page 46: An overview of the Windows Phone 7 platform

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

Page 47: An overview of the Windows Phone 7 platform

private void open_Click(object sender, RoutedEventArgs e){ var channel = HttpNotificationChannel.Find("NNUG");

if (channel == null) { channel = new HttpNotificationChannel("NNUG"); }

channel.ChannelUriUpdated += channel_ChannelUriUpdated; channel.ShellToastNotificationReceived += channel_ShellToastNotificationReceived; channel.Open();}

Page 48: An overview of the Windows Phone 7 platform

private void channel_ShellToastNotificationReceived

(object sender, NotificationEventArgs e){ foreach (var text in e.Collection) output.Text += text + "\r\n";}

Page 49: An overview of the Windows Phone 7 platform

PUSH NOTIFICATION

S FOR TILES

Page 50: An overview of the Windows Phone 7 platform

PUSH NOTIFICATION

S DEMO

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/ko

zlosk

i/2

30

65

10

52

0/

Page 51: An overview of the Windows Phone 7 platform

ISOLATED STORAGE

FOR SIMPLE DATA STORAGE

Page 52: An overview of the Windows Phone 7 platform

NOSQL?NO PROBLEM!

Page 53: An overview of the Windows Phone 7 platform

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

Page 54: An overview of the Windows Phone 7 platform

ACCELEROMETER

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/h

ow

zey/2

88

04

55

76

2/

Page 55: An overview of the Windows Phone 7 platform

var acc = new Accelerometer(); acc.ReadingChanged += acc_ReadingChanged;

private void acc_ReadingChanged (object sender, AccelerometerReadingEventArgs e){ double x = e.X; double y = e.Y; double z = e.Z;}

Page 56: An overview of the Windows Phone 7 platform

LOCATION AWARENESSIS KEY WHEN

ON THE GO

Page 57: An overview of the Windows Phone 7 platform

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/

Page 58: An overview of the Windows Phone 7 platform

private void start_Click(object sender, System.Windows.RoutedEventArgs e){ var watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High); watcher.PositionChanged += watcher_PositionChanged; watcher.Start();}

private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e){ var location = e.Position.Location; var lat = location.Latitude; var lon = location.Longitude;}

Page 59: An overview of the Windows Phone 7 platform

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

/

Page 60: An overview of the Windows Phone 7 platform

SAME SILVERLIGHT

UNIT TESTING FRAMEWORK

ON WP7

Page 61: An overview of the Windows Phone 7 platform

FLIGHTS NORWAY

MONITORARRIVALS AND

DEPARTURES

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/sv

en

werk

/2

18

18

49

28

0/

Page 62: An overview of the Windows Phone 7 platform

RESTSERVICES

WITH FLIGHT INFORMATION

http://flydata.avinor.no/http://open.bekk.no/2009/12/13/hva-skjer-nar-man-gir-bort-flydata-gratis/

Page 63: An overview of the Windows Phone 7 platform

FLIGHTS NORWAY

DEMO

Page 64: An overview of the Windows Phone 7 platform

RUBY ON WP7• IronRuby runs on WP7

• Bases on Silverlight & DLR

• Some limitations:• No Reflection.Emit• No Gems• And probably many

more...

Page 65: An overview of the Windows Phone 7 platform

IronRuby on WP7 DEMO

Page 66: An overview of the Windows Phone 7 platform

MARKET PLACE

• Not available in Norway on launch... but you can Publish Apps

• 99$ for membership

• 30/70 splitt

Page 67: An overview of the Windows Phone 7 platform

TILE FLOOD

Page 68: An overview of the Windows Phone 7 platform

TILE FLOOD

Page 69: An overview of the Windows Phone 7 platform

TILE FLOODDEMO

Page 70: An overview of the Windows Phone 7 platform
Page 71: An overview of the Windows Phone 7 platform

SUMMARY:- WP7 PLATFORM- PHONE APIs- TDD- BLEND 4- RUBY- DEMOS!

htt

p:/

/ww

w.fl

ickr

.com

/ph

oto

s/2

07

92

78

7@

N0

0/2

24

86

23

39

1/

Page 72: An overview of the Windows Phone 7 platform

FORK ME ON GITHUB

http://github.com/follesoe/

/FlightsNorway/DynamicWP7

/MSDNLiveOctober2010

Page 73: An overview of the Windows Phone 7 platform

BEKK CONSULTING ASSKUR 39, VIPPETANGEN. P.O. BOX 134 SENTRUM, 0102 OSLO, NORWAY.

WWW.BEKK.NO

Jonas FollesøSenior Consultant+47 977 06660

[email protected]@follesoe.no