Download presentation
Presentation is loading. Please wait.
Published byChristine Meryl Bates Modified over 6 years ago
2
Build for both: Windows and Windows Phone
Matt Hidinger Clarity Consulting 2-215
3
So umm… you’re not with Microsoft?
Clarity Consulting Windows Phone Dev MVP
4
But first… a phone!
5
Sharing Design for both Develop for both Architecture & patterns
Image credit: Jason Emprey
6
Real-world stocks
7
Design for both
8
What do they have in common?
Windows Phone C# .NET XAML WinRT Windows Same design language
9
How do they differ? Form factors, mostly Windows Phone 800x480
10
Landing pages
11
GridView Panorama Grouped by section Horizontal scrolling
PanoramaItem per section Horizontal and vertical scrolling
12
Lists of data
13
GridView LongListSelector Horizontal scrolling Optionally grouped
Semantic zoom to quickly navigate Vertical scrolling Optionally grouped Jump list to quickly navigate
14
App bars
15
AppBar ApplicationBar 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 screen On device
18
My personal favorite
20
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
21
Develop for both
22
Sharing an assembly
23
Portable Class Libraries
One Source One Project One Binary Multiple Platforms!
24
Demo Portable Class Library
25
Sharing source code
26
When? XAML Ctrl -C -V Image credit:
27
Linked files
28
Linked files Windows Phone Windows Hold Alt and drag a folder to link multiple files at once!
29
Demo Linked Files
30
Compiler directives Windows Windows phone
#if NETFX_CORE Dispatcher.RunAsync(CoreDispatcherPriority.Normal, myAction); #endif Windows phone #if WINDOWS_PHONE Deployment.Current.Dispatcher.BeginInvoke(myAction); #endif
31
Demo Compiler Directives
32
TL;DR: use them both 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
33
Use your skills, Luke You know C# You know .NET
You know and love XAML (right?)
34
Architecture & patterns
35
Windows Phone Windows Linked App Startup / Lifecycle Views Controls
Converters ViewModels Windows App Startup / Lifecycle Views Controls Converters ViewModels Linked Portable Class Library CoreViewModels Services Models
36
Demo Building real-world stocks
37
Summary
38
What to share? PCL Linked source User Interface ü Models
ü Business logic ü Web Services ü Helpers ü Logging ✋ View Models (if it makes sense) ✋ Commands (if it makes sense) Linked source ü Converters ü Commands ✋ Controls (if it makes sense) ✋ View Models (if it makes sense) User Interface ü Static assets ü Design language XAML: Not right now
39
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
40
Beneficial frameworks
Portable HttpClient PCLStorage MetroLog MVVM Caliburn.Micro MVVM Light
41
Try it yourself! Download the full source for this talk in a few days
42
Related sessions Story of Nokia Music, from Windows Phone to Windows Store – Matthew Cooper – North 134 – 30 minutes from now! Windows Phone Development Best Practices – Stefan Wick – North 134 – 10:30 AM MVVM In Action – Hulu Case Study – Matthias Shapiro – North 134 – 12:00 PM
43
References Daniel Plaisted - Making Portable Libraries Work For You
Matthias Shapiro – TechEd 2013, Build It Once For Both Rajen Kishna's Technical Tidbits Doug Holland - Sharing Code, MSDN Magazine @dotMorten – Code Sharing Wizard
44
Drinks and appetizers provided
Sharing code meet-up! Drinks and appetizers provided Join other speakers and Microsoft employees to talk about sharing 6 PM Microsoft Office 835 Market Street, Suite 700
45
Thank you! Q&A @MattHidinger
46
6/3/2018 6:31 AM 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 code to evaluate this session and be automatically entered in a drawing to win a prize! © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. 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. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.