introduction aux xamarin xamarin, l’histoire qui donne tort À trump miguel de icaza né en 1972...
TRANSCRIPT
![Page 1: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/1.jpg)
INTRODUCTION AUX XAMARIN.FORMS
AVEC VISUAL STUDIO - .NET – C# & XAML
Olivier Dahan
DEV DAY 2016Mons
![Page 2: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/2.jpg)
• Auteur, Blogueur ‘Dot.Blog’ (www.e-naxos.com/blog)
• MVP depuis 2009 (C#, Silverlight, Windows Dev)
• Expertise C# / XAML / MVVM / Xamarin
• Formateur, Auditeur, Développeur
Olivier Dahan
![Page 3: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/3.jpg)
5 QUESTIONS AUXQUELLES JE VAIS TENTER DE RÉPONDRE
• Qu’est-ce que XAMARIN ?
• Brève histoire et utilité des Xamarin.Forms,
• Quelle place dans la stratégie Microsoft ?
• Quelles compétences pour quels résultats ?
• Quels niveaux de personnalisation peut-on atteindre ?
![Page 4: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/4.jpg)
XAMARIN & STRATÉGIE MICROSOFT
• Intégré à Visual Studio 2015-3
• Xamarin acquis par Microsoft cette année
• Plus qu’un ajout c’est la pierre angulaire d’une nouvelle stratégie Microsoft Cross-plateforme (comme .NET Core)
UWP Xamarin.Forms
« Plan B »L’idéal perdu
![Page 5: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/5.jpg)
UN SEUL MOYEN : UNIFIER
• Pour arriver à gérer l’universalité horizontale
• Pour maintenir la cohérence des lignes de produits et leur histoire
• Pour réunir ce qui est épars
IL FAUT UNIFIER !
• Le code (langage, API)
• L’interface utilisateur
![Page 6: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/6.jpg)
LA GRANDE UNIFICATION DES APIS (.NET STANDARD)
![Page 7: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/7.jpg)
UNIFICATION DES UI : XAMARIN FORMS…
Compilateurs C# / .NET Mono Compilateurs C# / .NET MonoCompilateur XAML
![Page 8: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/8.jpg)
XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP
Miguel de IcazaNé en 1972
Mexicain
1997
2001Ximian 2011
Novell racheté par Attachmate
2016
Xamarin racheté par Microsoft
Racheté par Novell
2003
XAMARINMonoTouch (iOS)
MonoDroid (Android)
Xamarin FormsHelix CodeXamarin Mac OSX
31/12/2001C#/CLI dépôt
ECMA
![Page 9: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/9.jpg)
XFORMS : UNE RÉVOLUTION !
Un code
+
Une UI
=
Une App
Toutes les cibles !
![Page 10: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/10.jpg)
POURQUOI CHOISIR LES XFORMS ?
• UN SEUL CODE & UNE SEULE UI
• UNE SEULE COMPETENCE C# / .NET / XAML
• REUTILISATION DES COMPETENCES
• REUTILISATION DES OUTILS (VS, Resharper, Unit Testing…)
• REUTILISATION DES METHODES (MVVM…)
= GAIN DE TEMPS, d’ARGENT et … PLUS DE PLAISIR !
![Page 11: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/11.jpg)
MÊME SI VOUS VENEZ DE WINDOWS FORMS !
• Vous savez déjà 70% de ce qu’il faut connaître !
• Même EDI (VS ou Xamarin Studio)
• Même plateforme (.NET)
• Même langage (C#)
• Mêmes méthodes de travail (testing…)
Si vous connaissez Silverlight, WPF ou WinRT / UWP vous êtes même à 90% !
(je suis là pour les 10 à 30 % restant et plus si affinité )
![Page 12: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/12.jpg)
L’ESSENTIEL À RETENIR
S’il ne fallait retenir que 4 choses :
• Vous êtes des développeurs Mobile qui s’ignorent !
• Les XForms utilisent vos outils, langages et EDI
• Vous pouvez ne faire que de l’Android ou de l’iOS mais avec vos connaissances actuelles
• Le risque de se tromper en faisant un choix n’existe plus
Let’s go pour la démo …
![Page 13: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/13.jpg)
ETUDE D’UN SOLUTION TYPIQUE
• L’architecture de la solution
• Le projet commun (PCL)
• Les projets NATIFS à compiler
• L’architecture du code partagé
• Services
• Interfaces
• Modèles et Vue-Modèles
• Appels http
• UI XAML
• Navigation
• Personnalisations
Android iOS UWP/PC
![Page 14: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/14.jpg)
L’HISTOIRE COMMENCE DE LA MÊME FAÇON…
• Vous connaissez VS, vous savez créer une solution…
Tous les projets dont le Portable sontCréés automatiquement.On supprimer des cibles et en ajouter à Tout moment.
![Page 15: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/15.jpg)
INSTANT GRATIFICATION On exécute…
![Page 16: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/16.jpg)
LE CATALOGUE EBAY
{"Timestamp":"2016-09-05T14:06:32.025Z","Ack":"Success","Build":"E981_CORE_APILW_4424327_R1","Version":"981","CategoryArray":{"Category":[{"CategoryID":"-1","CategoryLevel":0,"CategoryName":"Root","CategoryParentID":"0","LeafCategory":false},{"……
{"Timestamp":"2016-09-05T14:27:30.405Z","Ack":"Success","Build":"E957_CORE_APILW2_17860840_R1","Version":"957","ItemArray":{"Item":[{"ItemID":"380874204356","EndTime":"2016-09-14T22:14:15.000Z","ViewItemURLForNaturalSearch":"http://www.ebay.com/itm/Inversion-Table-Pro-Deluxe-Fitness-Chiropractic-Table-Exercise-Back-Reflexology-…
Les catégories
Les articles
public class Category{
public string CategoryID { get; set; }public int CategoryLevel { get; set; }public string CategoryName { get; set; }public string CategoryParentID { get; set; }public bool LeafCategory { get; set; }public string CategoryNamePath { get; set; }public string CategoryIDPath { get; set; }
}
public class CategoryArray{
public List<Category> Category { get; set; }}
public class RootObject{
public string Timestamp { get; set; }public string Ack { get; set; }public string Build { get; set; }public string Version { get; set; }public CategoryArray CategoryArray { get; set; }public int CategoryCount { get; set; }public string UpdateTime { get; set; }public string CategoryVersion { get; set; }
}
Code C#
http://json2csharp.com/
http://open.api.ebay.com/Shopping?version=800&appid=XXX&responseencoding=JSON&callname=FindPopularItems&CategoryID=888
L’API Ebay
![Page 17: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/17.jpg)
ON UTILISE LES MÊMES OUTILS
![Page 18: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/18.jpg)
LE PROJET PARTAGÉ
• Contrôle personnalisé• Implémentation des services• Les modèles• Abstraction des services (interfaces)• ViewModels• Vues• Page principale
![Page 19: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/19.jpg)
ACCÉDER AUX DONNÉES EN HTTPInterface Implémentation
Utilisation (ViewModel)
IoC !
![Page 20: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/20.jpg)
PASSONS SOUS VISUAL STUDIO !
![Page 21: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/21.jpg)
PERSONNALISATION NATIVE À TOUT MOMENT
• Les XForms sont conçues pour tous les décrochages
• Renderer custom, injection de code natif …
• Utilisation de contrôles natifs dans une page XForms et l’inverse
• Utilisation de librairies de contrôles natifs
• Mais aussi :
• Des outils comme OnPlatform pour faire des choix natifs dans le projet partagés sans #IF
• Device (services natifs)
• Plugins nombreux (code partagé + code natifs de chaque plateforme sans rien faire !)
![Page 22: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/22.jpg)
LES NIVEAUX DE PERSONNALISATION• Niveau 0 – Ecrire le code XAML correspondant à ses besoins
• A - Code direct
• B - Code partagé dans un dictionnaire de ressources
• Niveau 1 – Utiliser OnPlatform
• Niveau 2 – Utiliser des outils existants
• Ex: Cellules type TextCell pour la ListView
• Utiliser des Plugins Xamarin.Forms
• Niveau 3 – Par ex pour une ListView écrire des cellules personnalisées
• en C#,
• en XAML,
• ou un mix
• Niveau 4 – Ecrire des Custom Renderers natifs
• Exploiter des possibilités propres à chaque OS sans casser le code commun
• Niveau 5 – Utiliser des composants tiers natifs
• Niveau 6 – Ecrire du code natif (UI et/ou code)
![Page 23: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/23.jpg)
EXEMPLE LES CELLULES PERSONNALISÉES
• Les listes sont essentielles en développement mobile
• La ListView affiche des cellules
• On les personnalise avec un DataTemplate (classique en XAML)
• On peut utiliser
• Une ViewCell et coder le XAML à sa guise
• Une Cell spécialisée comme TextCell
• Une cellule customisée 100% C#
• Une cellule customisée 100% XAML
• Une cellule customisée C#/XAML (pour des affichages dynamisés)
• Un selecteur de type pour fournir des types adaptés au contenu
![Page 24: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/24.jpg)
NIVEAU 0A : ECRIRE DU CODE XAML
![Page 25: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/25.jpg)
NIVEAU 0B : UTILISER DES RESSOURCES XAML
![Page 26: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/26.jpg)
NIVEAU 1 – ONPLATFORM
![Page 27: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/27.jpg)
NIVEAU 2 : OUTILS & CODES EXISTANTS
![Page 28: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/28.jpg)
NIVEAU 3 : CUSTOM CELL
…
![Page 29: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/29.jpg)
NIVEAU 4 : CUSTOM RENDERERS
C# NATIF iOS – Utilisation du UIKit Apple
![Page 30: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/30.jpg)
LES CHEVRONS NATIFS IOS
![Page 31: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/31.jpg)
ACTION !
• L’utilisation du NET étant indispensable je vais commenter une petite vidéo de 2 min préparée à l’avance…
![Page 32: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/32.jpg)
![Page 33: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/33.jpg)
AU FINAL UNE APP POUR TOUS LES OS, UN CODE / UNE SEULE UI !
Android (Phone/Tablette) iOS (iPhone/iPad) UWP (desktop/Phone)
![Page 34: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/34.jpg)
QU’AJOUTER DE PLUS ?
• Xamarin.Forms C’est du C# et du XAML que vous connaissez …
• Plus deux ou trois petites choses à savoir bien entendu.
![Page 35: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/35.jpg)
Q&R
• Quelques questions qui peuvent intéresser tout
le monde
• Les questions plus pointues en privé après la conf
![Page 36: Introduction aux Xamarin XAMARIN, L’HISTOIRE QUI DONNE TORT À TRUMP Miguel de Icaza Né en 1972 Mexicain 1997 2001 Ximian 2011 Novell racheté par Attachmate 2016 Xamarin racheté](https://reader034.vdocuments.mx/reader034/viewer/2022050214/5f5ff6cb680b5f13c326839b/html5/thumbnails/36.jpg)
MERCI DE VOTRE ATTENTION !
Olivier Dahan
Simple, puissant, Peu à apprendre comparativement aux environnements natifs, mais il reste des choses à savoir !
Le livre
www.e-naxos.com/blog
www.e-naxos.com/Livre.aspx
Dot.Blog