• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Mvvm cross – going portable
 

Mvvm cross – going portable

on

  • 6,375 views

Draft presentation about the future of MvvmCross

Draft presentation about the future of MvvmCross

Statistics

Views

Total Views
6,375
Views on SlideShare
2,420
Embed Views
3,955

Actions

Likes
1
Downloads
32
Comments
0

55 Embeds 3,955

http://slodge.blogspot.co.uk 1404
http://slodge.blogspot.com 985
http://slodge.blogspot.de 209
http://slodge.blogspot.fr 143
http://slodge.blogspot.nl 139
http://slodge.blogspot.ca 136
http://slodge.blogspot.com.au 84
http://slodge.blogspot.ru 76
http://slodge.blogspot.in 60
http://slodge.blogspot.ch 51
http://slodge.blogspot.it 48
http://slodge.blogspot.com.es 46
http://slodge.blogspot.dk 44
http://slodge.blogspot.pt 42
http://slodge.blogspot.ro 35
http://slodge.blogspot.com.br 33
http://slodge.blogspot.no 33
http://slodge.blogspot.hu 33
http://slodge.blogspot.se 32
http://slodge.blogspot.co.il 32
http://slodge.blogspot.co.at 30
http://slodge.blogspot.ie 26
http://slodge.blogspot.be 24
http://slodge.blogspot.cz 18
http://slodge.blogspot.co.nz 18
http://games-android-apps-free.blogspot.com 16
http://slodge.blogspot.fi 16
http://slodge.blogspot.kr 16
http://slodge.blogspot.tw 13
http://slodge.blogspot.hk 12
http://android-original.blogspot.com 12
http://slodge.blogspot.gr 10
http://slodge.blogspot.sk 10
http://slodge.blogspot.sg 8
http://slodge.blogspot.jp 8
http://slodge.blogspot.mx 8
http://webcache.googleusercontent.com 4
http://jabbr.net 4
http://games-android-apps-free.blogspot.ca 4
http://translate.googleusercontent.com 3
http://android-original.blogspot.in 3
http://slodge.blogspot.com.ar 3
http://androidgbaemulator.blogspot.ie 3
http://games-android-apps-free.blogspot.be 2
http://android-original.blogspot.de 2
http://free-pc-game-downloads2013.blogspot.co.uk 2
http://games-android-apps-free.blogspot.pt 2
http://free-pc-game-downloads2013.blogspot.com 2
http://android-original.blogspot.co.uk 2
http://android-original.blogspot.ch 2
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Mvvm cross – going portable Mvvm cross – going portable Presentation Transcript

    • MvvmCross – Going Portable Going Portable @slodge
    • MvvmCross Version 1
    • MvvmCross MvvmCross MvvmCross MvvmCross .WP7 .Touch .Droid .WinRTMyApplication MyApplication MyApplication MyApplication .WP7 .Touch .Droid .WinRT MyUI MyUI MyUI MyUI .WP7 .Touch .Droid .WinRT MvvmBinding MvvmBinding .Touch .Droid
    • MvvmCross MvvmCross MvvmCross MvvmCross .WP7 .Touch .Droid .WinRTCore MvvmCross MyApplicationMyApplication Library contains: MyApplication MyApplication .WP7 .Touch .Droid .WinRT• Mvvm interfaces and base classes• Simple DI container and IoC controller MyUI MyUI MyUI MyUI• Platform specific navigation• and presentation logic .WP7 .Touch M .Droid .WinRT• Platform specific implementations of MvvmBinding MvvmBinding .Touch .Droid file, location, camera, etc
    • MvvmCross MvvmCross • M MvvmCross MvvmCross .WP7 .Touch .Droid .WinRTMyApplication MyApplication MyApplication MyApplication .WP7 .Touch .Droid .WinRT MyApplication Library contains: MyUI MyUI MyUI MyUI .WP7 .Touch .Droid .WinRT • Application startup logic MvvmBinding .Touch MvvmBinding .Droid • Models and Services • M • ViewModels • ValueConverters Identical code across platforms – just cut-and-paste projects
    • MyUI Executable contains:MvvmCross MvvmCross MvvmCross MvvmCross .WP7 .Touch .Droid .WinRT • M• Platform Specific Views and Controls• Some adaption for ValueConvertersMyApplication MyApplication MyApplication MyApplication .WP7 .Touch .Droid .WinRT MyUI MyUI MyUI MyUI .WP7 .Touch .Droid .WinRT MvvmBinding MvvmBinding .Touch .Droid
    • Problems• MvvmCross is a “fat” library – contains more than just mvvm!• Compiled image sizes can be large – especially on MonoTouch• Application libraries are cut and paste – a boring, error prone manual job• Automated cross-platform refactoring is impossible• No common way to extend the platform• Each new platform added requires manual cut-and- paste duplication of projects
    • MvvmCrossVersion Next
    • MvvmCross .Portable MyApplication .Portable Plugin1 Plugin2 … .Portable .PortableMyUI MyUI MyUI MyUI.WP7 .Touch .Droid .WinRT MvvmCross MvvmCross MvvmCross MvvmCross .Adapter.Wp7 .Adapter.Touch .Adapter.Droid .Adapter.WinRT Plugin1 Plugin1 Plugin1 Plugin1 .Wp7 .Touch .Droid .WinRT Plugin2 Plugin2 Plugin2 Plugin2 .Wp7 .Touch .Droid .WinRT … … … …
    • MvvmCross .Portable MyApplicationMvvmCross is a single Portable library containing: .Portable Plugin1 Plugin2 … .Portable .Portable• Mvvm base classes• Simple DI container and IoC controller• Plugin Loader base interfaces MyUI MyUI MyUI MyUI .WP7 .Touch .Droid .WinRT MvvmCross MvvmCross • M MvvmCross MvvmCross .Adapter.Wp7 .Adapter.Touch .Adapter.Droid .Adapter.WinRT Plugin1 Plugin1 Plugin1 Plugin1 .Wp7 .Touch .Droid .WinRT Plugin2 Plugin2 Plugin2 Plugin2 .Wp7 .Touch .Droid .WinRT … … … …
    • MvvmCross .Portable MyApplication .Portable Plugin1 Plugin2 … .Portable .Portable MyUI MyUI MyUI MyUIMyApplication is a single Portable library containing: .WinRT .WP7 .Touch .Droid MvvmCross MvvmCross MvvmCross MvvmCross• Application startup logic .Adapter.Wp7 .Adapter.Touch .Adapter.Droid .Adapter.WinRT• Models and Services Plugin1 • Plugin1 .Wp7 .Touch M Plugin1 .Droid Plugin1 .WinRT• ViewModels• Plugin2 Plugin2 Plugin2 Plugin2 ValueConverters .Wp7 .Touch .Droid .WinRT … … … …
    • MvvmCross .Portable MyApplication .Portable Plugin1 Plugin2 … .Portable .Portable MyUI MyUI MyUI MyUIThe Portable part of each Plugin: .WP7 .Touch .Droid .WinRT MvvmCross MvvmCross MvvmCross MvvmCross• Provides the interface for that plugin .Adapter.Wp7 .Adapter.Touch .Adapter.Droid .Adapter.WinRT • e.g. for Location it provides Start, Stop, and an Plugin1 .Wp7 Plugin1 • M .Touch Plugin1 .Droid Plugin1 .WinRT OnLocationChanged event.• Provides an EnsureLoaded() call for initialisation at runtime Plugin2 Plugin2 Plugin2 Plugin2 .Wp7 .Touch .Droid .WinRT … … … …
    • MvvmCross .PortableMyUI executable provides: MyApplication .Portable• Platform Specific Views and Controls• Some adaption for ValueConverters Plugin1 .Portable Plugin2 .Portable … • M MyUI MyUI MyUI MyUI .WP7 .Touch .Droid .WinRT MvvmCross MvvmCross MvvmCross MvvmCross .Adapter.Wp7 .Adapter.Touch .Adapter.Droid .Adapter.WinRT Plugin1 Plugin1 Plugin1 Plugin1 .Wp7 .Touch .Droid .WinRT Plugin2 Plugin2 Plugin2 Plugin2 .Wp7 .Touch .Droid .WinRT … … … …
    • MvvmCross .PortableThe MvvmCross.Adapter for each platform provides: MyApplication .Portable• Platform Specific Mvvm Helpers – e.g. binding Plugin2 Plugin1• Platform Specific View and navigation … .Portable .Portable • M• Platform Specific Plugin Manager/Loader MyUI MyUI MyUI MyUI .WP7 .Touch .Droid .WinRT MvvmCross MvvmCross MvvmCross MvvmCross .Adapter.Wp7 .Adapter.Touch .Adapter.Droid .Adapter.WinRT Plugin1 Plugin1 Plugin1 Plugin1 .Wp7 .Touch .Droid .WinRT Plugin2 Plugin2 Plugin2 Plugin2 .Wp7 .Touch .Droid .WinRT … … … …
    • Plugin Implementations: MvvmCross .Portable• Provide platform specific implementations of each Plugin Interface MyApplication • e.g. for Location a platform specific service will provide .Portable Start, Stop, and OnLocationChanged. Plugin1 .Portable Plugin2 .Portable …• Are initialised at runtime using a mixture of: • M • Project references MyUI • Convention-based dynamic assembly loading MyUI MyUI MyUI .WP7 .Touch .Droid .WinRT • Setup Helpers on platforms that don’t support MvvmCross MvvmCross MvvmCross MvvmCross Assembly.Load() .Adapter.Wp7 .Adapter.Touch .Adapter.Droid .Adapter.WinRT Plugin1 Plugin1 Plugin1 Plugin1 .Wp7 .Touch .Droid .WinRT Plugin2 Plugin2 Plugin2 Plugin2 .Wp7 .Touch .Droid .WinRT … … … …
    • Plugins – Portable InterfacesIn the Portable Library – Plugins.Email.dll: public interface IMvxComposeEmailTask { void ComposeEmail(string to, string cc, string subject, string body, bool isHtml); } public class PluginLoader : IMvxPluginLoader , IMvxServiceConsumer<IMvxPluginManager> { public static readonly PluginLoader Instance = new PluginLoader(); #region Implementation of IMvxPluginLoader public void EnsureLoaded() { var manager = this.GetService<IMvxPluginManager>(); manager.EnsureLoaded<PluginLoader>(); } #endregion }
    • Plugins – Portable UseThe plugin can be used in a Portable ViewModel as simply as: protected void ComposeEmail(string to, string subject, string body) { Cirrious.MvvmCross.Plugins.Email.PluginLoader.Instance.EnsureLoaded(); var task = this.GetService<IMvxComposeEmailTask>(); task.ComposeEmail(to, null, subject, body, false); }
    • Plugins – Platform Specific ImplementationsIn one platform specific implementation – Plugins.Email.WindowsPhone.dll: public class MvxComposeEmailTask : MvxWindowsPhoneTask, IMvxComposeEmailTask { public void ComposeEmail(string to, string cc, string subject, string body, bool isHtml) { var task = new EmailComposeTask() { To = to, Subject = subject, Cc = cc, Body = body }; DoWithInvalidOperationProtection(task.Show); } } public class Plugin : IMvxPlugin , IMvxServiceProducer<IMvxComposeEmailTask> { #region Implementation of IMvxPlugin public void Load() { this.RegisterServiceType<IMvxComposeEmailTask, MvxComposeEmailTask>(); } #endregion }
    • Advantages• Core MvvmCross is now a much smaller library• Compiled image sizes can be much smaller – especially on MonoTouch• Each Application is now a single library• Cross-platform refactoring now a reality• Manual cut-and-paste between projects eliminated• Plugin technique allows easy extensibility for everyone• New portable architecture makes it easier to add ans support new platforms – Silverlight, WPF, MonoMac, PlayStationSuite, …
    • Progress…Working now: In progress:• WP7 • MonoTouch• Mono for Android• WinRT