create cross-platform apps using portable class libraries
DESCRIPTION
Create cross-platform apps using Portable Class Libraries. Daniel Plaisted .NET Framework [email protected] @ dsplaisted 3-004. What we’ll learn. Share code across platforms with Portable Class Libraries Use the MVVM pattern to write cross-platform apps - PowerPoint PPT PresentationTRANSCRIPT
Create cross-platform apps using Portable Class LibrariesDaniel Plaisted.NET [email protected] @dsplaisted3-004
What we’ll learnShare code across platforms with Portable Class LibrariesUse the MVVM pattern to write cross-platform appsPut models and view models in portable librariesCreate platform-specific viewsCreate portable abstractions for non-portable functionalityImplement the abstractions for each platform you targetConsider using a service locator or IoC container to hook up implementations
How to create cross-platform apps that take full advantage
of platform-specific features while maximizing code reuse for the rest of your app
.NET platform proliferation
Project proliferation
One sourceOne projectOne binary
Multiple platforms!
Portable Class Libraries
Portable platform/feature matrix
What can I use and where?
Disentanglementgithub.com/dsplaisted/disentanglement
Demo
Model-View-ViewModel (MVVM)ViewsHow to display informationWritten in XAML
View ModelsWhat information to displayFlow of interaction
ModelsData objectsBusiness logicEtc.
Model
View Model
View Platform-specific
PortableReferences
Databinds
Cross-platform app architecture
Startup
Views
Windows Store App
Platform specific functionality
View Models
Models
Portable Class Library
Platform functionality abstractions
Startup
Views
Windows Phone App
Platform specific functionality
Reference Reference
Creating a simple cross-platform app
Demo
Pass dependencies in from app codeService locator/platform abstractionIoC container
Hooking platform-specifics to portable code
public class ServiceLocator{ public static IFileStorage FileStorage { get; set; } public static IPhotoChooser PhotoChooser { get; set; }}
Simple service locator
What we’re learningShare code across platforms with Portable Class LibrariesUse the MVVM pattern to write cross-platform appsPut models and view models in portable librariesCreate platform-specific viewsCreate portable abstractions for non-portable functionalityImplement the abstractions for each platform you targetConsider using a service locator or IoC container to hook up implementations
How to create cross-platform apps that take full advantage
of platform-specific features while maximizing code reuse for the rest of your app
Contoso Helpdesk
Demo
NavigationIoCAsyncAzure Service Bus
More patterns for portable apps
Azure service bus
MSDN Magazine:Create a Continuous Client Using Portable Class Libraries
Cross-platform apps
iOSAndroid
Windows
Cloud
Windows Phone
Xamarin
monofor Android
for
Demo
Twitter Search
In review: what we learnedShare code across platforms with Portable Class LibrariesUse the MVVM pattern to write cross-platform appsPut models and view models in portable librariesCreate platform-specific viewsCreate portable abstractions for non-portable functionalityImplement the abstractions for each platform you targetConsider using a service locator or IoC container to hook up implementations
How to create cross-platform apps that take full advantage
of platform-specific features while maximizing code reuse for the rest of your app
• How to Leverage your Code across WP8 and Windows 8 – 3-043
• Designing awesome XAML apps in Visual Studio and Blend for Windows 8 and Windows Phone 8 – 3-006
• The Evolution of .NET – 3-016
• Deep Dive into the Kernel of .NET on Windows Phone 8 – 3-005
Related Sessions
http://tinyurl.com/Build2012PCL
Additional Resources
Please submit session evals on the Build Windows 8 App or at http://aka.ms/BuildSessions
© 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.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.