1 / 22

Create cross-platform apps using Portable Class Libraries

Create cross-platform apps using Portable Class Libraries. Daniel Plaisted .NET Framework daplaist@microsoft.com @ dsplaisted 3-004. What we’ll learn. Share code across platforms with Portable Class Libraries Use the MVVM pattern to write cross-platform apps

zubeda
Download Presentation

Create cross-platform apps using Portable Class Libraries

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. Create cross-platform apps using Portable Class Libraries Daniel Plaisted .NET Framework daplaist@microsoft.com @dsplaisted 3-004

  2. What we’ll learn • Share code across platforms with Portable Class Libraries • Use the MVVM pattern to write cross-platform apps • Put models and view models in portable libraries • Create platform-specific views • Create portable abstractions for non-portable functionality • Implement the abstractions for each platform you target • Consider 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

  3. .NET platform proliferation

  4. Project proliferation

  5. Portable Class Libraries • One source • One project • One binary • Multiple platforms!

  6. Portable platform/feature matrix What can I use and where?

  7. Demo • Disentanglement • github.com/dsplaisted/disentanglement

  8. Model-View-ViewModel(MVVM) Views How to display information Written in XAML View Models What information to display Flow of interaction Models Data objects Business logic Etc. View Platform-specific Databinds View Model References Portable Model

  9. Cross-platform app architecture Windows Store App Windows Phone App Startup Startup Views Views Platform specific functionality Platform specific functionality Portable Class Library View Models Reference Reference Models Platform functionality abstractions

  10. Demo • Creating a simple cross-platform app

  11. Hooking platform-specifics to portable code • Pass dependencies in from app code • Service locator/platform abstraction • IoC container

  12. Simple service locator • publicclassServiceLocator • { • publicstaticIFileStorageFileStorage { get; set; } • publicstaticIPhotoChooserPhotoChooser { get; set; } • }

  13. What we’re learning • Share code across platforms with Portable Class Libraries • Use the MVVM pattern to write cross-platform apps • Put models and view models in portable libraries • Create platform-specific views • Create portable abstractions for non-portable functionality • Implement the abstractions for each platform you target • Consider 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

  14. Contoso Helpdesk • Demo

  15. More patterns for portable apps • Navigation • IoC • Async • Azure Service Bus

  16. Azure service bus MSDN Magazine: Create a Continuous Client Using Portable Class Libraries

  17. Cross-platform apps Android iOS Windows Windows Phone Xamarin Cloud for mono for Android

  18. Demo • Twitter Search

  19. In review: what we learned • Share code across platforms with Portable Class Libraries • Use the MVVM pattern to write cross-platform apps • Put models and view models in portable libraries • Create platform-specific views • Create portable abstractions for non-portable functionality • Implement the abstractions for each platform you target • Consider 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

  20. Related Sessions • 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

  21. Additional Resources • http://tinyurl.com/Build2012PCL • Please submit session evals on the Build Windows 8 App or at http://aka.ms/BuildSessions

More Related