1 / 47

Build for both: Windows and Windows Phone

Build for both: Windows and Windows Phone. Matt Hidinger Clarity Consulting 2-215. So umm… you’re not with Microsoft?. Clarity Consulting Windows Phone Dev MVP. But first… a phone!. Sharing. Design for both Develop for both Architecture & patterns. Image credit: Jason Emprey.

chyna
Download Presentation

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 Matt Hidinger Clarity Consulting 2-215

  2. So umm… you’re not with Microsoft? • Clarity Consulting • Windows Phone Dev MVP

  3. But first… a phone!

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

  5. Real-world stocks

  6. Design for both

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

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

  9. Landing pages

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

  11. Lists of data

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

  13. App bars

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

  15. Back buttons

  16. On device On screen

  17. My personal favorite

  18. Inspiration is everywhere • Design is more than the appearance • Tune the experience and use cases for the form factor • Pay attention to the details, modern design isn’t lack of design

  19. Develop for both

  20. Sharing an assembly

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

  22. Demo • Portable Class Library

  23. Sharing source code

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

  25. Linked files

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

  27. Demo • Linked Files

  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. Demo • Compiler Directives

  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. Demo • Building real-world stocks

  35. Summary

  36. 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)

  37. 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

  38. Beneficial frameworks MVVM Caliburn.Micro MVVM Light • Portable • HttpClient • PCLStorage • MetroLog

  39. Try it yourself! • Download the full source for this talk in a few days • http://bit.ly/BuildRealWorldStocks

  40. Related sessions • Story of Nokia Music, from Windows Phone to Windows Store2-219 – Matthew Cooper – North 134 – 30 minutes from now! • Windows Phone Development Best Practices2-216 – Stefan Wick – North 134 – Friday @ 10:30 AM • MVVM In Action – Hulu Case Study2-205 – Matthias Shapiro – North 134 – Friday @ 12:00 PM

  41. 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

  42. Drinks and appetizers provided • Sharing code meet-up! • Join other speakers and Microsoft employees to talk about sharing • Today @ 6 PM • Microsoft Office • 835 Market Street, Suite 700

  43. Thank you!Q&A • @MattHidinger

  44. Required Slide *delete this box when your slide is finalized Your MS Tag will be inserted here during the final scrub. Evaluate this session • Scan this QR codeto evaluate this session and be automatically entered in a drawing to win a prize!

More Related