Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Developing for Windows Phone 8 and Windows 8


Published on

Published in: Technology
  • Be the first to comment

Developing for Windows Phone 8 and Windows 8

  1. 1. October 1st 2012Cross DevelopmentWindows 8 andWindows Phone 8Dave BostTechnical Evangelist, Windows Phone
  2. 2. 30 Days to Launch Launch your App or Game in 30 days Generation App  Online training and tips from insiders  App and Game dev content  Tele-support with a Windows 8 architect  Exclusive one-on-one WinRT and Windows UX design consultation
  3. 3. Best Practices for Windows 8 / Windows Phone 8• Linked files• #if conditionals• Using Extension methods to bridge implementation differences• MVVM• Portable Class Libraries• A common user experience bringing high-quality experiences to the user.3 Microsoft confidential 12/6/2012
  4. 4. Common Structure Windows 8 Windows Phone 84 Microsoft confidential 12/6/2012
  5. 5. Common APIs inWindows 8 andWindows Phone 8
  6. 6. Windows Phone 8 Developer Platform XAML Apps Direct3D Apps In-App XAML Maps Geolocation Sensors Direct3D Purchase HTML XML Threading Touch Speech XAudio2Your apps Phone Features Push Camera Video Proximity Media FoundationYour way Calendar Wallet Contacts Core Types VoIP STL Multitasking Live Tiles Memory Async Enterprise CRT C# and VB C#, VB, and C++ C++ File system, Networking, Graphics, Media Core Operating System
  7. 7. “Add as Link”7 Microsoft confidential 12/6/2012
  8. 8. “Add as Link”Windows 8 Windows Phone 88 Microsoft confidential 12/6/2012
  9. 9. Common APIsCommon DifferentBase Class Library Launchers and ChoosersHardware Sharing APIsStorage (Files and Folders)9 Microsoft confidential 12/6/2012
  10. 10. #if Conditional BlocksWindows 8 #if NETFX_CORE Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { #endifWindows Phone 8 #if WINDOWS_PHONE Deployment.Current.Dispatcher.BeginInvoke(() => { #endif10 Microsoft confidential 12/6/2012
  11. 11. ThreadingWindows 8 AND Windows Phone 8 #if NETFX_CORE Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { #else Deployment.Current.Dispatcher.BeginInvoke(() => { #endif double _accelX = args.Reading.AccelerationX; double _accelY = args.Reading.AccelerationY;11 Microsoft confidential 12/6/2012
  12. 12. Web Service12 Microsoft confidential 12/6/2012
  13. 13. HttpWebResponse and HttpWebRequestWindows 8 var request = (HttpWebRequest)WebRequest.Create(autoCompleteUri); HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync(); // retrieve data using StreamReader13 Microsoft confidential 12/6/2012
  14. 14. HttpWebResponse and HttpWebRequestWindows Phone 8 var request = (HttpWebRequest)WebRequest.Create(autoCompleteUri); request.BeginGetResponse(new AsyncCallback(AutoCompleteCallback), request); } private void AutoCompleteCallback(IAsyncResult callback) { HttpWebRequest request = (HttpWebRequest)callback.AsyncState; HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(callback); // retrieve data using StreamReader }14 Microsoft confidential 12/6/2012
  15. 15. Convergence throughExtension
  16. 16. Extension MethodsWindows Phone 8 HttpWebRequest Extensionpublic static Task<HttpWebResponse> GetResponseAsync(this HttpWebRequest request){ var taskComplete = new TaskCompletionSource<HttpWebResponse>(); request.BeginGetResponse(asyncResponse => { HttpWebRequest responseRequest = (HttpWebRequest)asyncResponse.AsyncState; HttpWebResponse someResponse = (HttpWebResponse)responseRequest.EndGetResponse(asyncResponse); taskComplete.TrySetResult(someResponse); }, request); return taskComplete.Task;}16 Microsoft confidential 12/6/2012
  17. 17. HttpWebResponse and HttpWebRequestWindows 8 AND Windows Phone 8 var request = (HttpWebRequest)WebRequest.Create(autoCompleteUri); HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync(); // retrieve data using StreamReader17 Microsoft confidential 12/6/2012
  18. 18. Convergence throughArchitecture
  19. 19. Model-View-ViewModel (MVVM)
  20. 20. Portable Class Libraries
  21. 21. Cross-platform app architecture
  22. 22. UI Differences and XAML24 Microsoft confidential 12/6/2012
  23. 23. Different Form Factors Require Different UXWindows Phone 8 Windows 8Screen Size Screen Size800x480 1024x7681280x720 2,560x1,4401280x768 everything in between25 Microsoft confidential 12/6/2012
  24. 24. Different Form Factors Require Different UXWindows Phone 8 Windows 8Orientation OrientationPortrait PortraitLandscape Landscape Snapped26 Microsoft confidential 12/6/2012
  25. 25. Different Controls GridView Group-able Array of Tiles Dynamic item size27 Microsoft confidential
  26. 26. Different Controls FlipView Browsing View Touch-optimized for left-right navigation28 Microsoft confidential
  27. 27. Different Form Factors Require Different UX Panorama Introduction and exploratory content30 Microsoft confidential
  28. 28. Different Form Factors Require Different UX Pivot Scanning views Grouped information31 Microsoft confidential
  29. 29. Different Form Factors Require Different UX LongListSelector Headers and Footers Group header navigation32 Microsoft confidential
  30. 30. Different Form Factors Require Different UXGridView  LongListSelector35 Microsoft confidential
  31. 31. Summary
  32. 32. Windows 8 / Windows Phone 8 Apps Are a Perfect Match• Abstracting Models, ViewModels • Binding data to the View • Linked files • Models, Services could be encapsulated in Portable Class Libraries• Shared APIs (hardware, storage, base class libraries)• Using #if conditionals for small code differences• Using Extension methods to bridge implementation differences • Async-await model for HttpWebResponse/Request• Focus on the user experience that works for the form factor37 Microsoft confidential 12/6/2012
  33. 33. The information herein is for informational interpreted to be a commitment on the part ofpurposes only an represents the current view of Microsoft, and Microsoft cannot guarantee theMicrosoft Corporation as of the date of this accuracy of any information provided after thepresentation. Because Microsoft must respond date of this changing market conditions, it should not beMICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATIONIN THIS PRESENTATION.© 2012 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.