Developing Multi Targetting
Win8 & WP8 Apps.
Jose Luis Latorre
Senior Developer, Accenture
UI Lead Developer, Roche Diagnostics
joslat@gmail.com - @joslat
http://silverlightguy.com
The importance of Multi Targeting 5’
ABC of Multi Targeting            10’
MVVM                              5’    Agenda
Creating our Multi Targeting App 25’


Summarizing + Q & A              5’
The Importance of
Multi Targeting
It is important. that’s why you are here, right?
Windows Phone 8
Windows Phone 7.x



                Direct3D, XAudi
Windows Phone
     .NET       o2, MF, WASAPI,
   Runtime
                 WIN32, COM



   C#, VB
 C#, VB, C++         C++
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
Networking
                  Proximity
                  In-App Purchase
                  Sensors
         2,800    Location
 11,000  shared   File System
members members   Core app model
                  Threading
ABC of Multi
Targeting
Let’s see the main points on how to do it right, the first time.
• Share code across platforms using Portable
  Class Libraries
• Apply MVVM to wire cross-platform apps
• Create portable abstractions for non-portable
  functionality
• Link Source code files between platforms.

• Create platform specific Views

• Share UI with user controls

• Always Decouple! Create Clean & SOLID
  Code.
portable class
library
One Source
One Project
One Binary

Multiple Platforms!
Windows 8   Windows Phone 8
Windows 8   Windows Phone 8
Windows 8
#if NETFX_CORE
Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
#endif



Windows Phone 8
#if WINDOWS_PHONE
Deployment.Current.Dispatcher.BeginInvoke(() => {
#endif
public class ServiceLocator
{
    public static IFileStorage FileStorage { get; set; }
    public static IPhotoChooser PhotoChooser { get; set; }
}
MVVM
It deserves its own section on this XAML world.
User Interface




 App Logic




General          Model-View-ViewModel (MVVM)
Creating our Multi
Targeting App
We will see how to create a Windows Store & Windows Phone
App that share code and components.
• Usage of PCL to share code
• Portable.MvvmLightLibs &
  Portable.CommonService Locator
• MVVM done right
• Linking code
• 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)
Do not trust the web…
Summary..
So, what have we seen?
Applying best practices is a
must
Using proper design patterns
too
Sharing Code through PCL &
Linking
MVVM is fundamental
Jose Luis Latorre
Email: joslat@gmail.com
Twitter: @joslat
Blog: http://Silverlightguy.com
Shape 2013   developing multi targeting windows store and windows phone apps
Shape 2013   developing multi targeting windows store and windows phone apps

Shape 2013 developing multi targeting windows store and windows phone apps

  • 1.
    Developing Multi Targetting Win8& WP8 Apps. Jose Luis Latorre Senior Developer, Accenture UI Lead Developer, Roche Diagnostics joslat@gmail.com - @joslat http://silverlightguy.com
  • 2.
    The importance ofMulti Targeting 5’ ABC of Multi Targeting 10’ MVVM 5’ Agenda Creating our Multi Targeting App 25’ Summarizing + Q & A 5’
  • 3.
    The Importance of MultiTargeting It is important. that’s why you are here, right?
  • 4.
    Windows Phone 8 WindowsPhone 7.x Direct3D, XAudi Windows Phone .NET o2, MF, WASAPI, Runtime WIN32, COM C#, VB C#, VB, C++ C++
  • 5.
    Windows Phone 8Developer 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
  • 8.
    ABC of Multi Targeting Let’ssee the main points on how to do it right, the first time.
  • 9.
    • Share codeacross platforms using Portable Class Libraries • Apply MVVM to wire cross-platform apps • Create portable abstractions for non-portable functionality
  • 10.
    • Link Sourcecode files between platforms. • Create platform specific Views • Share UI with user controls • Always Decouple! Create Clean & SOLID Code.
  • 11.
  • 13.
    One Source One Project OneBinary Multiple Platforms!
  • 14.
    Windows 8 Windows Phone 8
  • 16.
    Windows 8 Windows Phone 8
  • 17.
    Windows 8 #if NETFX_CORE Dispatcher.RunAsync(CoreDispatcherPriority.Normal,() => { #endif Windows Phone 8 #if WINDOWS_PHONE Deployment.Current.Dispatcher.BeginInvoke(() => { #endif
  • 18.
    public class ServiceLocator { public static IFileStorage FileStorage { get; set; } public static IPhotoChooser PhotoChooser { get; set; } }
  • 19.
    MVVM It deserves itsown section on this XAML world.
  • 20.
    User Interface AppLogic General Model-View-ViewModel (MVVM)
  • 23.
    Creating our Multi TargetingApp We will see how to create a Windows Store & Windows Phone App that share code and components.
  • 24.
    • Usage ofPCL to share code • Portable.MvvmLightLibs & Portable.CommonService Locator • MVVM done right • Linking code
  • 25.
    • Usage ofthe Repository pattern • Creation of our first ViewModel • OData Client Tools for Windows Store & Windows Phone Apps (http://msdn.microsoft.com/en-us/jj658961)
  • 26.
    Do not trustthe web…
  • 27.
  • 28.
    Applying best practicesis a must Using proper design patterns too Sharing Code through PCL & Linking MVVM is fundamental
  • 29.
    Jose Luis Latorre Email:joslat@gmail.com Twitter: @joslat Blog: http://Silverlightguy.com

Editor's Notes

  • #8 Itisimportant and youknowwhy!YouhavetwomainreasonsYouknowhowtechnologyevolvesthesedays and youwantto be ready!You do notwantto be closedintoonlyonedevice and technology, right?
  • #11 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
  • #18 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”.
  • #20 Means Decouples
  • #21 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
  • #22 What besides the UI wasn’t portable? File system, interaction with the OS.The View Models and Models will need that functionality. So…
  • #25 Herewewill créatefirst a base multitargetingappfor wp8 and Windows store apps, and wire in allthenecesarytoworkwith MVVM in a properway.NextwewillimplementanOdataserviceaccestogetherwiththeRepositorypattern, togetherwiththecorresponding ViewModel and Views.
  • #26 UpdateNuGetTolatest versiónInstall-PackagePortable.MvvmLightLibs
  • #27 Therepositoryseparates data consumptionfromhowthe data getspersisted andloaded.OdataClient tolos extendtheaddservicereferencewithclientsideodatasupportfor Windows store and Windows pone apps.