1 / 42

Build for both: Windows and Windows Phone

Build for both: Windows and Windows Phone. Tim Chaffee. Inspired by and created from Build talk by: Matt Hidinger. http://channel9.msdn.com/Events/Build/2013/2-215. Who is Tim Chaffee?. Developer Consultant Hardware (toys) enthusiast tchaffee@darktowerconsulting.com @ TimChaffee.

orea
Télécharger la présentation

Build for both: Windows and Windows Phone

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Build for both: Windows and Windows Phone Tim Chaffee

  2. Inspired by and created fromBuild talk by: Matt Hidinger http://channel9.msdn.com/Events/Build/2013/2-215

  3. Who is Tim Chaffee? Developer Consultant Hardware (toys) enthusiast tchaffee@darktowerconsulting.com @TimChaffee

  4. Sharing • Design for both • Develop for both • Architecture & patterns Image credit: Jason Emprey

  5. OpenWeather (openweathermap.org + bing maps)

  6. Real-world stocks

  7. Design for both

  8. C#.NETXAMLWinRT • What do they have in common? • Same design language

  9. Form factors, mostly Windows 1024x768 …to… 3200x1800+ ??? • Windows Phone • 800x480 • 1280x768 • 1280x1024 • ??? • How do they differ?

  10. Landing pages

  11. GridView Panorama Grouped by section Horizontal scrolling PanoramaItem per section Horizontal and vertical scrolling

  12. Lists of data

  13. LongListSelector GridView Horizontal scrolling Optionally grouped Semantic zoom to quickly navigate Vertical scrolling Optionally grouped Jump list to quickly navigate

  14. App bars

  15. ApplicationBar AppBar Top and Bottom Supports circular buttons And/or any content you want Bottom only Supports circular buttons And/or menu items

  16. Back buttons

  17. On device On screen

  18. Good Design takes work and planning • Design is more than the appearance • Tune the experience and use cases for the form factor • Pay attention to the details, the better designed apps will get more usage

  19. Shameless Plug • BuzzWord

  20. Develop for both

  21. Sharing an assembly

  22. Portable Class Libraries • One Source • One Project • One Binary • Multiple Platforms!

  23. What is supported? NUGET

  24. Sharing source code

  25. When? XAML -C -V • Ctrl • Ctrl Image credit: http://quickmeme.com

  26. Linked files

  27. Linked files • Hold Alt and drag a folder to link multiple files at once! Windows Phone Windows

  28. Compiler directives Windows • #if NETFX_CORE • Dispatcher.RunAsync(CoreDispatcherPriority.Normal, myAction); • #endif Windows phone #if WINDOWS_PHONE Deployment.Current.Dispatcher.BeginInvoke(myAction); #endif

  29. Interfaces

  30. Comparison • Sharing an assembly (PCL) •  • Code remains clean and single purpose • Build, test, compile once •  • Limited API access • Can’t reference non-PCL assemblies • Won’t work with Express SKUs Sharing source code (linked files)  Full API access on the platform compiling it Can tweak source per platform using #if  Code can become complex due to compiler directives Minor Visual Studio quirks: “This document is already open” TL;DR: use them both

  31. Use your skills, Luke • You know C# • You know .NET • You know and love XAML (right?)

  32. Architecture & patterns

  33. ????? Linked

  34. Summary

  35. What to share? User Interface üStatic assets üDesign language XAML: Not right now Linked source üConverters üCommands ✋Controls (if it makes sense) ✋View Models (if it makes sense) PCL üModels üBusiness logic üWeb Services üHelpers üLogging ✋View Models (if it makes sense) ✋Commands (if it makes sense)

  36. Mix and match techniques • Architect with sharing in mind • Put as much into a PCL as possible • Use a platform adapter to Do More in Core • Use #if conditions for minor code differences • Extension methods can bridge missing APIs • Maximize the user experience for each platform Image credit: Daniel E Lee

  37. Beneficial frameworks MVVM MVVM Light MVVM Cross • Portable • HttpClient • Json.NET • ZXing

  38. Try it yourself! • http://channel9.msdn.com/Events/Build/2013/2-215 • http://bit.ly/BuildRealWorldStocks

  39. What about that other “platform” • http://xamarin.com XamariniOS Xamarin Android

  40. References • Daniel Plaisted - Making Portable Libraries Work For You • Matthias Shapiro – TechEd 2013, Build It Once For Both • RajenKishna's Technical Tidbits • Doug Holland - Sharing Code, MSDN Magazine • @dotMorten – Code Sharing Wizard

  41. Thank you!Q&A • @TimChaffee

  42. Sphero http://www.gosphero.com/Discount Code: FloridaNETDev

More Related