Windows Phone 7 and Silverlight

2,049 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,049
On SlideShare
0
From Embeds
0
Number of Embeds
37
Actions
Shares
0
Downloads
34
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Windows Phone 7 and Silverlight

  1. 1. Glen Gordon<br />Developer Evangelist, Microsoft<br />http://blogs.msdn.com/glengordon<br />@glengordon<br />Building Windows Phone 7 Apps with Silverlight<br />
  2. 2. Agenda<br />Silverlight Momentum<br />Development Experience<br />Phone Controls<br />Web Browser Control<br />App Bar<br />Navigation<br />Launchers and Choosers<br />Application Lifecycle<br />
  3. 3. Agenda<br />Silverlight Momentum<br />XAML Fundamentals<br />Development Experience<br />Phone Controls<br />Q&A<br />….with lots of demos!<br />
  4. 4. Silverlight Momentum<br />
  5. 5. Silverlight 1<br />September 2007<br />
  6. 6. Silverlight 2<br />October 2008<br />Silverlight 1<br />September 2007<br />
  7. 7. Silverlight 3<br />July 2009<br />Silverlight 1<br />Silverlight 2<br />September 2007<br />October 2008<br />
  8. 8. Silverlight 4<br />Business Applications<br />Media<br />Beyond the Browser<br />Silverlight 1<br />Silverlight 2<br />Silverlight 3<br />Silverlight 4<br />September 2007<br />October 2008<br />July 2009<br />April 2010<br />
  9. 9. 60%<br />RIAStats.com<br />
  10. 10. 225%<br />Simplyhired.com<br />
  11. 11. Development Experience<br />
  12. 12. Windows Phone 7 Framework<br />Windows Phone Frameworks<br />Camera<br />Device Integration<br />Launchers & Choosers<br />Windows Phone Controls<br />PhoneApplicationPage<br />PushNotification<br />WebBrowserControl<br />Sensors<br />PhoneApplicationFrame<br />Silverlight Presentation and Media<br />XNA Frameworks for Games<br />Controls<br />Drawing<br />IsolatedStorage<br />Drawing<br />GamerServices<br />Navigation<br />Shapes<br />Markup<br />Media<br />Audio<br />Media<br />Graphics<br />Content<br />Input<br />Application Object<br />Common Base Class Library<br />Diagnostics<br />Reflection<br />IO<br />Runtime<br />Resources<br />Globalization<br />Text<br />Location<br />Net<br />Collections<br />ComponentModel<br />Configuration<br />Security<br />Threading<br />ServiceModel<br />Linq<br />
  13. 13. Graphics Composition<br />Start Experience<br />System Tray<br />Direct3D Surface<br />AppPage<br />Notification<br />Volume<br />SIP<br />Incoming Call<br />App Bar<br />Shell frame composes all UI into a single screen<br />Central page management enables cross app UI transitions and other effects<br />You can also do this for orientation changes<br />
  14. 14. UI Model: Familiar Web Concepts<br />Phone application<br />Provides UI represented as XAML pages connected into cross-app flows by URI’s<br />Web application<br />Provide media represented as HTTP resources linked by URL’s<br />Shell frame<br />Requests pages, renders UI, and handles navigation across apps<br />Web browser<br />Requests HTTP resources, renders them, and handles navigation across sites<br />Sessions and back stack<br />Groups together sequences of pages corresponding to a user’s activity across apps<br />History and tabs<br />Groups together sequences of HTTP resources corresponding to a user’s activity across sites<br />
  15. 15. Phone Controls<br />
  16. 16. Silverlight Controls<br />Rich Set of Controls<br />Familiar <br />Additional features<br />For example, Software Input Panel (SIP) support on TextBox<br />16<br />
  17. 17. Supported<br />Border<br />Button<br />Canvas<br />CheckBox<br />Grid<br />HyperlinkButton<br />Image<br />ListBox<br />MediaElement<br />Messagebox<br />ProgressBar<br />RadioButton<br />ScrollViewer<br />TextBlock<br />TextBox<br />WebBrowser<br />
  18. 18. Controls support Touch<br />Mouse Events <br />Automatically converted for you<br />SIP and WebBrowser control have gestures<br />ScrollViewer<br />Just like Silverlight<br />Basic Flick and Pan gestures<br />Raw <br />Touch.FrameRendered<br />DoodlePad – Sketch App<br />
  19. 19. Controls support Touch<br />Gestures <br />System level (WM_GESTURE). Can make your own.<br />Tap, Double Tap, Pan, Flick, Touch and Hold <br />Multi-Touch<br />Pinch, Stretch<br />Manipulations<br />Events<br />ManipulationStarted<br />ManipulationData<br />ManipulationCompleted<br />Use for Drag and Drop, etc.<br />
  20. 20. DEMO – Controls<br />
  21. 21. List Application<br />Master/Detail Data<br />MainPage.Xaml, DetailsPage.xaml<br />ViewModel<br />ItemViewModel.cs, MainViewModel.cs<br />Project Types<br />VS2010 calls it List Application and Blend calls it Databound Application<br />
  22. 22. DEMO – List Application<br />
  23. 23. WebBrowser control<br />Displays network and local content<br />Gestures: pan, double tap and pinch<br />Supports transforms & projections<br />No Input on transform <br />Application can interact with JavaScript<br />Optimized for privacy<br />Script is disabled by default<br />Cookies and cache are isolated<br />23<br />
  24. 24. Silverlight to Script<br />Silverlight<br />string fromScript = wb.InvokeScript("runScriptStuff", arg1, arg2);<br />JavaScript<br />function runScriptStuff(arg1, arg2)<br />{ return “awesome”; }<br />
  25. 25. Script to Silverlight <br />Silverlight<br />void wb_ScriptNotify(object s, NotifyEventArgs e)<br />{<br /> string fromScript = e.Value;<br />}<br />JavaScript<br />Window.external.Notify(string);<br />
  26. 26. DEMO – Web Browser <br />
  27. 27. AppBar<br />Toolbar<br />Up to 4 icons<br />Can set transparency level<br />Slide up Menu can display more items<br />Can declare in code or XAML<br />Icons found under Program FilesMicrosoft SDKsWindows Phonev7.0Icons<br />
  28. 28. AppBar<br />Icons<br />48 pixels by 48 pixels <br />White foreground on a transparent background <br />Using alpha channel.<br />Icon get colorized to current style<br />Circle will be added<br />
  29. 29. DEMO – AppBar<br />
  30. 30. Frame and Page<br />Frame<br />Top-level container control<br />PhoneApplicationFrame class<br />Contains the page control and system elements such as system tray and application bar<br />Page<br />Fills the entire content region of the frame<br />PhoneApplicationPage-derived class<br />Optionally surfaces its own application bar<br />Handles Orientation <br />NavigatedTo and NavigatedFrom<br />
  31. 31. Page Navigation<br />Forward<br />NavigationService.Navigate(new Uri(“/Page2.xaml”,uriKind.RelativeOrAbsolute));<br />Back<br />NavigationService.GoBack();<br />Hardware Back Button<br />Handle BackKeyPress, OnBackKeyPressand Navigate to where you would like<br />
  32. 32. DEMO – Navigation<br />
  33. 33. Tasks - Launchers and Choosers<br />Launcher<br />Launches one of the built-in applications through which a user completes a task<br />No data is returned to calling application<br />Example: PhoneCallTask<br />Chooser<br />Launches one of the built-in applications through which a user completes a task, and which returns some data to calling application<br />When caller completes, calling application is activated and supplied with the Chooser result<br />Example: PhotoChooserTask<br />
  34. 34. Launchers & Choosers<br />Launchers<br />EmailComposeTask<br />MarketplaceDetailTask<br />MarketplaceHubTask<br />MarketplaceReviewTask<br />MarketplaceSearchTask<br />MediaPlayerLauncher<br />PhoneCallTask<br />SearchTask<br />SMSComposeTask<br />WebBrowserTask<br />Choosers<br />CameraCaptureTask<br />EmailAddressChooserTask<br />PhoneNumberChooserTask<br />PhotoChooserTask<br />SaveEmailAddressTask<br />SavePhoneNumberTask<br />
  35. 35. DEMO – Tasks<br />
  36. 36. UI and State Management: Concepts<br />Page UI<br />Describes the visual appearance of a page<br />Retained in shell frame to support resuming paused sessions<br />Discarded while the session is paused<br />Page State<br />Contains data that describes an instance of a page, analogous to browser cookie<br />
  37. 37. App Lifecycle<br />Close<br />Back Button<br />Tombstoned<br />Start Button<br />Task Launched<br />Phone call received<br />Handle events in App.xaml.cs<br />
  38. 38. App State - Storage<br />Isolated Storage<br />Settings and Custom Data<br />Secure and Sandboxed<br />Logical Folder Structure via APIs<br />No quota currently<br />Be responsible and inform/empower user<br />State Management<br />PhoneApplicationPage/PhoneApplicationState<br />Good for transient data<br />
  39. 39. Isolated Storage API<br />Using System.IO;using System.IO.IsolatedStorage;IsolatedStoragefileisf = IsolatedStorageFile.GetUserStoreForApplication();<br />IsolatedStorageFileStreamfs = new IsolatedStorageFileStream(“myfile.txt”,FileMode.Open,isf);<br />StreamReadersr = new StreamReader(fs);<br />data=sr.ReadLine();<br />sr.Close();<br />
  40. 40. DEMO – Lifecycle<br />
  41. 41. Web Services<br />
  42. 42. Calling a Service<br />WebClient Class<br />Just like Silverlight<br />WebClient client = new WebClient(); client.DownloadStringCompleted += DownloadComplete; client.DownloadStringAsync(new Uri(RssUrl));<br />oData Library<br />oData.org<br />Covered this afternoon<br />
  43. 43. DEMO 9 – Netflix Web Service<br />
  44. 44. Q&A and Break<br />
  45. 45. © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.<br />The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. <br />MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.<br />

×