This document provides an agenda for a presentation on developing multi-targeting Windows 8 and Windows Phone 8 apps. The agenda includes discussing the importance of multi-targeting, an ABC on multi-targeting, modeling apps using MVVM, and creating a sample multi-targeting app to demonstrate sharing code across platforms using portable class libraries, applying MVVM, and creating platform-specific views. The presentation aims to provide best practices for multi-targeting apps across Windows 8 and Windows Phone 8 through code sharing and proper design patterns like MVVM.
4. Windows Phone 8
Windows Phone 7.x
Direct3D, XAudi
Windows Phone
.NET o2, MF, WASAPI,
Runtime
WIN32, COM
C#, VB
C#, VB, C++ C++
5. Windows Phone 8 Developer Platform
XAML Apps Direct3D Apps
In-App
XAML Maps Geolocation Sensors Direct3D
Purchase
HTML XML Threading Touch Speech XAudio2
Your apps Phone
Features
Push Camera Video Proximity
Media
Foundation
Your way Calendar Wallet Contacts Core Types VoIP STL
Multitasking Live Tiles Memory Async Enterprise CRT
C# and VB C#, VB, and C++ C++
File system, Networking, Graphics, Media
Core Operating System
6. Networking
Proximity
In-App Purchase
Sensors
2,800 Location
11,000 shared File System
members members Core app model
Threading
9. • Share code across platforms using Portable
Class Libraries
• Apply MVVM to wire cross-platform apps
• Create portable abstractions for non-portable
functionality
10. • Link Source code files between platforms.
• Create platform specific Views
• Share UI with user controls
• Always Decouple! Create Clean & SOLID
Code.
23. Creating our Multi
Targeting App
We will see how to create a Windows Store & Windows Phone
App that share code and components.
24. • Usage of PCL to share code
• Portable.MvvmLightLibs &
Portable.CommonService Locator
• MVVM done right
• Linking code
25. • Usage of the Repository pattern
• Creation of our first ViewModel
• OData Client Tools for Windows Store &
Windows Phone Apps
(http://msdn.microsoft.com/en-us/jj658961)
Itisimportant and youknowwhy!YouhavetwomainreasonsYouknowhowtechnologyevolvesthesedays and youwantto be ready!You do notwantto be closedintoonlyonedevice and technology, right?
Clean code: Easy to understand. Easy to modify. Easy to test. Works correctlySOLID Single responsibility, Open-closed principle, Liskov substitution, Interface segregation and Dependency inversionSTUPIDSingletonTight couplingUntestabilityPremature OptimizationIndescriptive NamingDuplication
The thread-handling dispatchers are different on Windows Phone and Windows 8. In windows 8, we use an element of the UI Core while in Windows Phone, we have a dispatcher that has been assigned to our app deployment. So, if you’re anything like me, you say “well it was worth a shot, time to give up”.
Means Decouples
Model – Not UI relatedView Model – Encapsulates hat to display and flow of interactionView – Defines dow to display information from the View ModelHow does this relate to portable libraries? View – needs to be different per platform. View Model and Model can be the same between platforms.So this pattern is ideally suited for creating cross-platform apps, because it encourages a clean separation between the parts of your code that should be shared and those that are platform specific
What besides the UI wasn’t portable? File system, interaction with the OS.The View Models and Models will need that functionality. So…
Herewewill créatefirst a base multitargetingappfor wp8 and Windows store apps, and wire in allthenecesarytoworkwith MVVM in a properway.NextwewillimplementanOdataserviceaccestogetherwiththeRepositorypattern, togetherwiththecorresponding ViewModel and Views.
Therepositoryseparates data consumptionfromhowthe data getspersisted andloaded.OdataClient tolos extendtheaddservicereferencewithclientsideodatasupportfor Windows store and Windows pone apps.