SlideShare une entreprise Scribd logo
1  sur  32
Télécharger pour lire hors ligne
Titre du document
MvvmCross
Quickstart
Anthyme Caillard
anthyme@gmail.com
@anthyme
Ah oui, on recrute !
:-)
https://techblog.betclicgroup.com/
http://jobs.jobvite.com/betclic/
Mvvm Cross
Business
Intelligence
Technologies
Web & Mobile
Agence
Digitale
Intégrée
Outsourcing
ERP & Processus
métiers
VISEO combine ses pôles de compétences
pour vous accompagner globalement, du
conseil à la réalisation, depuis les processus
métiers jusqu’aux expériences utilisateurs
#viseospirit
MVVM, Kesako ?
Model/View/ViewModel is a variation of
Model/View/Controller that is tailored for modern UI
development platforms where the View is the
responsibility of a designer rather than a classic
developer
Tales from the Smart Client, John Grossman
http://blogs.msdn.com/b/johngossman/archive/2005/10/08/478683.aspx
MVVM
En 2005 …
Mvvm Cross
MVVM
Flux des interactions
Mvvm Cross
public interface ICommand
{
event EventHandler CanExecuteChanged;
bool CanExecute(object parameter);
void Execute(object parameter);
}
MVVM
Actions utilisateur
Mvvm Cross
public interface INotifyPropertyChanged
{
event PropertyChangedEventHandler PropertyChanged;
}
public class PropertyChangedEventArgs : EventArgs
{
public string PropertyName { get; }
}
MVVM
Interface INotifyPropertyChanged
Mvvm Cross
private bool _isSearching;
public bool IsSearching
{
get { return _isSearching; }
set
{
_isSearching = value;
RaisePropertyChanged("IsSearching");
}
}
MVVM
Propriétés publiques sur les ViewModels
Mvvm Cross
public interface INotifyCollectionChanged
{
event NotifyCollectionChangedEventHandler CollectionChanged;
}
public class NotifyCollectionChangedEventArgs : EventArgs
{
public NotifyCollectionChangedAction Action { get; }
public IList NewItems { get; }
public IList OldItems { get; }
public int NewStartingIndex { get; }
public int OldStartingIndex { get; }
}
public enum NotifyCollectionChangedAction
{
Add, Remove, Replace, Move, Reset,
}
MVVM
Notifications des collections
Mvvm Cross
MVVM
Composants dans les interactions
Mvvm Cross
Pourquoi
MvvmCross ?
Pourquoi MvvmCross ?
Approches Xamarin et Xamarin.Forms
Mvvm Cross
Approche Xamarin.Forms:
Plus de partages de code, contrôles natifs
Approche traditionnelle Xamarin
Shared UI Code
Pourquoi MvvmCross ?
Fonctionnalités
Mvvm Cross
‒ MVVM
‒ UI Native
‒ Plus de partages de code
‒ Moins de code de plomberie
‒ Plus grande portée des Tests U
‒ Two-way Data Binding
‒ Architecture unifiée
‒ Navigation
‒ IoC
‒ Messaging
‒ Plugins
‒ …
Shared UI Backend Code
‒ Mono for Android (or Xamarin.Android)
‒ MonoTouch for iOS (or Xamarin.iOS)
‒ Windows Universal projects (WPA8.1 and Windows 8.1 Store apps)
‒ WinRT XAML Framework for Windows 8 Store apps.
‒ Silverlight for WP7, WP8
‒ WPF
‒ Mono for Mac (or Xamarin.Mac)
Pourquoi MvvmCross ?
Plateformes
Mvvm Cross
MvvmCross
Composants & Co
MvvmCross
Data Binding
Mvvm Cross
public interface IMvxValueConverter
{
object Convert(object value, Type targetType,
object parameter, CultureInfo culture);
object ConvertBack(object value, Type targetType,
object parameter, CultureInfo culture);
}
public class MyTimeAgoValueConverter : MvxValueConverter<DateTime, string>
{
protected override string Convert(DateTime value, Type targetType,
object parameter, CultureInfo cultureInfo)
{
var timeAgo = DateTime.UtcNow - value;
if (timeAgo.TotalSeconds < 30) return "just now";
if (timeAgo.TotalMinutes < 10) return "a few minutes ago";
if (timeAgo.TotalMinutes < 60) return "in the last hour";
if (timeAgo.TotalMinutes < 24 * 60) return "in the last day";
return "previously";
}
}
MvvmCross
Converters
Mvvm Cross
‒ Framework IoC simple intégré
‒ Mapping interfaces/implémentations
Mvx.RegisterType<IContactService, ContactService>();
Mvx.ConstructAndRegisterSingleton<IContactService, ContactService>();
Mvx.RegisterSingleton<IContactService>(new ContactService());
‒ Service Locator / Injection de dépendances
var contactService = Mvx.Resolve<IContactService>();
public ContactDetailsViewModel(IContactService contactService) { }
‒ Auto register
‒ Remplaçable par d’autres Framework IoC
MvvmCross
Inversions de contrôle
Mvvm Cross
‒ 1 classe App par application
‒ Enregistrements IoC
‒ ViewModel de démarage
public class App : MvxApplication
{
public override void Initialize()
{
CreatableTypes()
.EndingWith("Service")
.AsInterfaces()
.RegisterAsLazySingleton();
RegisterAppStart<HomeViewModel>();
}
}
MvvmCross
App & setup
Mvvm Cross
‒ 1 classe Setup par plateforme
‒ Customisations du Framework
‒ Instancie l’App
public class Setup : MvxAndroidSetup //MvxTouchSetup
{
public Setup(Context applicationContext) :
base(applicationContext)
{
}
protected override IMvxApplication CreateApp()
{
return new Core.App();
}
protected override IMvxTrace CreateDebugTrace()
{
return new DebugTrace();
}
}
‒ « ViewModel first »
‒ Customisation possible par le presenter
public class HomeViewModel : MvxViewModel
{
private void OpenPost(Post post)
{
ShowViewModel<PostViewModel>(new { id = post.Id });
}
}
public class PostViewModel : MvxViewModel
{
public void Init(int id)
{
}
}
MvvmCross
Navigation
Mvvm Cross
‒ APIs natives unifiées
public interface IMvxComposeEmailTask
{
void ComposeEmail(string to, string cc, string subject, string body, bool isHtml);
}
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);
}
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);
}
}
MvvmCross
Plugins
Mvvm Cross
var entity = new Entity();
var aLabel = FindViewById<TextView>(Resource.Id.helloLabel);
var aButton1 = FindViewById<Button>(Resource.Id.aButton1);
var aButton2 = FindViewById<Button>(Resource.Id.aButton2);
var aButton3 = FindViewById<Button>(Resource.Id.aButton3);
aLabel.Text = entity.AProperty;
aButton1.Click += (sender, e) =>
{
entity.AProperty = "Hello from the button1";
aLabel.Text = entity.AProperty;
};
aButton2.Click += (sender, e) =>
{
entity.AProperty = "Hello from the button2";
aLabel.Text = entity.AProperty;
};
aButton3.Click += (sender, e) =>
{
entity.AProperty = "Hello from the button3";
aLabel.Text = entity.AProperty;
};
Avant la démo …
UI Android
Mvvm Cross
Demo Quickstart
MvvmCross
Avancé
‒ Customisation de la présentation
public interface IMvxViewPresenter
{
void Show(MvxViewModelRequest request);
void ChangePresentation(MvxPresentationHint hint);
}
MvvmCross avancé
Presenter
Mvvm Cross
public interface IMvxMessenger
{
MvxSubscriptionToken Subscribe<TMessage>(Action<TMessage> deliveryAction, ...)
MvxSubscriptionToken SubscribeOnMainThread<TMessage>(
Action<TMessage> deliveryAction, ...)
void Unsubscribe<TMessage>(MvxSubscriptionToken subscriptionId)
void Publish<TMessage>(TMessage message) where TMessage : MvxMessage;
//...
}
MvxMessenger
MvvmCross avancé
Messenger
Mvvm Cross
Publisher
Publisher
MvxMessage
MvxMessage
Subscriber
Subscriber
Subscriber
Subscriber
Publisher
Demo
MvvmCross
Avancé
‒ MvvmCross c’est génial !
‒ La communauté est réactive
‒ Le Framework a un bel historique
‒ Pas mal de tutoriaux
› Mais …
‒ Le Framework évolue et donc change rapidement (comme Xamarin)
‒ Tout n’est pas documenté et les erreurs sont parfois peu explicites
‒ Induit une complexité applicative qu’il faut gérer
‒ Le ticket d’entrée sur l’apprentissage de ce Framework n’est pas
négligeable
Conclusion
Alors j’achète ?
Mvvm Cross
Références
Mvvm Cross
‒ Github (source et doc)
• https://github.com/MvvmCross/MvvmCross
‒ Wiki
• https://github.com/MvvmCross/MvvmCross/wiki
‒ Blogs
• http://mvvmcross.blogspot.fr/
• http://slodge.blogspot.fr/
‒ Extension Ninja coder
• https://visualstudiogallery.msdn.microsoft.com/618b51
f0-6de8-4f85-95ce-a50c658c7767
‒ Tutoriaux Video
• https://www.youtube.com/user/MrHollywoof
‒ Twitter
• @slodge
‒ Code des demos
• https://github.com/anthyme/MvvmCross-QuickStart
‒ Slides
• http://www.slideshare.net/AnthymeCaillard/mvvm-
cross-quickstart
Titre du document
Questions ?
Anthyme Caillard
anthyme.caillard@viseo.com
@anthyme

Contenu connexe

Tendances

Modern Web Development in 2015
Modern Web Development in 2015Modern Web Development in 2015
Modern Web Development in 2015Oliver N
 
Thats Not Flash?
Thats Not Flash?Thats Not Flash?
Thats Not Flash?Mike Wilcox
 
Isomorphic web application
Isomorphic web applicationIsomorphic web application
Isomorphic web applicationOliver N
 
More efficient, usable web
More efficient, usable webMore efficient, usable web
More efficient, usable webChris Mills
 
LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :) LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :) Sascha Sambale
 
Understanding The MVVM Pattern (TechDays Belgium)
Understanding The MVVM Pattern (TechDays Belgium)Understanding The MVVM Pattern (TechDays Belgium)
Understanding The MVVM Pattern (TechDays Belgium)Laurent Bugnion
 
The beauty in building .NET libraries - Embracing .NET Standard
The beauty in building .NET libraries - Embracing .NET StandardThe beauty in building .NET libraries - Embracing .NET Standard
The beauty in building .NET libraries - Embracing .NET StandardJames Croft
 
Web assembly: a brief overview
Web assembly: a brief overviewWeb assembly: a brief overview
Web assembly: a brief overviewPavlo Iatsiuk
 
Get MEAN! Node.js and the MEAN stack
Get MEAN!  Node.js and the MEAN stackGet MEAN!  Node.js and the MEAN stack
Get MEAN! Node.js and the MEAN stackNicholas McClay
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sailsBrian Shannon
 
Sugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a timeSugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a timeEinar Ingebrigtsen
 
You know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on InformixYou know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on InformixKeshav Murthy
 
JavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyJavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyChanghwan Yi
 
JSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic AppsJSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic AppsSpike Brehm
 
Building your first MEAN application
Building your first MEAN applicationBuilding your first MEAN application
Building your first MEAN applicationFITC
 
Introduction to mean stack
Introduction to mean stackIntroduction to mean stack
Introduction to mean stackPraveen Gubbala
 
An Introduction to WebAssembly
An Introduction to WebAssemblyAn Introduction to WebAssembly
An Introduction to WebAssemblyDaniel Budden
 

Tendances (20)

Modern Web Development in 2015
Modern Web Development in 2015Modern Web Development in 2015
Modern Web Development in 2015
 
Thats Not Flash?
Thats Not Flash?Thats Not Flash?
Thats Not Flash?
 
Isomorphic web application
Isomorphic web applicationIsomorphic web application
Isomorphic web application
 
More efficient, usable web
More efficient, usable webMore efficient, usable web
More efficient, usable web
 
Mean PPT
Mean PPTMean PPT
Mean PPT
 
LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :) LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :)
 
Understanding The MVVM Pattern (TechDays Belgium)
Understanding The MVVM Pattern (TechDays Belgium)Understanding The MVVM Pattern (TechDays Belgium)
Understanding The MVVM Pattern (TechDays Belgium)
 
The beauty in building .NET libraries - Embracing .NET Standard
The beauty in building .NET libraries - Embracing .NET StandardThe beauty in building .NET libraries - Embracing .NET Standard
The beauty in building .NET libraries - Embracing .NET Standard
 
Node.js with Express
Node.js with ExpressNode.js with Express
Node.js with Express
 
Web assembly: a brief overview
Web assembly: a brief overviewWeb assembly: a brief overview
Web assembly: a brief overview
 
Flash And Dom
Flash And DomFlash And Dom
Flash And Dom
 
Get MEAN! Node.js and the MEAN stack
Get MEAN!  Node.js and the MEAN stackGet MEAN!  Node.js and the MEAN stack
Get MEAN! Node.js and the MEAN stack
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
 
Sugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a timeSugarcoating your frontend one ViewModel at a time
Sugarcoating your frontend one ViewModel at a time
 
You know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on InformixYou know what iMEAN? Using MEAN stack for application dev on Informix
You know what iMEAN? Using MEAN stack for application dev on Informix
 
JavaScript Engine and WebAssembly
JavaScript Engine and WebAssemblyJavaScript Engine and WebAssembly
JavaScript Engine and WebAssembly
 
JSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic AppsJSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic Apps
 
Building your first MEAN application
Building your first MEAN applicationBuilding your first MEAN application
Building your first MEAN application
 
Introduction to mean stack
Introduction to mean stackIntroduction to mean stack
Introduction to mean stack
 
An Introduction to WebAssembly
An Introduction to WebAssemblyAn Introduction to WebAssembly
An Introduction to WebAssembly
 

En vedette

LINQ の概要とかもろもろ
LINQ の概要とかもろもろLINQ の概要とかもろもろ
LINQ の概要とかもろもろShinichiAoyagi
 
“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~
“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~
“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~ShinichiAoyagi
 
Windows ストアーアプリで SQLite を使ってみよう
Windows ストアーアプリで SQLite を使ってみようWindows ストアーアプリで SQLite を使ってみよう
Windows ストアーアプリで SQLite を使ってみようShinichiAoyagi
 
WindowsストアーアプリでSharpDXを動かしてみる
WindowsストアーアプリでSharpDXを動かしてみるWindowsストアーアプリでSharpDXを動かしてみる
WindowsストアーアプリでSharpDXを動かしてみるShinichiAoyagi
 

En vedette (6)

XAML 入門
XAML 入門XAML 入門
XAML 入門
 
LINQ の概要とかもろもろ
LINQ の概要とかもろもろLINQ の概要とかもろもろ
LINQ の概要とかもろもろ
 
“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~
“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~
“なめらか”なメトロスタイルアプリを作るために ~WinRT の非同期性を活用したアプリ開発~
 
LINQ概要
LINQ概要LINQ概要
LINQ概要
 
Windows ストアーアプリで SQLite を使ってみよう
Windows ストアーアプリで SQLite を使ってみようWindows ストアーアプリで SQLite を使ってみよう
Windows ストアーアプリで SQLite を使ってみよう
 
WindowsストアーアプリでSharpDXを動かしてみる
WindowsストアーアプリでSharpDXを動かしてみるWindowsストアーアプリでSharpDXを動かしてみる
WindowsストアーアプリでSharpDXを動かしてみる
 

Similaire à MvvmCross Quickstart

Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every dayVadym Khondar
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMohammad Shaker
 
Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Chris Richardson
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Mahmoud Hamed Mahmoud
 
MVP Mix 2015 Leveraging MVVM on all Platforms
MVP Mix 2015  Leveraging MVVM on all PlatformsMVP Mix 2015  Leveraging MVVM on all Platforms
MVP Mix 2015 Leveraging MVVM on all PlatformsJames Montemagno
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSuzquiano
 
Qt & Webkit
Qt & WebkitQt & Webkit
Qt & WebkitQT-day
 
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...GITS Indonesia
 
Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Chris Richardson
 
Being a pimp without silverlight
Being a pimp without silverlightBeing a pimp without silverlight
Being a pimp without silverlightKris van der Mast
 
Being a pimp without silverlight - ASP.NET MVC 2 and jQuery
Being a pimp without silverlight - ASP.NET MVC 2 and jQueryBeing a pimp without silverlight - ASP.NET MVC 2 and jQuery
Being a pimp without silverlight - ASP.NET MVC 2 and jQueryKris van der Mast
 
Being a pimp without silverlight
Being a pimp without silverlightBeing a pimp without silverlight
Being a pimp without silverlightMaarten Balliauw
 
TDC2017 | Florianópolis - Trilha Java Programação reativa com vert.x
TDC2017 | Florianópolis - Trilha Java Programação reativa com vert.xTDC2017 | Florianópolis - Trilha Java Programação reativa com vert.x
TDC2017 | Florianópolis - Trilha Java Programação reativa com vert.xtdc-globalcode
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger FasterChris Love
 
Protocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS MeetupProtocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS MeetupNatasha Murashev
 
Engage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagEngage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagWebtrends
 
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...Matt Spradley
 
Scaling with Scala: refactoring a back-end service into the mobile age
Scaling with Scala: refactoring a back-end service into the mobile ageScaling with Scala: refactoring a back-end service into the mobile age
Scaling with Scala: refactoring a back-end service into the mobile ageDragos Manolescu
 

Similaire à MvvmCross Quickstart (20)

Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhone
 
Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
 
MVP Mix 2015 Leveraging MVVM on all Platforms
MVP Mix 2015  Leveraging MVVM on all PlatformsMVP Mix 2015  Leveraging MVVM on all Platforms
MVP Mix 2015 Leveraging MVVM on all Platforms
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMS
 
Windows 8 for Web Developers
Windows 8 for Web DevelopersWindows 8 for Web Developers
Windows 8 for Web Developers
 
Qt & Webkit
Qt & WebkitQt & Webkit
Qt & Webkit
 
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
 
GWT MVP Case Study
GWT MVP Case StudyGWT MVP Case Study
GWT MVP Case Study
 
Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...Futures and Rx Observables: powerful abstractions for consuming web services ...
Futures and Rx Observables: powerful abstractions for consuming web services ...
 
Being a pimp without silverlight
Being a pimp without silverlightBeing a pimp without silverlight
Being a pimp without silverlight
 
Being a pimp without silverlight - ASP.NET MVC 2 and jQuery
Being a pimp without silverlight - ASP.NET MVC 2 and jQueryBeing a pimp without silverlight - ASP.NET MVC 2 and jQuery
Being a pimp without silverlight - ASP.NET MVC 2 and jQuery
 
Being a pimp without silverlight
Being a pimp without silverlightBeing a pimp without silverlight
Being a pimp without silverlight
 
TDC2017 | Florianópolis - Trilha Java Programação reativa com vert.x
TDC2017 | Florianópolis - Trilha Java Programação reativa com vert.xTDC2017 | Florianópolis - Trilha Java Programação reativa com vert.x
TDC2017 | Florianópolis - Trilha Java Programação reativa com vert.x
 
Bigger Stronger Faster
Bigger Stronger FasterBigger Stronger Faster
Bigger Stronger Faster
 
Protocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS MeetupProtocol Oriented MVVM - Auckland iOS Meetup
Protocol Oriented MVVM - Auckland iOS Meetup
 
Engage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagEngage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 Tag
 
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...
How We Built a Mobile Electronic Health Record App Using Xamarin, Angular, an...
 
Scaling with Scala: refactoring a back-end service into the mobile age
Scaling with Scala: refactoring a back-end service into the mobile ageScaling with Scala: refactoring a back-end service into the mobile age
Scaling with Scala: refactoring a back-end service into the mobile age
 

Dernier

FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRnishacall1
 
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceanilsa9823
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceanilsa9823
 
9892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x79892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x7Pooja Nehwal
 
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPsychicRuben LoveSpells
 
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Pooja Nehwal
 
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceDelhi Call girls
 

Dernier (7)

FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
 
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
 
9892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x79892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x7
 
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
 
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
 
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
 

MvvmCross Quickstart

  • 1. Titre du document MvvmCross Quickstart Anthyme Caillard anthyme@gmail.com @anthyme
  • 2.
  • 3. Ah oui, on recrute ! :-) https://techblog.betclicgroup.com/ http://jobs.jobvite.com/betclic/
  • 4. Mvvm Cross Business Intelligence Technologies Web & Mobile Agence Digitale Intégrée Outsourcing ERP & Processus métiers VISEO combine ses pôles de compétences pour vous accompagner globalement, du conseil à la réalisation, depuis les processus métiers jusqu’aux expériences utilisateurs #viseospirit
  • 6. Model/View/ViewModel is a variation of Model/View/Controller that is tailored for modern UI development platforms where the View is the responsibility of a designer rather than a classic developer Tales from the Smart Client, John Grossman http://blogs.msdn.com/b/johngossman/archive/2005/10/08/478683.aspx MVVM En 2005 … Mvvm Cross
  • 8. public interface ICommand { event EventHandler CanExecuteChanged; bool CanExecute(object parameter); void Execute(object parameter); } MVVM Actions utilisateur Mvvm Cross
  • 9. public interface INotifyPropertyChanged { event PropertyChangedEventHandler PropertyChanged; } public class PropertyChangedEventArgs : EventArgs { public string PropertyName { get; } } MVVM Interface INotifyPropertyChanged Mvvm Cross
  • 10. private bool _isSearching; public bool IsSearching { get { return _isSearching; } set { _isSearching = value; RaisePropertyChanged("IsSearching"); } } MVVM Propriétés publiques sur les ViewModels Mvvm Cross
  • 11. public interface INotifyCollectionChanged { event NotifyCollectionChangedEventHandler CollectionChanged; } public class NotifyCollectionChangedEventArgs : EventArgs { public NotifyCollectionChangedAction Action { get; } public IList NewItems { get; } public IList OldItems { get; } public int NewStartingIndex { get; } public int OldStartingIndex { get; } } public enum NotifyCollectionChangedAction { Add, Remove, Replace, Move, Reset, } MVVM Notifications des collections Mvvm Cross
  • 12. MVVM Composants dans les interactions Mvvm Cross
  • 14. Pourquoi MvvmCross ? Approches Xamarin et Xamarin.Forms Mvvm Cross Approche Xamarin.Forms: Plus de partages de code, contrôles natifs Approche traditionnelle Xamarin Shared UI Code
  • 15. Pourquoi MvvmCross ? Fonctionnalités Mvvm Cross ‒ MVVM ‒ UI Native ‒ Plus de partages de code ‒ Moins de code de plomberie ‒ Plus grande portée des Tests U ‒ Two-way Data Binding ‒ Architecture unifiée ‒ Navigation ‒ IoC ‒ Messaging ‒ Plugins ‒ … Shared UI Backend Code
  • 16. ‒ Mono for Android (or Xamarin.Android) ‒ MonoTouch for iOS (or Xamarin.iOS) ‒ Windows Universal projects (WPA8.1 and Windows 8.1 Store apps) ‒ WinRT XAML Framework for Windows 8 Store apps. ‒ Silverlight for WP7, WP8 ‒ WPF ‒ Mono for Mac (or Xamarin.Mac) Pourquoi MvvmCross ? Plateformes Mvvm Cross
  • 19. public interface IMvxValueConverter { object Convert(object value, Type targetType, object parameter, CultureInfo culture); object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture); } public class MyTimeAgoValueConverter : MvxValueConverter<DateTime, string> { protected override string Convert(DateTime value, Type targetType, object parameter, CultureInfo cultureInfo) { var timeAgo = DateTime.UtcNow - value; if (timeAgo.TotalSeconds < 30) return "just now"; if (timeAgo.TotalMinutes < 10) return "a few minutes ago"; if (timeAgo.TotalMinutes < 60) return "in the last hour"; if (timeAgo.TotalMinutes < 24 * 60) return "in the last day"; return "previously"; } } MvvmCross Converters Mvvm Cross
  • 20. ‒ Framework IoC simple intégré ‒ Mapping interfaces/implémentations Mvx.RegisterType<IContactService, ContactService>(); Mvx.ConstructAndRegisterSingleton<IContactService, ContactService>(); Mvx.RegisterSingleton<IContactService>(new ContactService()); ‒ Service Locator / Injection de dépendances var contactService = Mvx.Resolve<IContactService>(); public ContactDetailsViewModel(IContactService contactService) { } ‒ Auto register ‒ Remplaçable par d’autres Framework IoC MvvmCross Inversions de contrôle Mvvm Cross
  • 21. ‒ 1 classe App par application ‒ Enregistrements IoC ‒ ViewModel de démarage public class App : MvxApplication { public override void Initialize() { CreatableTypes() .EndingWith("Service") .AsInterfaces() .RegisterAsLazySingleton(); RegisterAppStart<HomeViewModel>(); } } MvvmCross App & setup Mvvm Cross ‒ 1 classe Setup par plateforme ‒ Customisations du Framework ‒ Instancie l’App public class Setup : MvxAndroidSetup //MvxTouchSetup { public Setup(Context applicationContext) : base(applicationContext) { } protected override IMvxApplication CreateApp() { return new Core.App(); } protected override IMvxTrace CreateDebugTrace() { return new DebugTrace(); } }
  • 22. ‒ « ViewModel first » ‒ Customisation possible par le presenter public class HomeViewModel : MvxViewModel { private void OpenPost(Post post) { ShowViewModel<PostViewModel>(new { id = post.Id }); } } public class PostViewModel : MvxViewModel { public void Init(int id) { } } MvvmCross Navigation Mvvm Cross
  • 23. ‒ APIs natives unifiées public interface IMvxComposeEmailTask { void ComposeEmail(string to, string cc, string subject, string body, bool isHtml); } 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); } 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); } } MvvmCross Plugins Mvvm Cross
  • 24. var entity = new Entity(); var aLabel = FindViewById<TextView>(Resource.Id.helloLabel); var aButton1 = FindViewById<Button>(Resource.Id.aButton1); var aButton2 = FindViewById<Button>(Resource.Id.aButton2); var aButton3 = FindViewById<Button>(Resource.Id.aButton3); aLabel.Text = entity.AProperty; aButton1.Click += (sender, e) => { entity.AProperty = "Hello from the button1"; aLabel.Text = entity.AProperty; }; aButton2.Click += (sender, e) => { entity.AProperty = "Hello from the button2"; aLabel.Text = entity.AProperty; }; aButton3.Click += (sender, e) => { entity.AProperty = "Hello from the button3"; aLabel.Text = entity.AProperty; }; Avant la démo … UI Android Mvvm Cross
  • 27. ‒ Customisation de la présentation public interface IMvxViewPresenter { void Show(MvxViewModelRequest request); void ChangePresentation(MvxPresentationHint hint); } MvvmCross avancé Presenter Mvvm Cross
  • 28. public interface IMvxMessenger { MvxSubscriptionToken Subscribe<TMessage>(Action<TMessage> deliveryAction, ...) MvxSubscriptionToken SubscribeOnMainThread<TMessage>( Action<TMessage> deliveryAction, ...) void Unsubscribe<TMessage>(MvxSubscriptionToken subscriptionId) void Publish<TMessage>(TMessage message) where TMessage : MvxMessage; //... } MvxMessenger MvvmCross avancé Messenger Mvvm Cross Publisher Publisher MvxMessage MvxMessage Subscriber Subscriber Subscriber Subscriber Publisher
  • 30. ‒ MvvmCross c’est génial ! ‒ La communauté est réactive ‒ Le Framework a un bel historique ‒ Pas mal de tutoriaux › Mais … ‒ Le Framework évolue et donc change rapidement (comme Xamarin) ‒ Tout n’est pas documenté et les erreurs sont parfois peu explicites ‒ Induit une complexité applicative qu’il faut gérer ‒ Le ticket d’entrée sur l’apprentissage de ce Framework n’est pas négligeable Conclusion Alors j’achète ? Mvvm Cross
  • 31. Références Mvvm Cross ‒ Github (source et doc) • https://github.com/MvvmCross/MvvmCross ‒ Wiki • https://github.com/MvvmCross/MvvmCross/wiki ‒ Blogs • http://mvvmcross.blogspot.fr/ • http://slodge.blogspot.fr/ ‒ Extension Ninja coder • https://visualstudiogallery.msdn.microsoft.com/618b51 f0-6de8-4f85-95ce-a50c658c7767 ‒ Tutoriaux Video • https://www.youtube.com/user/MrHollywoof ‒ Twitter • @slodge ‒ Code des demos • https://github.com/anthyme/MvvmCross-QuickStart ‒ Slides • http://www.slideshare.net/AnthymeCaillard/mvvm- cross-quickstart
  • 32. Titre du document Questions ? Anthyme Caillard anthyme.caillard@viseo.com @anthyme