alphorm.com-formation windows phone 8.1
DESCRIPTION
La formation complète est disponible ici: http://www.alphorm.com/tutoriel/formation-en-ligne-windows-phone-8-1 Le système Windows Phone 8.1 est un système majeur dans l'univers des mobiles. Création de Microsoft, il succède aux versions 7 et 8 du système. Cette formation vous permet de programmer pour Windows Phone 8.1, utilisant l'environnement Visual Studio 2013, en mettant en évidence les différences entre les projets supportant Windows Phone 8.0, 8.1 RT et 8.1 Silverlight. De la création de l'interface graphique aux accès réseau et à la gestion de l'accéléromètre, vous profiterez de l'expertise de développement de Fabien Brissonneau, qui vous amènera à découvrir les aspects les plus intéressants de ces applications. Le but de cette formation pragmatique est de vous permettre de programmer au plus vite sous Windows Phone 8.1TRANSCRIPT
![Page 1: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/1.jpg)
25/08/2014
1
Présentation de la formation
Windows Phone 8/8.1
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Windows Phone 8/8.1
![Page 2: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/2.jpg)
25/08/2014
2
Plan
• Présentation du formateur
• Les autres formations en programmation sur alphorm.com
• Qu’est-ce que Windows Phone 8?
• Le plan de formation
• Présentation des outils
Windows Phone 8 alphorm.com™©
• Présentation des outils
• Publics concernés
• Connaissances requises
• Les références
![Page 3: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/3.jpg)
25/08/2014
3
Présentation du formateur• Fabien Brissonneau
• Email : [email protected]
• Consultant Concepteur et Formateur
• Missions d’architecture, de conception , de réalisation logicielles
• Fondateur de eiXa6
• Actuellement en mission sur un projet de gestion
Windows Phone 8 alphorm.com™©
• Actuellement en mission sur un projet de gestion
• Mes références :
� Mon profil Viadeo : http://fr.viadeo.com/fr/profile/fabien.brissonneau
� Mon profil LinkedIn : http://fr.linkedin.com/pub/fabien-brissonneau/65/902/92a/
![Page 4: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/4.jpg)
25/08/2014
4
Mes formations déjà réalisées sur alphorm.com
Windows Phone 8 alphorm.com™©
![Page 5: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/5.jpg)
25/08/2014
5
Autres formations en .NET déjà réalisées sur alphorm.com
Windows Phone 8 alphorm.com™©
Autres formations en .NET sur alphorm
![Page 6: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/6.jpg)
25/08/2014
6
Qu’est ce que c’est Windows Phone 8.1
• Windows Phone 8.1 est un système d’exploitation
• Successeur des Windows Phone 7 et 8
• Utilise les ressources d’un appareil mobile
• Converge vers le système Windows
Windows Phone 8 alphorm.com™©
• Le framework à utiliser est quasi le même
![Page 7: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/7.jpg)
25/08/2014
7
Le plan de formation
1. Introduction
2. Construire une application
3. Le déploiement de l'application
4. Les interfaces graphiques
Windows Phone 8 alphorm.com™©
5. Les interactions avec le système
6. Les accès réseau
7. Les capteurs
8. Conclusion
![Page 8: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/8.jpg)
25/08/2014
8
Présentation des outils
• Visual Studio
• Les projets Windows Phone
• Windows Phone 8, 8.1, 8.1 Silverlight
Windows Phone 8 alphorm.com™©
![Page 9: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/9.jpg)
25/08/2014
9
Publics concernés
• Tout développeur intéressé par une première approche du système
• Même sans connaissance de l’écosystème Microsoft
• Développeur souhaitant passer de Windows Phone 7 à 8
Windows Phone 8 alphorm.com™©
![Page 10: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/10.jpg)
25/08/2014
10
Connaissances requises
• Bases de la programmation
• A l’aise avec la notion de compilation, de debug
• La connaissance d’un langage de programmation est un plus
• Le C# est ici utilisé pour la partie programmation
Windows Phone 8 alphorm.com™©
![Page 11: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/11.jpg)
25/08/2014
11
Les références
• Un système Windows 8
• Le site dev.windows.com
• Visual Studio 2013, Update 2
Windows Phone 8 alphorm.com™©
![Page 12: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/12.jpg)
25/08/2014
12
Are you ready ? ☺
Windows Phone 8 alphorm.com™©
![Page 13: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/13.jpg)
25/08/2014
13
Introduction
Visual Studio et Blend
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Visual Studio et Blend
![Page 14: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/14.jpg)
25/08/2014
14
Plan
• Visual Studio 2013
• Edition du code C# vs XAML
• Propriétés de projets
• Blend
Windows Phone 8 alphorm.com™©
![Page 15: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/15.jpg)
25/08/2014
15
Visual Studio 2013
Windows Phone 8 alphorm.com™©
![Page 16: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/16.jpg)
25/08/2014
16
Edition du code C# vs XAML
Windows Phone 8 alphorm.com™©
![Page 17: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/17.jpg)
25/08/2014
17
Propriétés de projets
Windows Phone 8 alphorm.com™©
![Page 18: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/18.jpg)
25/08/2014
18
Blend
Windows Phone 8 alphorm.com™©
![Page 19: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/19.jpg)
25/08/2014
19
Ce qu’on a couvert
• Présentation de Visual Studio
• Les éditeurs de code C# et de XAML
• Les propriétés du projet
• Blend, outil graphique
Windows Phone 8 alphorm.com™©
FIN
![Page 20: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/20.jpg)
25/08/2014
20
Introduction
Les différents projets WP
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Les différents projets WP
![Page 21: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/21.jpg)
25/08/2014
21
Plan
• Application WP
• Application liée aux données
• Application panorama
• Application pivot
Windows Phone 8 alphorm.com™©
• Application XAML avec Direct3D
• Application HTML5
• Et les autres : bibliothèques, tests, agents
![Page 22: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/22.jpg)
25/08/2014
22
Application Windows Phone
• PhoneApplicationFrame
• PhoneApplicationPage
• Canvas, Border, Grid
Windows Phone 8 alphorm.com™©
![Page 23: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/23.jpg)
25/08/2014
23
Application liée aux données
• Utilise une liste liée
• Navigation facile en partant des items sélectionnés
Windows Phone 8 alphorm.com™©
![Page 24: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/24.jpg)
25/08/2014
24
Application Panorama
• Un panorama est un conteneur long qui contient des items
• Idéal pour placer un contenu qui s’étale en longueur
• Pas à gérer les mouvements de l’utilisateur
Windows Phone 8 alphorm.com™©
![Page 25: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/25.jpg)
25/08/2014
25
Application Pivot
• Alternative au panorama
• Contient des items qui sont rapidement accessibles
Windows Phone 8 alphorm.com™©
![Page 26: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/26.jpg)
25/08/2014
26
Application XAML et Direct3D
• Il existe des application pure Direct3D, écrites en C++
• Un contrôle Direct3D peut être intégré dans l’application managée
• La surface occupée et le contrôle utilisé pour faire l’interaction Appli Managée/Direct3D dépend du modèle utilisé :
� DrawingSurface, qui est un contrôle comme un autre
Windows Phone 8 alphorm.com™©
� DrawingSurface, qui est un contrôle comme un autre
� DrawingSurfaceBackgroundGrid, qui occupe toute la surface de l’écran
![Page 27: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/27.jpg)
25/08/2014
27
Application HTML5
• Utilisable via le composant WebBrowser, navigateur HTML
Windows Phone 8 alphorm.com™©
![Page 28: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/28.jpg)
25/08/2014
28
Ce qu’on a couvert
• Les différents types de projets offerts sous Windows Phone 8
• Le modèle de base
• Les applications liées aux données
• Le panorama
Windows Phone 8 alphorm.com™©
• Le pivot
• XAML et Direct3D
• Les applications HTML5
FIN
![Page 29: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/29.jpg)
25/08/2014
29
Introduction
Emulateur et matériel
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Emulateur et matériel
![Page 30: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/30.jpg)
25/08/2014
30
Plan
• L’émulateur WP
• Le paramétrage de l’émulateur
• L’exécution sur un matériel
Windows Phone 8 alphorm.com™©
![Page 31: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/31.jpg)
25/08/2014
31
L’émulateur WP
• L’émulateur Windows Phone est une application qui émule un matériel
• Il fournit aussi un environnement isolé pour tester
• L’émulateur WP8 n’est pas compatible avec des applications avant 7.1
• Les paramétrages identiques à ceux d’un appareil physique
Windows Phone 8 alphorm.com™©
![Page 32: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/32.jpg)
25/08/2014
32
Le paramétrage de l’émulateur
• Résolutions d’écrans : WVGA (800x480), WXGA (1280x768), 720p (1280x720)
• Options portrait/paysage
• Mémoire contrainte : par défaut WXGA 512Mo
• Réseau : possibilité de limiter la bande passante
Windows Phone 8 alphorm.com™©
• Réseau : possibilité de limiter la bande passante
• Langue et régionalisation
• Cycle de vie de l’application
• Stockage local : (isolated storage) de la durée de fonctionnement
• Caméra, GPS …
![Page 33: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/33.jpg)
25/08/2014
33
La barre d’outil
• Changer l’orientation
• Zoomer, ajuster la taille de l’émulateur
• Changer de langue et de paramètres régionaux
• Faire que l’application change d’état : Start, Back, Punaise
Windows Phone 8 alphorm.com™©
![Page 34: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/34.jpg)
25/08/2014
34
L’exécution sur un matériel
• Nécessaire avant livraison
• Suppose de cibler un appareil connecté
• Indispensable pour tester : boussole, gyroscope, vibrations, luminosité
Windows Phone 8 alphorm.com™©
![Page 35: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/35.jpg)
25/08/2014
35
Ce qu’on a couvert
• L’émulateur est un outil qui permet de tester l’application
• Les menus permettent de l’utiliser comme un vrai téléphone
• Les paramètres vont permettre de tester des conditions limites
• Il faut tester l’application sur un téléphone matériel avant livraison
Windows Phone 8 alphorm.com™©
FIN
![Page 36: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/36.jpg)
25/08/2014
36
Introduction
Version 8 et 8.1
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Version 8 et 8.1
![Page 37: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/37.jpg)
25/08/2014
37
Plan
• Les projets Visual Studio
• La convergence vers Windows Store Apps
• Les nouveautés de 8.1
Windows Phone 8 alphorm.com™©
![Page 38: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/38.jpg)
25/08/2014
38
Les projets Visual Studio
• Projets renommés
• Bien faire la différence entre
� Windows Phone 8.1 Silverlight
� Windows Phone 8.1
• Suivant le type du projet, les menus sont différents
Windows Phone 8 alphorm.com™©
• Suivant le type du projet, les menus sont différents
![Page 39: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/39.jpg)
25/08/2014
39
La convergence Windows Store
• Modèle d’application et cycle de vie
• Manifest, construction et déploiement
• XAML
Windows Phone 8 alphorm.com™©
![Page 40: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/40.jpg)
25/08/2014
40
Les nouveautés de 8.1
• Nouvelles classes de gélocalisation
• Zonage géographique (geofencing)
• Meilleure gestion des cartes
• Transferts en arrière-plan
Windows Phone 8 alphorm.com™©
• Nouvelle gestion des media
• Utilisation de WNS pour les notifications
• La barre de commande nouvelle
• …
![Page 41: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/41.jpg)
25/08/2014
41
Ce qu’on a couvert
• Les projets Visual Studio
• La convergence vers Windows Store Apps
• Les nouveautés de 8.1
Windows Phone 8 alphorm.com™©
FIN
![Page 42: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/42.jpg)
25/08/2014
42
Construire une application
Construire l’interface
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Construire l’interface
![Page 43: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/43.jpg)
25/08/2014
43
Plan
• L’application, les pages
• Utiliser la boîte à outils
� Les layout
� Les contrôles
• Edition du XAML
Windows Phone 8 alphorm.com™©
• Edition du XAML
• Edition du C#
![Page 44: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/44.jpg)
25/08/2014
44
L’application, les pages
• L’application est l’objet qui réalise le démarrage du programme
• Peut être utilisée pour intervenir avant l’apparition de l’ihm
• App.xaml référence l’objet PhoneApplicationFrame
• Ce dernier objet sert à la navigation entre les pages
Windows Phone 8 alphorm.com™©
• Une page, dérivée de PhoneApplicationPage, contient les contrôles
• Elle référence divers espaces de nommages, dont MS.Phone.Controls
![Page 45: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/45.jpg)
25/08/2014
45
Utiliser la boîte à outils
• La boîte à outils sert à construire l’ihm
• Les contrôles sont déposés simplement sur le concepteur graphique
• La boîte à outils sert aussi à disposer les layout
• Le layout est un conteneur qui règle le positionnement initial et la déformation des contrôles
Windows Phone 8 alphorm.com™©
déformation des contrôles
![Page 46: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/46.jpg)
25/08/2014
46
Edition du XAML
• L’édition directe du XAML est rapide
• XAML est un langage de description de pages dialecte XML
• Support de WPF et Silverlight
• Avec XAML, on peut décrire la quasi-totalité de l’ihm
Windows Phone 8 alphorm.com™©
• Le lien avec la code C# (ou autre) est réalisé par le runtime
![Page 47: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/47.jpg)
25/08/2014
47
Edition du C#
• Le C# est un langage de programmation orienté objet
• Il permet d’implémenter la logique applicative
• Les objet XAML sont utilisables par leur noms
• Les attributs du XAML sont des propriétés des objets C#
Windows Phone 8 alphorm.com™©
![Page 48: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/48.jpg)
25/08/2014
48
Ce qu’on a couvert
• L’application est unique et référence la racine
• Une page est le conteneur des contrôles à un moment donné
• Utiliser la boîte à outils pour distribuer les contrôles en tenant compte des conteneur de positionnement utilisés
• Edition du XAML pour intervenir sur l’ihm
Windows Phone 8 alphorm.com™©
• Edition du XAML pour intervenir sur l’ihm
• Edition du C# pour ajouter le code ayant une logique plus applicative
FIN
![Page 49: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/49.jpg)
25/08/2014
49
Construire une application
Améliorer l’interface
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Améliorer l’interface
![Page 50: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/50.jpg)
25/08/2014
50
Plan
• Saisie de dates, heures
• Liaison entre contrôles
• Validation des entrées
• Onglets avec Pivot
Windows Phone 8 alphorm.com™©
• Scrolling
• Application bar
![Page 51: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/51.jpg)
25/08/2014
51
Saisies de dates et heures
• Depuis WP 8.1, contrôles DatePicker et TimePicker
• Possibilités d’initialiser les propriétés de ces contrôles
• Récupérer les informations
Windows Phone 8 alphorm.com™©
![Page 52: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/52.jpg)
25/08/2014
52
Les liaisons entre contrôles
• Le databinding permet de :
� Positionner une propriété d’un champ en fonction d’un autre
� Mettre à jour un champ par rapport à un objet C#
� Mettre à jour un objet C# par rapport à un contrôle
Windows Phone 8 alphorm.com™©
![Page 53: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/53.jpg)
25/08/2014
53
La validation des entrées
• Il faut contrôler la validité des saisies utilisateurs
• Réagir sur l’événement de saisie
Windows Phone 8 alphorm.com™©
![Page 54: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/54.jpg)
25/08/2014
54
Les onglets avec Pivot
• Le contrôle Pivot permet de présenter plusieurs onglets
• Navigation facile, avec une description différente dans chaque partie
• Le contrôle Pivot est à la base d’un type de projet Visual
Windows Phone 8 alphorm.com™©
![Page 55: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/55.jpg)
25/08/2014
55
Scrolling et application bar
• Le scrolling va être automatique si la surface n’est pas suffisante
• La barre de boutons 8.1 est différente de celle de 8
� AppBarButton
� AppBarToggleButton
Windows Phone 8 alphorm.com™©
![Page 56: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/56.jpg)
25/08/2014
56
Ce qu’on a couvert
• La richesse des contrôles
• La liaison entre contrôles et données permet d’économiser pas mal de code
• Les onglets avec Pivot permettent de construire une ihm plus riche
Windows Phone 8 alphorm.com™©
FIN
![Page 57: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/57.jpg)
25/08/2014
57
Construire une application
Gestion des événements
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Gestion des événements
![Page 58: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/58.jpg)
25/08/2014
58
Plan
• Principe des callbacks en XAML/C#
• Les événements disponibles sur les contrôles
• Le modèle de commandes
• Le modèle MVVM
Windows Phone 8 alphorm.com™©
![Page 59: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/59.jpg)
25/08/2014
59
Principe des callback
• Une fonction de rappel est déclenchée lorsqu’un événement est levé
• La fonction de rappel est typiquement écrite en C#
• La fonction peut être branchée
� Lors du chargement du formulaire, en C#
Windows Phone 8 alphorm.com™©
� Dans la description du contrôle, en XAML
• La callback, ou fonction de rappel, est le « event handler »
![Page 60: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/60.jpg)
25/08/2014
60
Les événements disponibles sur les contrôles
• Chaque contrôle propose un ensemble d’événements
• Un événement est un message émis en réponse à une action utilisateur ou à la logique interne
• Le « event handler » reçoit 2 ,paramètres
� L’émetteur de l’événement
Windows Phone 8 alphorm.com™©
� L’émetteur de l’événement
� Un objet d’une sous-classe de EventArgs
• Les RoutedEvents sont spécifiques UI WP, et peuvent remonter les contrôles parents
![Page 61: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/61.jpg)
25/08/2014
61
Le modèle MVVM
• Model View ViewModel
� Model : les objets de donnée
� View : la page XAML
� ViewModel : un objet lié par DataContext de la View
• Les binding vont faire le lien entre les contrôles et les propriétés du
Windows Phone 8 alphorm.com™©
• Les binding vont faire le lien entre les contrôles et les propriétés du ViewModel
![Page 62: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/62.jpg)
25/08/2014
62
Le modèle de commande
• Repose sur l’utilisation de ICommand
• Créer une classe qui :
� Implémente les méthodes Execute et CanExecute
� Expose un événement CanExecuteChanged
• Cette classe délègue au ViewModel l’exécution réelle
Windows Phone 8 alphorm.com™©
• Cette classe délègue au ViewModel l’exécution réelle
� Func<P,R> : représente une fonction paramètre type P, retour type R
� Action<P> : représente une procédure de paramètre de type P
![Page 63: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/63.jpg)
25/08/2014
63
Ce qu’on a couvert
• Les gestionnaires d’événements se connectent sur les contrôles
• Les contrôles présentent des événements auxquels s’baonner
� Certains événements sont routés vers les parents au besoin
• Les commandes sont des objets qui sont connectés aux contrôles
Windows Phone 8 alphorm.com™©
• Le modèle MVVM simplifie la maintenance de l’application
FIN
![Page 64: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/64.jpg)
25/08/2014
64
Construire une application
Les gestion des erreurs
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Les gestion des erreurs
![Page 65: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/65.jpg)
25/08/2014
65
Plan
• Les exceptions CLR
• Les exceptions dans la validation
� BindingValidationError
• Les déclarations de capacités dans le manifest
Windows Phone 8 alphorm.com™©
� UnauthorizedAccessException
• Ne pas laisser passer d’exceptions, requis par la certification
![Page 66: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/66.jpg)
25/08/2014
66
Les exceptions CLR
• Le framework DotNet signale les erreurs exceptionnelles par exceptions
• Une exception est un objet d’une classe héritant de la classe Exception
� SystemException, ApplicationException
• Une exception capte un contexte d’erreur
Windows Phone 8 alphorm.com™©
� Création de l’objet exception en passant des paramètres
� Levée avec throw
• Un gestionnaire d’erreur récupère ces informations
Mots-clés try / catch/ finally
![Page 67: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/67.jpg)
25/08/2014
67
Les exceptions dans la validation
• En mode two-way, le modèle est mis à jour
• Le modèle lève une exception en cas d’erreur
• Dans le XAML, utiliser un gestionnaire sur le parent du contrôle concerné par la validation
� BindingValidationError=<nom du gestionnaire>
Windows Phone 8 alphorm.com™©
� BindingValidationError=<nom du gestionnaire>
� Tester la propriété Action de l’argument (Added, Removed)
![Page 68: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/68.jpg)
25/08/2014
68
Les exceptions de capacité
• Si on tente de déclencher du code sous contrôle du manifest
• Sélectionner dans le manifest
Windows Phone 8 alphorm.com™©
![Page 69: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/69.jpg)
25/08/2014
69
Ce qu’on a couvert
• Les exceptions CLR
• Les exceptions dans la validation
� BindingValidationError
• Les déclarations de capacités dans le manifest
Windows Phone 8 alphorm.com™©
� UnauthorizedAccessException
• Ne pas laisser passer d’exceptions, requis par la certification
FIN
![Page 70: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/70.jpg)
25/08/2014
70
Construire une application
Les ressources images
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Les ressources images
![Page 71: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/71.jpg)
25/08/2014
71
Plan
• Le répertoire Assets
• Les images en tant que contenu ou ressource
• Lier une image à XAML
• Charger une image en C#
Windows Phone 8 alphorm.com™©
• Les images dans la publication de l’application
• Les images et les tuiles
![Page 72: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/72.jpg)
25/08/2014
72
Le répertoire Assets
• Le répertoire Assets est fourni avec quelques images-types
• En général, il existe 3 tailles d’images, et le système va les mettre à l’échelle en fonction de la résolution de l’appareil
• La référence vers l’image se fait en spécifiant le chemin
• Les formats sont : jpg, png, bmp, gif, tiff, ico
Windows Phone 8 alphorm.com™©
• Les formats sont : jpg, png, bmp, gif, tiff, ico
• Pour charger une image, Image ou ImageBrush
![Page 73: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/73.jpg)
25/08/2014
73
Les images, contenu ou ressource
• Action de build sur l’image : Contenu vs Ressource
� Contenu : packagé, mais pas dans l’assembly, obligatoire pour contrôles
� Ressource : dans l’assembly, problème de temps de chargement initial
Windows Phone 8 alphorm.com™©
![Page 74: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/74.jpg)
25/08/2014
74
Les images en XAML
• Balise Image, propriété Source
Windows Phone 8 alphorm.com™©
![Page 75: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/75.jpg)
25/08/2014
75
Les images en C#
• Possibilité de positionner les images sources
Windows Phone 8 alphorm.com™©
![Page 76: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/76.jpg)
25/08/2014
76
Les images pour publier l’application
• Certaines images sont indispensables à la création du package
� Icône d’application 300x300
• Images optionnelles de promotion
• Pour publication dans le Store, au moins une capture d’écran (8 max)
Windows Phone 8 alphorm.com™©
• Les règles sont différentes dans le Windows Store
![Page 77: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/77.jpg)
25/08/2014
77
Les images et les tuiles
• Les tuiles peuvent être « flip », « cycle » ou « iconic »
� Une icône : taille small (71x110)+ medium (134x202)
� Cyclique : 1 small (159x159) + 9 maxi medium
� Flip : 3 front et 3 back
• Les images sont fournies selon différentes résolutions
Windows Phone 8 alphorm.com™©
• Les images sont fournies selon différentes résolutions
• La taille des images affichées est choisie par l’utilisateur
![Page 78: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/78.jpg)
25/08/2014
78
Ce qu’on a couvert
• Le répertoire Assets
• Les ressources en tant que contenu ou ressource
• Lier une image à XAML
• Charger une image en C#
Windows Phone 8 alphorm.com™©
• Les images dans la publication de l’application
• Les images et les tuiles
FIN
![Page 79: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/79.jpg)
25/08/2014
79
Le déploiement
Le compte développeur
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Le compte développeur
![Page 80: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/80.jpg)
25/08/2014
80
Plan
• Créer un compte développeur
• Le site dev.windows.com
Windows Phone 8 alphorm.com™©
![Page 81: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/81.jpg)
25/08/2014
81
Le site dev.windows.com
• Centre de développement
• Tableau de bord, pour suivi des applications
• Accès à la publication des applications
Windows Phone 8 alphorm.com™©
![Page 82: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/82.jpg)
25/08/2014
82
Créer un compte développeur
• Infos compte Microsoft
• Information de carte de crédit
• Compte individuel ou entreprise
Windows Phone 8 alphorm.com™©
![Page 83: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/83.jpg)
25/08/2014
83
Ce qu’on a couvert
• Créer un compte développeur
• Le site dev.windows.com
Windows Phone 8 alphorm.com™©
FIN
![Page 84: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/84.jpg)
25/08/2014
84
Le déploiement
Le manifest
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Le manifest
![Page 85: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/85.jpg)
25/08/2014
85
Plan
• Définition
• Contenu
Windows Phone 8 alphorm.com™©
![Page 86: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/86.jpg)
25/08/2014
86
Définition
• Le « manifest » est un document XML
• Contient les infos pour déployer, afficher et mettre à jour l’application
Windows Phone 8 alphorm.com™©
![Page 87: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/87.jpg)
25/08/2014
87
Contenu
• Identité du package
• Dépendances
• Capacités requises
• Elements visuels
Windows Phone 8 alphorm.com™©
• Points d’extension
![Page 88: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/88.jpg)
25/08/2014
88
Ce qu’on a couvert
• Définition
• Contenu
Windows Phone 8 alphorm.com™©
FIN
![Page 89: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/89.jpg)
25/08/2014
89
Le déploiement
Le package
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Le package
![Page 90: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/90.jpg)
25/08/2014
90
Plan
• Construire le package
• Le Kit de certification
• Soumettre l’application
Windows Phone 8 alphorm.com™©
![Page 91: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/91.jpg)
25/08/2014
91
Construire le package
• Sous Visual Studio
• Ensuite le package généré sera
� Directement utilisé sur un téléphone déverrouillé
� Téléchargé dans le Windows Phone Store
Utilisé dans un émulateur Windows Phone
Windows Phone 8 alphorm.com™©
� Utilisé dans un émulateur Windows Phone
• Nécessite un compte développeur
![Page 92: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/92.jpg)
25/08/2014
92
Le Kit de certification
• Livré avec le SDK
• Accessible en tant qu’application sous Windows
• Ou bien lancée directement via Visual Studio
Windows Phone 8 alphorm.com™©
![Page 93: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/93.jpg)
25/08/2014
93
Soumettre l’application
• La soumission comprend :
� Les infos rentrées à la soumission
� Le package d’application
• Différents états, 12 possibles
• A suivre dans le tableau de bord
Windows Phone 8 alphorm.com™©
• A suivre dans le tableau de bord
![Page 94: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/94.jpg)
25/08/2014
94
Ce qu’on a couvert
• Construire le package
• Le Kit de certification
• Soumettre l’application
Windows Phone 8 alphorm.com™©
FIN
![Page 95: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/95.jpg)
25/08/2014
95
Le déploiement
L’internationalisation
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
L’internationalisation
![Page 96: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/96.jpg)
25/08/2014
96
Plan
• Traduction des ressources utilisateur
• L’internationalisation de ressources image, audio, vidéo…
Windows Phone 8 alphorm.com™©
![Page 97: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/97.jpg)
25/08/2014
97
Traduction des ressources utilisateur
• Définir la langue par défaut « fr-FR »
• Créer les dossiers et fichiers de ressources
� Strings/fr-FR/Resources.resw
• Les éléments visuels portent un attribut x:Uid
Windows Phone 8 alphorm.com™©
� X:Uid=<nom de la chaîne>
• Dans le code, accès via
� Windows.ApplicationModel.Resources.ResourceLoader() . GetString(<nom>)
![Page 98: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/98.jpg)
25/08/2014
98
Ressources audio, vidéo…
• Consommateur de ressources systèmes
• Utiliser si possible des ressources neutres
• Fichiers nommés par qualificateurs de ressources
� Images/fr-FR/logo.scale-100_contrast-white.png
Windows Phone 8 alphorm.com™©
� Images/logo.png
![Page 99: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/99.jpg)
25/08/2014
99
Ce qu’on a couvert
• Traduction des ressources utilisateur
• L’internationalisation de ressources image, audio, vidéo…
Windows Phone 8 alphorm.com™©
FIN
![Page 100: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/100.jpg)
25/08/2014
100
Les interfaces graphiques
Les différents types
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Les différents types d’interfaces
![Page 101: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/101.jpg)
25/08/2014
101
Plan
• L’application vide
• L’application Hub ou Panorama
• L’application Pivot
• L’application Webview ou HTML
Windows Phone 8 alphorm.com™©
![Page 102: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/102.jpg)
25/08/2014
102
L’application vide
• L’ihm est quasi vide, selon qu’on prend Silverlight ou non
• Libre choix de la construction de l’interface graphique
• Nécessité de créer des pages entre lesquelles il faut naviguer
• Les layouts : Grid, StackPanel, Canvas
Windows Phone 8 alphorm.com™©
![Page 103: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/103.jpg)
25/08/2014
103
L’application Hub ou Panorama
• Le Hub, ou Panorama est une organisation particulière de l’application
• Un contrôle Hub (Panorama) et des contrôles HubSection(PanoramaItem)
• Le contrôle Hub offre : Background, Title, Items
Windows Phone 8 alphorm.com™©
![Page 104: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/104.jpg)
25/08/2014
104
L’application Pivot
• L’application Pivot met en avant un découpage de groupes en items
• Les contrôles à utiliser sont Pivot et Pivot Item
• Le databinding est ici très utile
Windows Phone 8 alphorm.com™©
![Page 105: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/105.jpg)
25/08/2014
105
L’application Webview ou HTML
• Une application basée sur un contrôles WebView
• Edition de pages HTML
• Une interface web, basée sur du HTML
Windows Phone 8 alphorm.com™©
![Page 106: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/106.jpg)
25/08/2014
106
Ce qu’on a couvert
• L’application vide
• L’application Hub ou Panorama
• L’application Pivot
• L’application Webview ou HTML
Windows Phone 8 alphorm.com™©
FIN
![Page 107: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/107.jpg)
25/08/2014
107
Les interfaces graphiques
La navigation
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
La navigation
![Page 108: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/108.jpg)
25/08/2014
108
Plan
• OnNavigatedFrom / OnNavigatedTo
• NavigationService
• Frame : Navigate, GoBack, GoForward
• NavigationHelper / SyspensionManager
Windows Phone 8 alphorm.com™©
![Page 109: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/109.jpg)
25/08/2014
109
OnNavigatedFrom / OnNavigatedTo
• La construction des pages : hyperlink / Navigate
• La maintenance de l’état de la page ne doit donc pas être fait dans le constructeur, ni Loaded ou LayoutUpdated
Windows Phone 8 alphorm.com™©
![Page 110: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/110.jpg)
25/08/2014
110
NavigationService
• Disponible pour Silverlight 8.1
• Founir l’URI de la page cible
• NavigationService.Navigate(new Uri( …))
Windows Phone 8 alphorm.com™©
![Page 111: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/111.jpg)
25/08/2014
111
Frame
• Sur la classe Frame :
� Navigate
� GoBack
� GoForward
• Exemple :
Windows Phone 8 alphorm.com™©
• Exemple :
� Frame.Navigate(typeof(AutrePage));
• Dans App.cs, Navigate sur rootFrame pour charger la première
![Page 112: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/112.jpg)
25/08/2014
112
SuspensionManager / NavigationHelper
• SuspensionManager
� Une classe fournie dans certains types de projets
� Simplifie la gestion de l’état de l’application
� Propose un dictionnaire, SessionState
• NavigationHelper
Windows Phone 8 alphorm.com™©
• NavigationHelper
� Chargé de rappeler LoadState/SaveState de la page
� Utiliser (EventArgs) e .PageState
![Page 113: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/113.jpg)
25/08/2014
113
Ce qu’on a couvert
• OnNavigatedFrom / OnNavigatedTo
• NavigationService
• Frame : Navigate, GoBack, GoForward
• NavigationHelper / SuspensionManager
Windows Phone 8 alphorm.com™©
FIN
![Page 114: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/114.jpg)
25/08/2014
114
Les interfaces graphiques
L’interface DirectX
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
L’interface DirectX
![Page 115: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/115.jpg)
25/08/2014
115
Plan
• L’application DirectX
� Ne permet pas le mixage XAML/C++
• L’application DirectX et XAML
� Une surface de dessin DirectX dimensionnée, intégrée dans un projet XAML
Composant SurfaceImageSource
Windows Phone 8 alphorm.com™©
• Composant SurfaceImageSource
� Une grande image, sur laquelle on zoom
• Composant VirtualSurfaceImageSource
� Des images en temps réel
• Composant SwapChainPanel
![Page 116: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/116.jpg)
25/08/2014
116
L’application DirectX
• La fenêtre complète est occupée par un objet de rendu graphique
• Une boucle dans laquelle :
� On met à jour le contenu
� On affiche directement
• Les actions de l’utilisateur sont redirigées
Windows Phone 8 alphorm.com™©
• Les actions de l’utilisateur sont redirigées
![Page 117: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/117.jpg)
25/08/2014
117
XAML et DirectX
• Possibilité de mixer XAML et accès direct à l’affichage
• Moindre performance
Windows Phone 8 alphorm.com™©
![Page 118: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/118.jpg)
25/08/2014
118
Ce qu’on a couvert
• L’application DirectX
� Ne permet pas le mixage XAML/C++
• L’application DirectX et XAML
� Une surface de dessin DirectX dimensionnée, intégrée dans un projet XAML
Composant SurfaceImageSource
Windows Phone 8 alphorm.com™©
• Composant SurfaceImageSource
� Une grande image, sur laquelle on zoom
• Composant VirtualSurfaceImageSource
� Des images en temps réel
• Composant SwapChainPanel FIN
![Page 119: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/119.jpg)
25/08/2014
119
Les interfaces graphiques
Action et multitouch
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Action et multitouch
![Page 120: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/120.jpg)
25/08/2014
120
Plan
• Les mouvements utilisateur
• Les niveaux de traitements
Windows Phone 8 alphorm.com™©
![Page 121: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/121.jpg)
25/08/2014
121
Les mouvements utilisateur
• Tap : un doigt touche et relâche
• DoubleTap : 2 taps
• Hold : un doigt touche et reste en place
• Pan/Drag : un doigt touche et bouge un contenu(Pan : le contenu est plus grand que l’écran)
Windows Phone 8 alphorm.com™©
plus grand que l’écran)
• Flick : un doigt touche et se déplace en dehors de l’écran
• Pinch : 2 doigts touchent et se rapprochent
• Stretch : 2 doigts touchent et s’écartent
![Page 122: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/122.jpg)
25/08/2014
122
Les niveaux de traitements
• Evénements bas-niveau (Manipulation)
• On- méthodes bas niveau
• Evénements haut-niveau
• On- méthodes haut niveau
Windows Phone 8 alphorm.com™©
• FrameReported Event
![Page 123: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/123.jpg)
25/08/2014
123
Ce qu’on a couvert
• Les mouvements utilisateur
• Les niveaux de traitements
Windows Phone 8 alphorm.com™©
FIN
![Page 124: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/124.jpg)
25/08/2014
124
Les interactions avec le système
Le cycle de vie
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Le cycle de vie
![Page 125: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/125.jpg)
25/08/2014
125
Plan
• Règles générales
• Les états d’une application
• Scénarios
• Les méthodes de App : OnLaunched, OnActivated, Suspending, Resuming
Windows Phone 8 alphorm.com™©
Resuming
![Page 126: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/126.jpg)
25/08/2014
126
Les états d’une application
• NotRunning -> Activated -> Running
• Running -> Suspending -> Suspended
• Suspended -> Resuming -> Running
• Suspended -> NotRunning
Windows Phone 8 alphorm.com™©
![Page 127: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/127.jpg)
25/08/2014
127
Règles générales
• Il peut y avoir plusieurs applications tournant en même temps, mais une seule est active
• Seule l’application active peut activer une autre application
• Il n’y a qu’une seule page active
• L’utilisateur peut toujours revenir au départ
Windows Phone 8 alphorm.com™©
• L’utilisateur peut toujours revenir au départ
• L’utilisateur peut toujours faire un back, retour vers la page précédente ou vers l’application précédente
• Une application vers laquelle on fait un forward doit se présenter comme précédemment
![Page 128: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/128.jpg)
25/08/2014
128
Les scénarios
• Une application recharge ses données lorsqu’elle reçoit l’événement Launch
• Un test sur PreviousExecutionState permettra de savoir si elle doit recharger ses données ou non
• Lors de la suspension, il faudra sauvegarder les données associées, libérer les ressources
Windows Phone 8 alphorm.com™©
libérer les ressources
• Il n’y a pas de notification lors de la terminaison éventuelle
![Page 129: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/129.jpg)
25/08/2014
129
Les méthodes de App
• OnLaunched : une nouvelle instance de l’application est lancée
• OnActivated : l’application est active, il faut restaurer l’état
• Suspending : on passe en arrière plan, peut être terminée plus tard
• Resuming : avant activation, si un gestionnaire est enregistré
Windows Phone 8 alphorm.com™©
• Ne pas oublier OnNavigatedFrom et OnNavigatedTo
![Page 130: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/130.jpg)
25/08/2014
130
Ce qu’on a couvert
• Règles générales
• Les états d’une application
• Scénarios
• Les méthodes de App : OnLaunched, OnActivated, Suspending, Resuming
Windows Phone 8 alphorm.com™©
Resuming
FIN
![Page 131: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/131.jpg)
25/08/2014
131
Les interactions avec le système
Launchers et choosers
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Launchers et choosersEt équivalents sous 8.1
![Page 132: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/132.jpg)
25/08/2014
132
Plan
• Windows Phone 8.0
� Launchers
• Lance une application et ne retourne rien
� Choosers
• Lance une application et retourne quelque chose
Windows Phone 8 alphorm.com™©
• Lance une application et retourne quelque chose
• Windows Phone 8.1
� Microsoft.Phone.Tasks n’existe pas
![Page 133: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/133.jpg)
25/08/2014
133
Launchers
• BingMapsTask
• ConnectionSettingsTask
• EmailComposeTask
• PhoneCallTask
Windows Phone 8 alphorm.com™©
• …
• Dans l’espace de nommage Microsoft.Phone.Tasks
![Page 134: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/134.jpg)
25/08/2014
134
Choosers
• AddressChooserTask
• PhotoChooserTask
• SaveContactTask
• …
Windows Phone 8 alphorm.com™©
• Ces tâches sont prévues pour retourner une information
![Page 135: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/135.jpg)
25/08/2014
135
Sous Windows Phone 8.1 …
• Lancer un appel téléphonique …
• Utiliser PhoneCallManager
• Espace de nommage Windows.ApplicationModel.Calls
Windows Phone 8 alphorm.com™©
![Page 136: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/136.jpg)
25/08/2014
136
Sous Windows Phone 8.1 …
• La gestion des medias via MediaCapture
• Récupérer une photo via FileOpenPicker …
• …
• Espace de nommage Windows.Storage.Pickers
Windows Phone 8 alphorm.com™©
![Page 137: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/137.jpg)
25/08/2014
137
Ce qu’on a couvert
• Launchers
� Lance une application et ne retourne rien
• Choosers
� Lance une application et retourne quelque chose
L’équivalent sous Windows Phone 8.1
Windows Phone 8 alphorm.com™©
L’équivalent sous Windows Phone 8.1
FIN
![Page 138: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/138.jpg)
25/08/2014
138
Les interactions avec le système
Les settings
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Les settings
![Page 139: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/139.jpg)
25/08/2014
139
Plan
• ApplicationData
• Exemple de code pour sauver les paramètres
• Exemple de code pour charger les paramètres
Windows Phone 8 alphorm.com™©
![Page 140: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/140.jpg)
25/08/2014
140
ApplicationData
• Classe de Windows.Storage
• Disponible à partir de Windows Phone 8.1
• Emplacement des données géré par le système
� Local : sur le matériel courant et le cloud
Roaming : pour tous les matériels sur lequel cette app est installée
Windows Phone 8 alphorm.com™©
� Roaming : pour tous les matériels sur lequel cette app est installée
� Temporary : les données peuvent disparaître n’importe quand
� Localcache : données qui n’existent QUE sur ce matériel
• Possibilités de versionner les data
![Page 141: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/141.jpg)
25/08/2014
141
Exemple de code pour sauver les paramètres
• var appData = Windows.Storage.ApplicationData.Current;
• var localSettings = appData.LocalSettings;
• localSettings.Values["NomUtilisateur"] = nom.Text;
Windows Phone 8 alphorm.com™©
![Page 142: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/142.jpg)
25/08/2014
142
Exemple pour charger les paramètres
• var appData = Windows.Storage.ApplicationData.Current;
• var localSettings = appData.LocalSettings;
• if (localSettings.Values.ContainsKey("Nom"))
Windows Phone 8 alphorm.com™©
• {
• nom.Text = localSettings.Values["Nom"].ToString();
• }
![Page 143: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/143.jpg)
25/08/2014
143
Ce qu’on a couvert
• ApplicationData
• Exemple de code pour sauver les paramètres
• Exemple de code pour charger les paramètres
Windows Phone 8 alphorm.com™©
FIN
![Page 144: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/144.jpg)
25/08/2014
144
Les interactions avec le système
Le stockage local
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Le stockage local
![Page 145: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/145.jpg)
25/08/2014
145
Plan
• ApplicationData
• Stockage « local » ou « roaming »
• Stockage temporaire
Windows Phone 8 alphorm.com™©
![Page 146: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/146.jpg)
25/08/2014
146
Windows.Storage.ApplicationData
• Current
• LocalFolder
• LocalSettings
• RoamingFolder
Windows Phone 8 alphorm.com™©
• RoamingSettings
• RoamingStorageQuota
• TemporaryFolder
• Version
![Page 147: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/147.jpg)
25/08/2014
147
Stockage local
• Propriété LocalFolder de ApplicationData
• Pour des données larges
• Valable pour le matériel local uniquement
Windows Phone 8 alphorm.com™©
![Page 148: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/148.jpg)
25/08/2014
148
Stockage roaming
• Propriété RoamingFolder de ApplicationData
• Le stockage des données est synchronisé entre plusieurs matériels sur lesquels l’application est installée
• Les données sont limitées en taille
• On peut s’abonner à une événement DataChanged qui signale que les
Windows Phone 8 alphorm.com™©
• On peut s’abonner à une événement DataChanged qui signale que les données ont changé
• Les données sont liées aux versions
![Page 149: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/149.jpg)
25/08/2014
149
Stockage temporaire
• Propriété TemporaryFolder
• Le système peut nettoyer les données
• L’utilisateur peut nettoyer les données
Windows Phone 8 alphorm.com™©
![Page 150: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/150.jpg)
25/08/2014
150
Ce qu’on a couvert
• ApplicationData
• Stockage « local » ou « roaming »
• Stockage temporaire
Windows Phone 8 alphorm.com™©
FIN
![Page 151: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/151.jpg)
25/08/2014
151
Les interactions avec le système
Les fichiers et répertoires
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Les fichiers et répertoires
![Page 152: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/152.jpg)
25/08/2014
152
Plan
• Généralités
• Le répertoire d’installation
• Les FileOpenPicker et FolderPicker
• Les répertoires supplémentaires
Windows Phone 8 alphorm.com™©
![Page 153: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/153.jpg)
25/08/2014
153
Généralités
• Lecture et écriture asynchrone
• Les méthodes asynchrones s’appellent avec « await »
• Obtenir un StorageFile ou un StorageFolder
� StorageFile f = await sd.CreateFileAsync("data.txt", CreationCollisionOption.ReplaceExisting);
Windows Phone 8 alphorm.com™©
CreationCollisionOption.ReplaceExisting);
• Ecrire dans un fichier
� await FileIO.WriteTextAsync(f, "Voici les données ...");
• Espace de nommage Windows.Storage
![Page 154: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/154.jpg)
25/08/2014
154
Les répertoires
• Le répertoire d’installation
� StorageFolder sf = Package.Current.InstalledLocation;
• Les fichiers de ce répertoire sont en lecture seule
• Préfixe « ms-appx:/// » pour accéder à un fichier de ce répertoire
Windows Phone 8 alphorm.com™©
![Page 155: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/155.jpg)
25/08/2014
155
FileOpenPicker et FolderPicker
• FileOpenPicker, méthode PickSingleFileAndContinue
• API différente entre Windows et Windows Phone
• Doit être lié via OnActivated à l’application d’origine
• FolderPicker, méthode PickFolderAndContinue
Windows Phone 8 alphorm.com™©
• …
![Page 156: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/156.jpg)
25/08/2014
156
Les répertoires supplémentaires
• KnownFolders.MusicLibrary
• KnownFolders.PicturesLibrary
• KnownFolders.VideosLibrary
• KnownFolders.HomeGroup
Windows Phone 8 alphorm.com™©
• …
![Page 157: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/157.jpg)
25/08/2014
157
Ce qu’on a couvert
• Le répertoire d’installation
• Les FileOpenPicker et FolderPicker
• Les répertoires supplémentaires
Windows Phone 8 alphorm.com™©
FIN
![Page 158: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/158.jpg)
25/08/2014
158
Les interactions avec le système
SQL
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
SQL
![Page 159: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/159.jpg)
25/08/2014
159
Plan
• SQLite
• Créer une base
• Insérer une élément
• Récupérer les infos
Windows Phone 8 alphorm.com™©
![Page 160: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/160.jpg)
25/08/2014
160
SQLite
• SQLite et SQLitePCL
• Installés via les extensions et Nuget
• Espace de nommage SQLite
• SQLite s’utilise via Linq
Windows Phone 8 alphorm.com™©
• SQLitePCL permet d’accéder bas niveau au SQL
![Page 161: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/161.jpg)
25/08/2014
161
Créer un élément• conn = new SQLiteConnection("data.db");
• string sql = @"CREATE TABLE IF NOT EXISTS LIVRE(
• Id INTEGER PRIMARY KEY AUTOINCREMENT NOt NULL,
• Titre VARCHAR(100),
• ISBN VARCHAR(100),
Windows Phone 8 alphorm.com™©
• ISBN VARCHAR(100),
• Auteur VARCHAR(100));";
• using (var st = conn.Prepare(sql))
• {
• st.Step();
• }
![Page 162: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/162.jpg)
25/08/2014
162
Insérer un élément
• using(var l = conn.Prepare("INSERT INTO Livre(Titre,ISBN,Auteur) Values(?,?,?)") ){
• l.Bind(1,"Promenades et randonnées …");
• l.Bind(2,"2-9506274-4-7");
• l.Bind(3,"FFRP");
• l.Step();
Windows Phone 8 alphorm.com™©
• }
![Page 163: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/163.jpg)
25/08/2014
163
Sélectionner
• using (var st = App.conn.Prepare("SELECT * FROM Livre"))
• {
• var res = st.Step();
• if (SQLiteResult.ROW == res)
• {
Windows Phone 8 alphorm.com™©
• {
• Titre.Text = st[0].ToString();
• ISBN.Text = st[1].ToString();
• Auteur.Text = st[2].ToString();
• }
• }
![Page 164: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/164.jpg)
25/08/2014
164
Ce qu’on a couvert
• SQLite
• Créer une base
• Insérer un élément
• Récupérer les infos
Windows Phone 8 alphorm.com™©
FIN
![Page 165: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/165.jpg)
25/08/2014
165
Les accès réseau
Les accès au Web
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Les accès au Web
![Page 166: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/166.jpg)
25/08/2014
166
Plan
• HttpClient
• Méthodes Delete, Get, Put, Post
• HttpResponseMessage
• Cookies et en-têtes HTTP
Windows Phone 8 alphorm.com™©
![Page 167: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/167.jpg)
25/08/2014
167
HttpClient
• Windows.Web.Http.HttpClient
• Classe à instancier
• Méthode GetStringAsync(uri) retourne le contenu
• Ne pas oublier l’appel à Dispose
Windows Phone 8 alphorm.com™©
![Page 168: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/168.jpg)
25/08/2014
168
Méthodes
• GetAsync(uri) : requête GET
• PostAsync(uri) : requête POST
• PutAsync(uri) : requête PUT
• DeleteAsync(uri) : requête DELETE
Windows Phone 8 alphorm.com™©
• SendRequestAsync(HttpRequestMessage) : requête générique
![Page 169: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/169.jpg)
25/08/2014
169
HttpResponseMessage
• Class de Windows.Web.Http
• Réponse à la requête avec en-têtes, code d’état et données
• Propriétés
� Content
Windows Phone 8 alphorm.com™©
� StatusCode
� IsSuccessStatusCode
� Headers
� Version
![Page 170: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/170.jpg)
25/08/2014
170
Cookies et en-têtes
• Sur la classe HttpClient
� DefaultRequestHeaders
� Classe …Headers.HttpRequestHeadersCollection
� Propriétés :
• UserAgent
Windows Phone 8 alphorm.com™©
• UserAgent
• Cookies
• …
![Page 171: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/171.jpg)
25/08/2014
171
Ce qu’on a couvert
• HttpClient
• Méthodes Delete, Get, Put, Post
• HttpResponseMessage
• Cookies et en-têtes HTTP
Windows Phone 8 alphorm.com™©
FIN
![Page 172: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/172.jpg)
25/08/2014
172
Les accès réseau
Les services WCF
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Les services WCF
![Page 173: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/173.jpg)
25/08/2014
173
Plan
• Les services WCF
• Créer un service WCF
• Consommer un service
Windows Phone 8 alphorm.com™©
![Page 174: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/174.jpg)
25/08/2014
174
Les services WCF
• Un sur-ensemble des services distants
• Sépare l’implémentation de la description du service
• Souplesse accrue
• Tuyauterie de présentation du service non codée
Windows Phone 8 alphorm.com™©
![Page 175: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/175.jpg)
25/08/2014
175
Créer un service WCF
• Un type de projet WCF
• Implémentation du service dans une classe
• Représentation du service par une interface
• Description du service dans un fichier de configuration
Windows Phone 8 alphorm.com™©
• Web services : BasicHttpBinding, WsHttpBinding, WebHttpBinding
![Page 176: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/176.jpg)
25/08/2014
176
Consommer un service
• Laisser VS créer un proxy pour s’occuper de la tuyauterie
• Lui fournir un fichier svc
• Accéder aux méthodes du proxy
Windows Phone 8 alphorm.com™©
![Page 177: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/177.jpg)
25/08/2014
177
Ce qu’on a couvert
• Les services WCF
• Créer un service WCF
• Consommer un service
Windows Phone 8 alphorm.com™©
FIN
![Page 178: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/178.jpg)
25/08/2014
178
Les accès réseau
Les services mobiles
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Les services mobiles
![Page 179: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/179.jpg)
25/08/2014
179
Plan
• Le compte Azure
• Définir un service mobile
• Utiliser le service mobile
Windows Phone 8 alphorm.com™©
![Page 180: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/180.jpg)
25/08/2014
180
Le compte Azure
• Adresse azure.microsoft.com
• Version d’évaluation gratuite, version payante ou compte développeur msdn
Windows Phone 8 alphorm.com™©
![Page 181: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/181.jpg)
25/08/2014
181
Définir un service mobile
• Fournir une url
• Lier une base de données
Windows Phone 8 alphorm.com™©
![Page 182: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/182.jpg)
25/08/2014
182
Utiliser un service mobile
• Etablir la connexion
• Accéder aux tables
• Procéder avec les applications générées
Windows Phone 8 alphorm.com™©
![Page 183: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/183.jpg)
25/08/2014
183
Ce qu’on a couvert
• Le compte Azure
• Définir un service mobile
• Utiliser le service mobile
Windows Phone 8 alphorm.com™©
FIN
![Page 184: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/184.jpg)
25/08/2014
184
Les accès réseau
Les services de notifications
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Les services de notifications Push
![Page 185: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/185.jpg)
25/08/2014
185
Plan
• Les étapes
• PushNotificationChannelManager
• HttpNotificationChannel
Windows Phone 8 alphorm.com™©
![Page 186: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/186.jpg)
25/08/2014
186
Les étapes
• Enregistrer son application dans le Store
• Associer sous Visual Studio le projet avec l’appli dans le Store
• Dans le Windows Dev Center, visiter la page des services
� positionner client ID et client Secret
Windows Phone 8 alphorm.com™©
• Sur le service Azure, indiquer les 2 infos préalables
• Mettre en place le code
� Dans l’application Windows Phone 8.1
� Dans l’application serveur
![Page 187: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/187.jpg)
25/08/2014
187
PushNotificationChannelManager
• Espace de nommage Windows.Networking.PushNotifications
• Créer les objets à utiliser pour recevoir les notifications
• On va les lier ensuite à une application ou à une tuile
• .CreatePushNotificationChannelForApplicationAsync();
Windows Phone 8 alphorm.com™©
• On enregister le PushNotificationChannel résultant
![Page 188: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/188.jpg)
25/08/2014
188
HttpNotificationChannel
• Espace de nommage Miscrosoft.Phone.Notification
• Propriétés
� ChannelName
� ChannelUri
ConnectionStatus
Windows Phone 8 alphorm.com™©
� ConnectionStatus
� IsShellTileBound
� IsShellToastBound
![Page 189: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/189.jpg)
25/08/2014
189
Sur le serveur
• Lorsque la notification doit être faite …
• Créer un WindowsPushMessage
• Le construire (XML)
• L’envoyer : Services.Push.SendAsync(msg)
Windows Phone 8 alphorm.com™©
![Page 190: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/190.jpg)
25/08/2014
190
Détails
• Les notifications peuvent être récupérées
� Par un toast
� Par une tuile
• Les méthodes du manager à utiliser sont différentes
Windows Phone 8 alphorm.com™©
![Page 191: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/191.jpg)
25/08/2014
191
Ce qu’on a couvert
• Les étapes
• PushNotificationChannelManager
• HttpNotificationChannel
Windows Phone 8 alphorm.com™©
FIN
![Page 192: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/192.jpg)
25/08/2014
192
Les capteurs
L’accéléromètre
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
L’accéléromètre
![Page 193: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/193.jpg)
25/08/2014
193
Plan
• Les événements de données
• Récupérer les données à intervalles réguliers
• Motion, outil de synthèse des infos de mouvement
Windows Phone 8 alphorm.com™©
![Page 194: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/194.jpg)
25/08/2014
194
Les événements de données
• Espaces de nommage :
� Microsoft.Devices.Sensors
• Classe Accelerometer
• Testable IsSupported
Windows Phone 8 alphorm.com™©
• Evenement Reading
• AccelerometerReading.Acceleration
![Page 195: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/195.jpg)
25/08/2014
195
Récupérer les données
• AccelerometerReading
• Accelerometer.GetCurrentReading()
Windows Phone 8 alphorm.com™©
![Page 196: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/196.jpg)
25/08/2014
196
Motion
• Créer un objet Motion
• Il rassemble les informations des senseurs
• Start pour le démarrer
• CurrentValue ou bien CurrentValueChanged pour récupérer les données
Windows Phone 8 alphorm.com™©
![Page 197: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/197.jpg)
25/08/2014
197
Ce qu’on a couvert
• Les événements de données
• Récupérer les données à intervalles réguliers
• Motion
Windows Phone 8 alphorm.com™©
FIN
![Page 198: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/198.jpg)
25/08/2014
198
Les capteurs
Géolocalisation
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Géolocalisation
![Page 199: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/199.jpg)
25/08/2014
199
Plan
• Récupération de position
• L’espace de nommage Geofencing
Windows Phone 8 alphorm.com™©
![Page 200: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/200.jpg)
25/08/2014
200
Récupération de position
• Windows.Devices.Geolocation
• Classe Geolocator
• Récupérer les données de position
� par événement PositionChanged
Windows Phone 8 alphorm.com™©
� ou bien avec GetGeoPositionAsync
![Page 201: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/201.jpg)
25/08/2014
201
L’espace de nommage Geofencing
• Classe Geofence
• Définir une zone géographique et être averti lorsqu’on arrive dans cette zone
• Enregistrer un gestionnaire d’événement en rapport avec un changement d’état
Windows Phone 8 alphorm.com™©
• Fournir un point géographique
![Page 202: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/202.jpg)
25/08/2014
202
Ce qu’on a couvert
• Récupération de position
• L’espace de nommage Geofencing
Windows Phone 8 alphorm.com™©
FIN
![Page 203: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/203.jpg)
25/08/2014
203
Les capteurs
La caméra
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
La caméra
![Page 204: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/204.jpg)
25/08/2014
204
Plan
• Classe MediaCapture
• Lancer un preview
• Générer une photo à partir de la caméra
Windows Phone 8 alphorm.com™©
![Page 205: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/205.jpg)
25/08/2014
205
MediaCapture
• Espace de nommage Windows.Media.Capture
• InitializeAsync()
• StartPreviewAsync() / Stop
• CapturePhotoToStorageFileAsync()
Windows Phone 8 alphorm.com™©
![Page 206: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/206.jpg)
25/08/2014
206
Lancer un preview
• Préparer une image qui recevra la prévisualisation
• Position la propriété Source comme l’objet MediaCapture
• Lancer StartPreviewAsync
• Pour arrêter la capture, utiliser StopPreviewAsync
Windows Phone 8 alphorm.com™©
![Page 207: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/207.jpg)
25/08/2014
207
Capturer une photo
• Préparer un StorageFile (créer ou s’assurer de sa présence)
• Créer un encodage
• Utiliser CapturePhotoToStorageFileAsync
Windows Phone 8 alphorm.com™©
![Page 208: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/208.jpg)
25/08/2014
208
Ce qu’on a couvert
• Classe MediaCapture
• Lancer un preview
• Générer une photo à partir de la caméra
Windows Phone 8 alphorm.com™©
FIN
![Page 209: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/209.jpg)
25/08/2014
209
Conclusion
Windows Phone 8/8.1
Windows Phone 8 alphorm.com™©
Fabien BrissonneauConsultant, concepteur et formateurObjets Logiciels
Site : http://www.alphorm.comBlog : http://www.alphorm.com/blogForum : http://www.alphorm.com/forum
Windows Phone 8/8.1
![Page 210: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/210.jpg)
25/08/2014
210
Ce que nous avons vu …
• Présentation des outils
• La construction de l’application
• Le déploiement de l’application
• Les interfaces graphiques
Windows Phone 8 alphorm.com™©
• Les interactions avec le système
• Les accès réseau
• Les capteurs
![Page 211: Alphorm.com-Formation windows phone 8.1](https://reader033.vdocuments.us/reader033/viewer/2022052301/555dfd6ed8b42ae4628b5092/html5/thumbnails/211.jpg)
25/08/2014
211
Ne pas oublier …
• Installer Visual Studio 2013, Update 2 si vous voulez travailler sous 8.1
• Travailler sur un système Windows 8
• Disposer pour vos tests réels d’un appareil Windows Phone 8.1
Windows Phone 8 alphorm.com™©