<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Stéphanie Hertrich</title><link>http://blogs.msdn.com/b/stephe/</link><description /><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Et pendant ce temps…</title><link>http://blogs.msdn.com/b/stephe/archive/2012/10/04/et-pendant-ce-temps.aspx</link><pubDate>Thu, 04 Oct 2012 13:40:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10355903</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10355903</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/10/04/et-pendant-ce-temps.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.claudemasselot.com/"&gt;&lt;img title="20x30_2012-09-03_18-23-30_A5C1722-M" style="border: 0px currentcolor; display: inline; background-image: none;" border="0" alt="20x30_2012-09-03_18-23-30_A5C1722-M" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6560.20x30_5F00_2012_2D00_09_2D00_03_5F00_18_2D00_23_2D00_30_5F00_A5C1722_2D00_M_5F00_1.jpg" width="275" height="325" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Vous l’aurez peut-être noté, je ne suis plus très active sur mon blog, les évènements communautaires et les réseaux sociaux ces derniers temps.    &lt;br /&gt;En effet, pendant que Microsoft peaufine Windows 8 pour le 26 octobre, je prépare l’arrivée d’un petit garçon pour…la même date à 2 jours près !&lt;/p&gt;  &lt;p&gt;Je vous donne donc rendez-vous dans quelques mois pour de nouveaux défis avec plein de nouveautés d’ici là !&lt;/p&gt;  &lt;p&gt;Soyez sages !&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font size="1"&gt;Et un grand merci à &lt;a href="http://www.claudemasselot.com/"&gt;ma photographe préférée&lt;/a&gt; !&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10355903" width="1" height="1"&gt;</description></item><item><title>Windows 8 et async/await : Attention aux accès fichiers</title><link>http://blogs.msdn.com/b/stephe/archive/2012/06/11/windows-8-et-async-await-attention-aux-acc-232-s-fichiers.aspx</link><pubDate>Mon, 11 Jun 2012 12:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10318286</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10318286</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/06/11/windows-8-et-async-await-attention-aux-acc-232-s-fichiers.aspx#comments</comments><description>&lt;p&gt;Grâce à async/await, l’écriture de code asynchrone devient un jeu d’enfant…à tel point que l’on oublie parfois d’y protéger l’accès aux ressources critiques. Ce genre d’oubli provoque des erreurs d’exécution totalement aléatoires dans les applications mais la bonne nouvelle c’est que c’est très facile à corriger, surtout une fois que l’on a compris pourquoi &lt;img alt="Smile" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7827.wlEmoticon_2D00_smile_5F00_2.png" /&gt;.&lt;/p&gt;  &lt;p&gt;Un exemple typique dans les applications Windows 8 : l’accès aux fichiers. &lt;/p&gt;  &lt;p&gt;On les utilise à plus forte raison dans les applications Metro, comme par-exemple pour :&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;le fichier servant de cache off-line&lt;/li&gt;    &lt;li&gt;le fichier de sauvegarde du contexte courant de l’application&lt;/li&gt;    &lt;li&gt;le fichier contenant les données applicatives&lt;/li&gt;    &lt;li&gt;… &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Plusieurs clients m’ont remonté le fait que des exceptions sont déclenchées lors des écritures fichier, or le plus souvent, le problème provient de l’écriture du code asynchrone correspondant.&lt;/p&gt;  &lt;p&gt;Une démo vaut mieux que de longs discours, je vais donc illustrer ces propos pas à pas.&lt;/p&gt;  &lt;p&gt;D’abord, voyons le bout de code que je vais utiliser : un simple bouton dans l’appbar qui déclenche un accès fichier en écriture.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2234.image_5F00_2.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6740.image_5F00_thumb.png" width="614" height="347" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="background: white; color: black;"&gt;       &lt;font face="Consolas"&gt; &lt;/font&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;    &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;private void &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;Save_Click(&lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;object &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sender, &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;RoutedEventArgs &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;e)
    {
       SaveAsync();
    }

    &lt;/span&gt;&lt;span style="background: white; color: green;"&gt;// Write data to a file
    &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;async void &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;SaveAsync()
    {
       &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;StorageFolder &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;localFolder = Windows.Storage.&lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;ApplicationData&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.Current.LocalFolder;

       &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sampleFile = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;localFolder.CreateFileAsync(&lt;/span&gt;&lt;span style="background: white; color: rgb(163, 21, 21);"&gt;&amp;quot;dataFile.txt&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;, &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;CreationCollisionOption&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.OpenIfExists);
       &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;ws = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sampleFile.OpenStreamForWriteAsync();
&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black;"&gt;&lt;font face="Consolas"&gt;&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;
&lt;/span&gt;&lt;span style="background: white; color: green;"&gt;       // Ecriture dans mon fichier, blablabla…&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;       ws.Dispose();
&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;    }&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&amp;#160;&lt;/pre&gt;

&lt;p&gt;Au lancement de l’application, si l’on appuie plusieurs fois d’affilée sur le bouton “Save” en principe il n’y a pas de souci particulier car la méthode SaveAsync s’exécute dans un délai très court et a donc le temps de se terminer avant qu’on l’a réexécute.&lt;/p&gt;

&lt;p&gt;A présent, simulons un accès fichier plus long (5 secondes) entre l’ouverture du fichier en écriture et sa fermeture:&lt;span style="background: white; color: green;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: green;"&gt;       &lt;font face="Consolas"&gt;// Write data to a file
   &lt;/font&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: blue;"&gt;async void &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;SaveAsync()
   {
       &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;StorageFolder &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;localFolder = Windows.Storage.&lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;ApplicationData&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.Current.LocalFolder;

       &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sampleFile = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;localFolder.CreateFileAsync(&lt;/span&gt;&lt;span style="background: white; color: rgb(163, 21, 21);"&gt;&amp;quot;dataFile.txt&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;, &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;CreationCollisionOption&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.OpenIfExists);
       &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;ws = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sampleFile.OpenStreamForWriteAsync();

&lt;span style="background: white; color: black;"&gt;       &lt;/span&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;Task&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.Delay(5000);&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: green;"&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: green;"&gt;       &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;ws.Dispose();
&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;   }&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black;"&gt;&lt;font face="Consolas"&gt;&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;/pre&gt;

&lt;pre class="code"&gt;&amp;#160;&lt;span style="background: white; color: black;"&gt;Cette fois, si je clique 2 fois sur le bouton en moins de 5 secondes, une exception sera levée:&lt;/span&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3113.image_5F00_4.png"&gt;&lt;img width="362" height="281" title="image" style="display: inline; background-image: none;" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2543.image_5F00_thumb_5F00_1.png" border="0" /&gt;&lt;/a&gt;&lt;/pre&gt;

&lt;div&gt;
  &lt;pre class="code"&gt;Pourquoi ? Parce que je dois garantir un accès exclusif au fichier ! Et pour l’instant ce n’est pas le cas.&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;
  &lt;pre class="code"&gt;1er réflexe : je désactive mon bouton le temps de réaliser la sauvegarde, sur l’evt click.&amp;#160; &lt;/pre&gt;
&lt;/div&gt;

&lt;h2&gt;Protection par l’UI&lt;/h2&gt;

&lt;pre class="code"&gt;A votre avis, quelle est la différence entre ces 2 snippets : &lt;/pre&gt;

&lt;h2&gt;Snippet 1 :&lt;/h2&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;        &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;private void &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;Save_Click(&lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;object &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sender, &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;RoutedEventArgs &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;e)
        {
            &lt;font style="background-color: rgb(255, 255, 0);"&gt;btSave.IsEnabled = &lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;false&lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;;&lt;/font&gt;
            SaveAsync();
            &lt;font style="background-color: rgb(255, 255, 0);"&gt;btSave.IsEnabled = &lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;true&lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;;&lt;/font&gt;
        }

        &lt;/span&gt;&lt;span style="background: white; color: green;"&gt;// Write data to a file
        &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;async void &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;SaveAsync()
        {
&lt;/span&gt;&lt;span style="background: white; color: green;"&gt;
            &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;StorageFolder &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;localFolder = Windows.Storage.&lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;ApplicationData&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.Current.LocalFolder;

            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sampleFile = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;localFolder.CreateFileAsync(&lt;/span&gt;&lt;span style="background: white; color: rgb(163, 21, 21);"&gt;&amp;quot;dataFile.txt&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;, &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;CreationCollisionOption&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.OpenIfExists);
            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;ws = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sampleFile.OpenStreamForWriteAsync();

&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;&lt;span style="background: white; color: black;"&gt;            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;Task&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.Delay(5000);&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background: white; color: black;"&gt;            &lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;            ws.Dispose();
&lt;/span&gt;&lt;span style="background: white; color: green;"&gt;        &lt;/span&gt;&lt;/font&gt;&lt;span style="background: white; color: black;"&gt;&lt;font face="Consolas"&gt;}&lt;/font&gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h2&gt;Snippet 2 :&lt;/h2&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;        &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;private void &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;Save_Click(&lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;object &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sender, &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;RoutedEventArgs &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;e)
        {&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black;"&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;            SaveAsync();
&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;
        }

        &lt;/span&gt;&lt;span style="background: white; color: green;"&gt;// Write data to a file
        &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;async void &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;SaveAsync()
        {
&lt;font style="background-color: rgb(255, 255, 0);"&gt;&lt;span style="background: white; color: black;"&gt;            &lt;font style="background-color: rgb(255, 255, 0);"&gt;btSave.IsEnabled = &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;&lt;span style="background: white; color: blue;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;false&lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: green;"&gt;

           &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;StorageFolder &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;localFolder = Windows.Storage.&lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;ApplicationData&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.Current.LocalFolder;

            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sampleFile = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;localFolder.CreateFileAsync(&lt;/span&gt;&lt;span style="background: white; color: rgb(163, 21, 21);"&gt;&amp;quot;dataFile.txt&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;, &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;CreationCollisionOption&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.OpenIfExists);
            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;ws = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sampleFile.OpenStreamForWriteAsync();

&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;&lt;span style="background: white; color: black;"&gt;            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;Task&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.Delay(5000);&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green;"&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: green;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background: white; color: black;"&gt;            ws.Dispose();&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;
        &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;btSave.IsEnabled = &lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;true&lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black;"&gt;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;&lt;font face="Consolas"&gt;    }&lt;/font&gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;On pourrait penser que l’exécution de ces snippets sera équivalente, mais ce n’est pas le cas.&lt;/p&gt;

&lt;p&gt;La commande await permet de synchroniser un appel asynchrone avec les lignes de code qui la suivent, mais il ne faut pas oublier que la méthode appelante – elle – ne sera pas bloquée, reprendra la main et continuera à s’exécuter. C’est d’ailleurs ce qui permet au thread de l’UI de ne pas être bloqué pendant ce temps. &lt;/p&gt;

&lt;p&gt;Cela signifie que l’on pourra déclencher plusieurs sauvegardes simultanées en appuyant sur le bouton “Save” dans le cas du 1er snippet, alors que dans le second, le bouton de sauvegarde sera désactivé tant que l’appel asynchrone ne se sera pas terminé.&lt;/p&gt;

&lt;p&gt;Ainsi le premier snippet est totalement inefficace pour protéger l’accès au fichier !&lt;/p&gt;

&lt;p&gt;Donc, rappelez-vous que lors d’un appel asynchrone avec async/await, on retourne &lt;strong&gt;immédiatement&lt;/strong&gt; dans la fonction appelante sans attendre la fin de l’appel asynchrone !&lt;/p&gt;

&lt;p&gt;Le snippet 2 peut être suffisant dans de nombreux cas, mais il ne faut pas oublier que vous empêchez ici les accès concurrents au bouton btSave, et non pas les accès concurrents au fichier !&lt;/p&gt;

&lt;p&gt;Très souvent, une sauvegarde intervient automatiquement sans que celle-ci soit commandée par l’UI : c’est d’autant plus le cas sur Windows 8 où le contexte courant est supposé être maintenu au suspend, à la fermeture de l’application ou tout simplement régulièrement au fil de l’utilisation de l’application. &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Protection par le code métier&lt;/h2&gt;

&lt;p&gt;Dans notre exemple nous avons couplé le code métier à l’UI en accédant au bouton btSave dans la méthode SaveAsync. &lt;/p&gt;

&lt;p&gt;Il est plus propre de protéger l’accès au fichier au niveau du code métier, tout en restant indépendant de l’UI c’est à dire directement dans la méthode SaveAsync mais sans interagir avec la Vue.&lt;/p&gt;

&lt;p&gt;Justement, dans mon exemple j’ai besoin de déclencher une sauvegarde automatique lors du passage dans l’état “suspend” de mon application. Ce nouvel état - nouvellement introduit pour les applications Win8 Metro - intervient 10 secondes après qu’une application passe en arrière plan. Le système peut à tout moment arrêter une application qui se trouve dans l’état suspend, s’il est en manque de ressources. Pour le confort de l’utilisateur, il est conseillé de sauvegarder le contexte applicatif lors du passage en “suspend” d’une application Metro, ce qui permettra de rétablir ce contexte en cas de besoin quand l’application seront relancée.&lt;/p&gt;

&lt;p&gt;Dans notre cas, l’appel du SaveAsync sur le passage dans l’état suspend se fait à l’aide du code suivant:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;        &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;MainPage()
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.InitializeComponent();
            &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;App&lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;.Current.Suspending += Current_Suspending;&lt;/font&gt;
        }

        &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;void &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;Current_Suspending(&lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;object &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sender, Windows.ApplicationModel.&lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;SuspendingEventArgs &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;e)
        {
          &lt;font style="background-color: rgb(255, 255, 0);"&gt;  SaveAsync();&lt;/font&gt;
        }&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;font face="Consolas"&gt;&lt;/font&gt;

&lt;p&gt;Si vous lancez votre application, que vous cliquez sur le bouton “Save” puis passez immédiatement en état suspend grâce au bouton associé en mode debug dans Visual Studio, vous obtiendrez une erreur d’exécution.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0564.image_5F00_6.png"&gt;&lt;img title="image" style="display: inline; background-image: none;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1145.image_5F00_thumb_5F00_2.png" width="601" height="225" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Pour y remédier je vais protéger l’accès à ma ressource critique à l’aide d’un sémaphore : l’objet SemaphoreSlim qui permet de mettre en place un verrou asynchrone (comme un objet Semaphore mais que l’on peut attendre avec un await).&lt;/p&gt;

&lt;h2&gt;Snippet 3 :&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/font&gt;&lt;/h2&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;        &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;SemaphoreSlim&lt;/font&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt; &lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;_semSave&lt;/font&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt; = &lt;/font&gt;&lt;/span&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;&lt;span style="background: white; color: blue;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;SemaphoreSlim&lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;(1);&lt;/font&gt;

        &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;private void &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;Save_Click(&lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;object &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sender, &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;RoutedEventArgs &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;e)
        {
            btSave.IsEnabled = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;false&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;;
            SaveAsync();
            btSave.IsEnabled = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;true&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;;
        }        

        &lt;/span&gt;&lt;span style="background: white; color: green;"&gt;// Write data to a file
        &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;async void &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;SaveAsync()
        {
&lt;/span&gt;&lt;span style="background: white; color: green;"&gt;
            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;await &lt;/font&gt;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;&lt;font style="background-color: rgb(255, 255, 0);"&gt;_semSave.WaitAsync();&lt;/font&gt;

            &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;StorageFolder &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;localFolder = Windows.Storage.&lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;ApplicationData&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.Current.LocalFolder;

            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sampleFile = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;localFolder.CreateFileAsync(&lt;/span&gt;&lt;span style="background: white; color: rgb(163, 21, 21);"&gt;&amp;quot;dataFile.txt&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;, &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;CreationCollisionOption&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.OpenIfExists);
            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;ws = &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;sampleFile.OpenStreamForWriteAsync();

&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: black;"&gt;&lt;span style="background: white; color: black;"&gt;            &lt;/span&gt;&lt;span style="background: white; color: blue;"&gt;await &lt;/span&gt;&lt;span style="background: white; color: rgb(43, 145, 175);"&gt;Task&lt;/span&gt;&lt;span style="background: white; color: black;"&gt;.Delay(5000);&lt;/span&gt;&lt;/span&gt;&lt;span style="background: white; color: green;"&gt;
&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;font face="Consolas"&gt;&lt;font face="Consolas"&gt;&lt;span style="background: white; color: green;"&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="background: white; color: black;"&gt;            ws.Dispose();

            &lt;font style="background-color: rgb(255, 255, 0);"&gt;_semSave.Release();&lt;/font&gt;
&lt;/span&gt;&lt;span style="background: white; color: green;"&gt;        &lt;/span&gt;&lt;span style="background: white; color: black;"&gt;}
&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;p&gt;Avec ce snippet, l’accès au fichier est protégé, quel que soit l’origine de l’appel de la méthode SaveAsync. &lt;/p&gt;

&lt;p&gt;Le code de désactivation du bouton “Save” reste pertinent : il faut un feedback visuel permettant à l’utilisateur de savoir quand la sauvegarde est terminée. Mais elle n’est pas suffisante en tant que telle et demeure complémentaire à la protection de la ressource critique.&lt;/p&gt;

&lt;p&gt;Le hasard faisant bien les choses, Rudy Huyn (MVP Windows Phone) a publié au même moment &lt;a href="http://www.rudyhuyn.com/blog/2012/06/11/perennite-des-donnees-sous-windows-phone/"&gt;un article sur ce thème à propos de Windows Phone&lt;/a&gt;. Je vous le recommande vivement !&lt;/p&gt;

&lt;pre class="code"&gt;&amp;#160;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black;"&gt;&lt;/span&gt;&amp;#160;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10318286" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/async/">async</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/await/">await</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+8/">Windows 8</category></item><item><title>Mémo Win8 : Préparer la publication sur le Store</title><link>http://blogs.msdn.com/b/stephe/archive/2012/05/29/m-233-mo-win8-pr-233-parer-la-publication-sur-le-store.aspx</link><pubDate>Tue, 29 May 2012 10:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10311045</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10311045</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/05/29/m-233-mo-win8-pr-233-parer-la-publication-sur-le-store.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx"&gt;Voir le mémo complet&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font color="#804040"&gt;&lt;strong&gt;[MAJ le 07/06/2012]&lt;/strong&gt;&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Le Store permet de diffuser une application publique suivant différents modèles de tarification. &lt;/p&gt;  &lt;p&gt;Exemple de visualisation par l’utilisateur d’une application disponible sur le Store:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-49-52-metablogapi/2604.Free-trials-with-in_2D00_app-purchasing_5F00_2.png"&gt;&lt;img title="Cut the Rope app listing page in the Windows Store" border="0" alt="Cut the Rope / Store &amp;gt; Games &amp;gt; Puzzle / ***** Average rating (1023) / $1.49 / Buttons: Buy / Try / Image and description of app" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-49-52-metablogapi/8535.Free-trials-with-in_2D00_app-purchasing_5F00_thumb.png" width="500" height="281" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Dans le cas d’applications métier destinées à un usage interne à l’entreprise, il est possible de faire du “side loading” c’est à dire un déploiement direct d’une application sans passer par le Store. &lt;a href="http://blogs.msdn.com/b/windowsstore/archive/2012/04/25/deploying-metro-style-apps-to-businesses.aspx"&gt;Plus d’informations&lt;/a&gt; et &lt;a href="http://technet.microsoft.com/en-us/library/hh852635.aspx"&gt;mode d’emploi&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Choisissez votre modèle de tarification &lt;/h2&gt;  &lt;blockquote&gt;   &lt;p&gt;- Application complète gratuite ou payante&lt;/p&gt;    &lt;p&gt;- Application payante avec trial mode gratuit - &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh694065.aspx"&gt;How to create a trial version of your app&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- Application avec in-app purchase : vous utilisez votre propre infrastructure de facturation plutôt que celle du Store - &lt;a title="http://msdn.microsoft.com/en-us/library/windows/apps/hh694067.aspx" href="http://msdn.microsoft.com/en-us/library/windows/apps/hh694067.aspx"&gt;How to support in-app purchases from your app&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/b/windowsstore/archive/2012/03/12/licensing-apps.aspx"&gt;Plus d’information sur les modèles de tarification&lt;/a&gt; et &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh694078.aspx"&gt;comment faire son choix&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Testez l’interaction de votre application avec le Store&lt;/h2&gt;  &lt;p&gt;Lors du développement de votre application, vous pouvez simuler son interaction avec le Store en utilisant l’objet &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.store.currentappsimulator.aspx"&gt;CurrentAppSimulator&lt;/a&gt; plutôt que l’objet Store réel. &lt;/p&gt;  &lt;p&gt;Exemple d’interaction avec le Store: vous proposez d’acheter la version complète de votre application à l’aide d’un bouton dans les settings.&lt;/p&gt;  &lt;p&gt;Vous trouverez un exemple de code utilisant le simulateur &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh694065.aspx"&gt;ici&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Préparez les images pour promouvoir votre application sur le Store&lt;/h2&gt;  &lt;p&gt;Vous aurez besoin de copies d’écran de votre application, mais également d’images qui seront utilisées pour la promotion de votre application sur le Store.&lt;/p&gt;  &lt;p&gt;Prévoyez des images au format .png de très bonne qualité.&lt;/p&gt;  &lt;h3&gt;Copies d’écran&lt;/h3&gt;  &lt;p&gt;Prévoyez au moins une copie d’écran de votre application en cours de fonctionnement. Si votre application est disponible en plusieurs langues, il faudra une version d’image par langue &lt;strong&gt;avec le contenu traduit&lt;/strong&gt;.&lt;/p&gt;  &lt;h3&gt;Images promotionnelles&lt;/h3&gt;  &lt;p&gt;Préparer des .png pour la promotion sur le store dans les formats suivants (le 414x180 est un minimum): &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7674.image_5F00_8.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6136.image_5F00_thumb_5F00_3.png" width="470" height="232" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Les points importants à vérifier pour passer le processus de validation&lt;/h2&gt;  &lt;p&gt;En plus des pré-requis officiels, vous trouverez ici des recommandations complémentaires qui correspondent aux principaux écueils rencontrés par les premiers développeurs ayant soumis leur application sur le Store. &lt;/p&gt;  &lt;h3&gt;Les pré-requis officiels&lt;/h3&gt;  &lt;p&gt;Voici la liste officielle des points à respecter pour permettre à votre application d’être acceptée sur le Store : &lt;a title="http://msdn.microsoft.com/en-us/library/windows/apps/hh694083.aspx" href="http://msdn.microsoft.com/en-us/library/windows/apps/hh694083.aspx"&gt;Certification requirements for Windows apps&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Le kit de certification&lt;/h3&gt;  &lt;p&gt;L’application doit passer les tests du &lt;a href="http://go.microsoft.com/fwlink/?LinkID=228259"&gt;kit de certification&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Celui-ci peut être exécuté soit après la création du package pour le Store de votre application directement depuis Visual Studio, soit depuis l’écran d’accueil de Windows 8 :&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5710.image_5F00_14.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7851.image_5F00_thumb_5F00_4.png" width="624" height="183" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Pour que l’application ne soit pas rejetée lors de la soumission, il faut obtenir un résultat PASSED ou&amp;#160; PASSED WITH WARNINGS&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7455.image_5F00_22.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2664.image_5F00_thumb_5F00_9.png" width="348" height="119" /&gt;&lt;/a&gt; &lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4130.image_5F00_24.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7853.image_5F00_thumb_5F00_10.png" width="350" height="118" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Plus d’information: &lt;a title="http://msdn.microsoft.com/en-us/library/windows/apps/hh694081.aspx" href="http://msdn.microsoft.com/en-us/library/windows/apps/hh694081.aspx"&gt;How to test your app with the Windows App Certification Kit&lt;/a&gt;&lt;/p&gt;  &lt;h3 align="justify"&gt;&amp;#160;&lt;/h3&gt;  &lt;h3 align="justify"&gt;Toutes les fonctionnalités proposées pour une version d’application doivent être disponibles dans cette même version&lt;/h3&gt;  &lt;p align="justify"&gt;Votre application ne doit pas proposer des fonctionnalités potentiellement disponibles dans de futures versions qui seraient désactivées dans la version courante (“coming soon”, “more to come”, “not available yet”, …).&lt;/p&gt;  &lt;p align="justify"&gt;Chaque fonctionnalité doit être disponible dans toutes les langues supportées par l’application.&lt;/p&gt;  &lt;p align="justify"&gt;Si votre application nécessite des informations particulières (comptes d’identité, ..) pour activer certaines fonctionnalités, n’oubliez pas de les mentionner dans les notes pour les testeurs.&lt;/p&gt;  &lt;p align="justify"&gt;&amp;#160;&lt;/p&gt;  &lt;h3 align="justify"&gt;Votre application ne doit pas planter&lt;/h3&gt;  &lt;p align="justify"&gt;Vérifiez le bon fonctionnement de votre application sur la dernière version publiée de Windows 8.&lt;/p&gt;  &lt;p align="justify"&gt;Utilisez la version Release de votre application pour faire vos tests&lt;strong&gt;&amp;#160;&lt;/strong&gt;: si vous faites tout le développement en mode Debug et que vous générez la version Release juste pour la publication, vous risquez d’avoir de mauvaises surprises.&lt;/p&gt;  &lt;h3 align="justify"&gt;&amp;#160;&lt;/h3&gt;  &lt;h3 align="justify"&gt;L’application doit fonctionner au doigt (et à l’œil !), au clavier et à la souris&lt;/h3&gt;  &lt;p align="justify"&gt;Support du touch, du clavier et de la souris indispensables.&lt;/p&gt;  &lt;h3 align="justify"&gt;&amp;#160;&lt;/h3&gt;  &lt;h3 align="justify"&gt;Politique de confidentialité&lt;/h3&gt;  &lt;p align="justify"&gt;Si votre application récolte ou diffuse des informations personnelles ou permet l’accès à des services Internet, vous devez informer l’utilisateur de votre politique de confidentialité.&lt;/p&gt;  &lt;p align="justify"&gt;L’URL vers cette politique doit être mentionnée sur la page de publication de l’application et sera visible par les utilisateurs dans le Store.&lt;/p&gt;  &lt;p align="justify"&gt;Si votre application utilise la géolocalisation, les SMS, la caméra ou le micro, vous devez également proposer un lien vers la politique de confidentialité dans les settings de votre application.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;i&gt;Your privacy policy must (i) comply with applicable laws and regulations, (ii) inform users of the information collected by your app and how that information is used, stored, secured and disclosed, and (iii) describe the controls that users have over the use and sharing of their information, and how they may access their information&lt;/i&gt;&lt;/p&gt;  &lt;p&gt;Vous pouvez vous baser sur la document ci-dessous pour créer votre policy : n’oubliez pas de remplacer les références à « The application » par le nom de votre application.&lt;/p&gt; &lt;iframe height="120" src="https://skydrive.live.com/embed?cid=63046D1C0F2DEB83&amp;amp;resid=63046D1C0F2DEB83%211589&amp;amp;authkey=AEhco0DXxI_Yiyc" frameborder="0" width="98" scrolling="no"&gt;&lt;/iframe&gt;   &lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;  &lt;h3 align="justify"&gt;Fournir des informations de support technique&lt;/h3&gt;  &lt;p align="justify"&gt;Lors de la publication sur le Store, vous devez fournir un contact pour le support technique de votre application. &lt;/p&gt;  &lt;p align="justify"&gt;Cela peut être une URL (vers un site qui n’est pas en construction !) ou une adresse mail valide.&lt;/p&gt;  &lt;h3&gt;&lt;span style="background: white; color: blue;"&gt;&lt;/span&gt;&lt;/h3&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;h3&gt;La langue par défaut&lt;/h3&gt;  &lt;p&gt;Elle sera utilisée comme fallback &lt;strong&gt;dans le cas où l’utilisateur utilise une langue indisponible dans votre application&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;La langue par défaut de votre application est égale à la langue d’installation de Visual Studio. &lt;/p&gt;  &lt;p&gt;Si le contenu de votre application n’est proposé que dans une seule langue, la langue par défaut doit aussi être la même. &lt;/p&gt;  &lt;p&gt;C’est souvent une cause de rejet des applications sur le Store.&lt;/p&gt;  &lt;p&gt;Exemple:&lt;/p&gt;  &lt;p&gt;Pour une application française de type journal/magazine, le contenu n’est disponible qu’en Français. Si l’application est développée avec la version EN de Visual Studio, il faut donc modifier la langue par défaut pour qu’elle soit français au lieu de Anglais qui est la valeur par défaut. &lt;/p&gt;  &lt;p&gt;Cela ne vous empêche pas de la diffuser sur les stores de pays autres que la France : la langue par défaut et le pays de soumission ne sont pas liés.&lt;/p&gt;  &lt;p&gt;La langue par défaut se définit dans Visual Studio, dans les propriétés du projet (.csproj). &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;- Pour une app XAML, il faut éditer le fichier à la main et modifier la section correspondante:&amp;#160; &lt;/p&gt;    &lt;p&gt;&amp;#160; &lt;font face="Consolas"&gt;&amp;lt;DefaultLanguage&amp;gt;fr-FR&amp;lt;/DefaultLanguage&amp;gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;- Pour une app Html, il suffit de modifier directement la propriété du projet dans VS&lt;/p&gt;    &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1362.image_5F00_2.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6180.image_5F00_thumb.png" width="206" height="341" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;Compte de test&lt;/h3&gt;  &lt;p&gt;Une grande partie de la phase de validation se fait manuellement.&lt;/p&gt;  &lt;p&gt;Pour les applications dont le fonctionnement nécessite un compte d’identité, il faut fournir un compte de test utilisable par l’équipe de validation, sans quoi votre application ne pourra être certifiée.&lt;/p&gt;  &lt;p&gt;Si votre application propose un contenu en fonction de l’âge (3+ / 13+), pensez à fournir un compte supplémentaire qui met en évidence le bon fonctionnement de la restriction. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Politique de restriction liée à l’âge&lt;/h3&gt;  &lt;p&gt;Le tableau suivant peut vous servir d’aide à la décision:&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="0" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;&lt;b&gt;Information collected /Capability accessed&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;&lt;b&gt;Provide access to your privacy policy in the app’s settings as displayed in the Windows settings charm&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;&lt;b&gt;Can Age Rating be lower than 12+?&lt;/b&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;SMS&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Required&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;No&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;Text messages&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Required&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;No&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;Location&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Required&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;No&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;Microphone&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Required&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;No&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;Webcam&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Required&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;No&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;Documents Library&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Required&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;No&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;Internet connection (incoming or outgoing)&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Not Required but encouraged&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Yes&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;Requires a sign in account where the name on the account is not required to be an email address or user’s name (in real life) but any made-up name&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Not Required but encouraged&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Yes&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;Collects or transmits personal information: User’s Name, User’s Account, Email address, Phone #, Contacts, User’s Address &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Not Required but encouraged&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;No&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;Collects or transmits: Images of Computer Desktop or Screen Shots &lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Not Required but encouraged&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;No&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="319"&gt;         &lt;p&gt;Collects or transmits: Browsing History&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;Not Required but encouraged&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="186"&gt;         &lt;p&gt;No&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Nommage de votre application&lt;/h3&gt;  &lt;p&gt;Voici &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh694077.aspx"&gt;quelques conseils&lt;/a&gt; pour bien choisir le nom de votre application.&lt;/p&gt;  &lt;p&gt;Vérifiez les différents noms associés à votre application qui seront utilisés sur l’écran d’accueil et sur le Store. La configuration du nom d’une application se fait à différents niveaux : projet VS, portail développeur du Store.&lt;/p&gt;  &lt;p&gt;- Le “Product Name” (Identity Name) du portail développeur correspond à celui défini dans le manifest. Vous pouvez réserver le nom de votre application avant que celle-ci soit prête à être publiée. Voici comment &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh868182.aspx"&gt;changer le nom de votre application&lt;/a&gt;, si nécessaire.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-49-52-metablogapi/4201.image1_5F00_6B62AA2E.png"&gt;&lt;img title="Visual Studio 11 Store menu" border="0" alt="Dropdown list from Store menu contains &amp;quot;Open Developer account...&amp;quot; and &amp;quot;Reserve App Name&amp;quot;" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-49-52-metablogapi/8726.image1_5F00_thumb_5F00_0319E195.png" width="559" height="292" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;- Pour le Store, vous pouvez proposer un “Display Name” localisé et attaché à chaque langue supportée par votre application. Ce paramètre est configurable dans la section “Name” de “Reserve another name”. Vous n’avez pas besoin de soumettre une nouvelle application pour le modifier. &lt;/p&gt;  &lt;p&gt;- Le nom de l’application qui apparait sur l’écran d’accueil de Windows 8 se configure dans le manifest, dans l’attribut “ShortName”. Vous pouvez proposer un nom différent selon la langue, en utilisant &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh454044(v=vs.110).aspx"&gt;la notation permettant d’adresser les ressources&lt;/a&gt; dans le manifest (ms-resource:).&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2311.image_5F00_18.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4061.image_5F00_thumb_5F00_8.png" width="445" height="281" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;- Si le nom de votre application est trop long, vous pouvez renseigner un “nom complet” (&lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211471.aspx"&gt;Package/ Applications/ Application/VisualElements @DisplayName&lt;/a&gt;)&lt;strong&gt;&lt;/strong&gt;, qui sera affiché dans le tooltip. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5047.image_5F00_16.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8171.image_5F00_thumb_5F00_7.png" width="474" height="304" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1321.image_5F00_12.png"&gt;&lt;img title="image" style="border-width: 0px; display: inline;" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7181.image_5F00_thumb_5F00_5.png" width="190" height="132" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Vous trouverez un tableau récapitulatif des règles d’utilisation des différents noms &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh694077.aspx"&gt;sur cette page&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;- N’utilisez pas de terme de type trial, beta, … dans le nom de votre application&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Un petit aperçu&lt;/h2&gt;  &lt;p&gt;Pour vous faire une idée, voici un exemple de page de description complétée.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-49-52-metablogapi/2627.image8_5F00_61A1500F.png"&gt;&lt;img title="App Submission to Store: Description page" border="0" alt="A long form containing the following fields: Description, Description bullet points, Keywords, Description of update, Keywords, Copyright and trademark info, Additionallicense terms, Screenshots, Promotional images, REcommended hardware bullets, App website, Support contact info, Privacy Policy." src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-49-52-metablogapi/4278.image8_5F00_thumb_5F00_2952B32A.png" width="557" height="1302" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx"&gt;Voir le mémo complet&lt;/a&gt;&lt;/p&gt; &lt;script type="text/javascript"&gt;// &lt;![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]&gt;&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10311045" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+8/">Windows 8</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Store/">Store</category></item><item><title>Mémo Win8 : La navigation</title><link>http://blogs.msdn.com/b/stephe/archive/2012/05/21/m-233-mo-win8-la-navigation.aspx</link><pubDate>Mon, 21 May 2012 15:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10305802</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10305802</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/05/21/m-233-mo-win8-la-navigation.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx"&gt;Voir le mémo complet&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;La page principale de votre application (“Hub”) doit être conçue comme une couverture de magazine. Elle est généralement composée d’une ListView horizontale avec divers groupes représentées sous forme de colonnes mais peut aussi être totalement libre pour les applications non hiérarchiques comme des jeux. &lt;/p&gt;  &lt;p&gt;Tout comme pour un magazine, ces contenus doivent attirer l’oeil et donc être présentés de manière concise et claire, sous des formats divers et attrayants.&lt;/p&gt;  &lt;p&gt;&lt;img title="An image showing an example hub page" alt="An image showing an example hub page" src="http://i.msdn.microsoft.com/dynimg/IC571343.png" width="423" height="238" /&gt;&amp;#160; &lt;img title="Hh868271.flat_1(en-us,WIN.10).png" alt="Hh868271.flat_1(en-us,WIN.10).png" src="http://i.msdn.microsoft.com/dynimg/IC573445.png" width="424" height="238" /&gt;&lt;/p&gt;  &lt;p&gt;La navigation se fera le plus souvent par une gesture sur un élément de la page : touch d’un header de section, pinch out pour zoom sémantique, touch d’un élément d’une grille, …&lt;/p&gt;  &lt;h2&gt;Modes de navigation&lt;/h2&gt;  &lt;h3&gt;Hiérarchique&lt;/h3&gt;  &lt;p&gt;Les mode de navigation conseillé et le plus utilisé est hiérarchique (Hub/Section/Detail) avec un maximum de 3 niveaux:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;img title="Hub, section, and details pages in a Metro style app" alt="Hub, section, and details pages in a Metro style app" src="http://i.msdn.microsoft.com/dynimg/IC561749.png" /&gt;&lt;/p&gt;    &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;A plat&lt;/h3&gt;  &lt;p&gt;La navigation à plat peut s’appliquer quand il y a peu d’informations et d’écrans à présenter (comme dans les jeux par-exemple).&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;img title="Flat navigation system in a Metro style app" alt="Flat navigation system in a Metro style app" src="http://i.msdn.microsoft.com/dynimg/IC561750.png" /&gt;&lt;/p&gt;    &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Dans ce cas, l’AppBar du haut (réservée dans tous les cas à la navigation) est accessible depuis toutes les pages et permet de passer facilement d’un contexte à un autre comme le propose Internet Explorer.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;img title="Navigation bar and switching between multiple contexts" alt="Navigation bar and switching between multiple contexts" src="http://i.msdn.microsoft.com/dynimg/IC561751.png" /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Certains contrôles types vous aideront à mettre en place une navigation “à la Metro”:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;- le &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465319.aspx"&gt;zoom sémantique&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- les menus &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465341.aspx"&gt;flyout&lt;/a&gt; pour les headers de sections et les menus en général&lt;/p&gt;    &lt;p&gt;- le bouton Back&lt;/p&gt;    &lt;p&gt;- les &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465496.aspx"&gt;ListView&lt;/a&gt;/Gridview &lt;/p&gt;    &lt;p&gt;- la &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh850405.aspx"&gt;FlipView&lt;/a&gt; couplée à une ListView pour la navigation maitre/détail&lt;/p&gt;    &lt;p&gt;- l’&lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465309.aspx"&gt;AppBar&lt;/a&gt; du haut, réservée à la navigation&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Pour&amp;#160; plus de détails sur les principes de navigation en général, je vous recommande cet article : &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh761500.aspx"&gt;Navigation design for Metro style apps&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Conseils complémentaires&lt;/h2&gt;  &lt;h3&gt;Les sections&lt;/h3&gt;  &lt;h4&gt;Navigation entre sections&lt;/h4&gt;  &lt;p&gt;Utilisez des menus flyout sur les headers de sections pour permettre la navigation entre sections et revenir à la page d’accueil.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7651.image_5F00_4.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3365.image_5F00_thumb_5F00_1.png" width="210" height="240" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Vous pouvez également utiliser l’AppBar du haut pour naviguer entre les différentes sections de l’application.&lt;/p&gt;  &lt;h4&gt;&amp;#160;&lt;/h4&gt;  &lt;h4&gt;Nombre d’éléments visibles sur le hub&lt;/h4&gt;  &lt;p&gt;Pour informer l’utilisateur qu’il y a plus d’éléments dans une section que ceux affichés dans le Hub, vous pouvez:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;- Afficher le nombre d’élements à droite du header de section (recommandé)&lt;/p&gt;    &lt;p&gt;- Utiliser le dernier élément de la liste comme un lien vers la liste de tous les éléments : ex: “Voir +”&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;h3&gt;Le zoom sémantique&lt;/h3&gt;  &lt;p&gt;Le &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465319.aspx"&gt;zoom sémantique&lt;/a&gt; permet de visualiser toutes les sections du niveau hiérarchique courant en 1 seule page en les regroupant selon des critères signicatifs.&lt;/p&gt;  &lt;p&gt;&lt;img title="Navigating between levels in a hierarchy with semantic zoom" alt="Navigating between levels in a hierarchy with semantic zoom" src="http://i.msdn.microsoft.com/dynimg/IC568016.png" /&gt;&lt;/p&gt;  &lt;p&gt;Le zoom sémantique est conseillé à partir de 5 sections et obligatoire à partir de 10.&lt;/p&gt;  &lt;p&gt;N’hésitez pas à être créatif et à proposer certaines informations détaillées comme dans le titre du regroupement ou dans la taille de la zone pour refléter le nombre d’éléments par-exemple.&lt;/p&gt;  &lt;p&gt;&lt;img title="Example of a zoomed-in layout" alt="Example of a zoomed-in layout" src="http://i.msdn.microsoft.com/dynimg/IC571524.png" /&gt;&lt;img title="Example of a zoomed-out layout" alt="Example of a zoomed-out layout" src="http://i.msdn.microsoft.com/dynimg/IC571525.png" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img title="Example of a zoomed-in layout" alt="Example of a zoomed-in layout" src="http://i.msdn.microsoft.com/dynimg/IC571526.png" /&gt;&lt;img title="Example of a zoomed-out layout" alt="Example of a zoomed-out layout" src="http://i.msdn.microsoft.com/dynimg/IC571527.png" /&gt;&lt;/p&gt;  &lt;p&gt;Plus d’informations sur le zoom sémantique : &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465319.aspx"&gt;Guidelines for Semantic Zoom&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;h3&gt;Les filtres/tris/regroupements&lt;/h3&gt;  &lt;p&gt;Ils doivent être proposés à partir des commandes de l’AppBar du bas à l’aide de menus flyout.&lt;/p&gt;  &lt;p&gt;&lt;img title="Filtering in an app bar" alt="Filtering in an app bar" src="http://i.msdn.microsoft.com/dynimg/IC573293.png" /&gt;&lt;/p&gt;  &lt;p&gt;Dans le cas où ils sont la principale fonction de la page, il est possible de les faire apparaitre directement au-dessus des résultats, un peu comme dans un résultat de recherche.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;img title="Filtering in a store app" alt="Filtering in a store app" src="http://i.msdn.microsoft.com/dynimg/IC573289.png" /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;h3&gt;&lt;img title="Sorting in a store app" alt="Sorting in a store app" src="http://i.msdn.microsoft.com/dynimg/IC573290.png" /&gt;&lt;/h3&gt;    &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;La FlipView&lt;/h3&gt;  &lt;p&gt;La &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh850405.aspx"&gt;FlipView&lt;/a&gt; permet de naviguer aisément entre les pages de détail d’une collection d’éléments en fournissant un moyen de passer à l’élement suivant/précédent, comme pour les pages d’un catalogue.&lt;/p&gt;  &lt;p&gt;&lt;img title="Image of a FlipView control" alt="Image of a FlipView control" src="http://i.msdn.microsoft.com/dynimg/IC573355.png" /&gt;&lt;/p&gt;  &lt;p&gt;Elle est conseillée quand le nombre d’éléments à présenter est inférieur à 25. &lt;/p&gt;  &lt;p&gt;Au-delà, vous pouvez coupler une &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465496.aspx"&gt;ListView&lt;/a&gt; à une &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh850405.aspx"&gt;FlipView&lt;/a&gt; au sens maitre/détail : la &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465496.aspx"&gt;ListView&lt;/a&gt; représente les éléments de manière sommaire et la FlipView permet d’accéder au détail d’un élément et de naviguer entre ses voisins directement.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Les grid, scrollviewers, … &lt;/h3&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Vérifiez que les actions de navigation sur la grille ne déclenchent pas accidentellement d’action sur les éléments contenus par celle-ci.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;h3&gt;Le bouton Back&lt;/h3&gt;  &lt;p&gt;Il doit toujous être placé en haut à gauche de la page et doit permettre de revenir à la page précédente. &lt;/p&gt;  &lt;p&gt;Sur les vues plein écran, il peut être déplacé dans l’AppBar du haut de la page.&lt;/p&gt;  &lt;p&gt;S’il est désactivé, il doit être invisible comme pour la première page de l’application par-exemple.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h3&gt;Lors d’un changement de page&lt;/h3&gt;  &lt;p&gt;Une page ne doit jamais mettre plus de 5 secondes pour s’afficher.&lt;/p&gt; &lt;script type="text/javascript"&gt;// &lt;![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]&gt;&lt;/script&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx"&gt;Voir le mémo complet&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10305802" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+8/">Windows 8</category></item><item><title>Mémo Win8 : Où placer les commandes dans mon application ?</title><link>http://blogs.msdn.com/b/stephe/archive/2012/05/15/m-233-mo-win8-l-appbar-et-les-commandes-de-mon-application.aspx</link><pubDate>Tue, 15 May 2012 13:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10305275</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10305275</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/05/15/m-233-mo-win8-l-appbar-et-les-commandes-de-mon-application.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx"&gt;Voir le mémo complet&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Voici une règle qui résume bien la philosophie du positionnement des commandes dans les applications Windows 8 Metro :&lt;/p&gt;  &lt;p&gt;Une commande ne peut apparaitre directement sur une page &lt;strong&gt;que si l’action associée est indispensable au fonctionnement de la page&lt;/strong&gt; ou qu’elle correspond à la fonction principale de cette page. Ex: un bouton “Envoyer” sur la page de création d’un email.&lt;/p&gt;  &lt;p&gt;Dans ce cas, préférez un positionnement accessible facilement sur une tablette.&lt;/p&gt;  &lt;p&gt;&lt;img title="Interaction areas" alt="Interaction areas" src="http://i.msdn.microsoft.com/dynimg/IC568012.png" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;De manière générale, les autres commandes se retrouveront dans :&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;- l’AppBar située en haut de la page pour la commandes de navigation&lt;/p&gt;    &lt;p&gt;- l’AppBar située en bas de la page pour les autres commandes&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;img title="Navigating with the edge swipe" alt="Navigating with the edge swipe" src="http://i.msdn.microsoft.com/dynimg/IC561752.png" /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Il existe néanmoins des exceptions pour:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;- le bouton Back pour revenir à la page précédente&lt;/p&gt;    &lt;p&gt;- les commandes associées à des éléments non sélectionnables ou au Presse-Papier (copier/coller, …)&lt;/p&gt;    &lt;p&gt;- les commandes de gestion de compte (connexion/déconnexion)&lt;/p&gt;    &lt;p&gt;- les commandes de paramétrage, la recherche et le partage d’information&lt;/p&gt;    &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h2&gt;L’AppBar du haut pour la commandes de navigation&lt;/h2&gt;  &lt;p&gt;Dans les applications Metro, la plupart des actions explicites de navigation disparaissent au profit d’une gesture sur un élément de la page:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;- touch/click d’un élément d’une grid&lt;/p&gt;    &lt;p&gt;- touch/clic d’un header de section&lt;/p&gt;    &lt;p&gt;- pich-out pour zoom sémantique&lt;/p&gt;    &lt;p&gt;-&amp;#160; …. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;L’AppBar située en haut de la page permet de rassembler les autres fonctions de navigation (si besoin).&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;img title="Navigation bar and switching between multiple contexts" alt="Navigation bar and switching between multiple contexts" src="http://i.msdn.microsoft.com/dynimg/IC561751.png" /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;La navigation fera l’objet d’un mémo complet à paraitre prochainement.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;L’AppBar du bas pour les autres commandes&lt;/h2&gt;  &lt;p&gt;Toutes les autres commandes qui sont secondaires au fonctionnement de la page et dont l’utilisation sera facultative pour l’utilisateur se retrouveront dans l’App Bar du bas. &lt;/p&gt;  &lt;p&gt;Si vous hésitez ou que vous avez beaucoup de commandes importantes, une solution intermédiaire serait de placer vos commandes dans l’AppBar du bas et de forcer l’apparition de celle-ci à l’affichage de la page.&lt;/p&gt;  &lt;p&gt;Chaque commande de l’AppBar doit être représentée par un glyph (voir table des caractères). Je vous conseille &lt;a href="http://www.jonathanantoine.com/2012/03/05/winjs-out-of-the-box-available-icons/"&gt;l’article de Jonathan Antoine&lt;/a&gt; qui permet de les avoir tous sous les yeux dans &lt;a href="http://db.tt/yI1JOwvc"&gt;ce document&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Règles d’utilisation de l’AppBar du bas&lt;/h3&gt;  &lt;h4&gt;Groupez vos commandes de manière fonctionnelle&lt;/h4&gt;  &lt;p&gt;Si vous avez 2 groupes, placez-en un aligné à gauche, l’autre à droite. Si vous avez plus de 2 groupes, utilisez des séparateurs et alignez-les à droite.&lt;/p&gt;  &lt;p&gt;&lt;img title="Hh761499.com_ico_appbar2(en-us,WIN.10).png" alt="Hh761499.com_ico_appbar2(en-us,WIN.10).png" src="http://i.msdn.microsoft.com/dynimg/IC568865.png" width="672" height="67" /&gt;&lt;/p&gt;  &lt;p&gt;Placez toujours vos commandes de la même manière sur les différentes pages de votre application.&lt;/p&gt;  &lt;p&gt;Il est recommandé d’afficher les commandes Supprimer | Nouveau,&amp;#160; Retirer | Ajouter, ou « Clear » sur le côté droit.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h4&gt;Commandes contextuelles à un élément sélectionné&lt;/h4&gt;  &lt;p&gt;Il est conseillé de faire apparaitre l’App Bar automatiquement pour visualiser les commandes contextuelles à l’élément sélectionné. Placez ces commandes contextuelles sur la gauche en décalant les autres commandes déjà présentes dans l’AppBar et en ajoutant un séparateur.&lt;/p&gt;  &lt;p&gt;&lt;img title="Hh761499.com_ico_appbar4(en-us,WIN.10).png" alt="Hh761499.com_ico_appbar4(en-us,WIN.10).png" src="http://i.msdn.microsoft.com/dynimg/IC568867.png" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h4&gt;Trop de commandes ?&lt;/h4&gt;  &lt;p&gt;Si vous n’avez pas assez de place dans l’AppBar, regroupez des commandes entre elles suivant leurs fonctionnalités et affichez-les dans un menu flyout piloté par un bouton de l’AppBar.&lt;/p&gt;  &lt;p&gt;&lt;img title="Filtering in an app bar" alt="Filtering in an app bar" src="http://i.msdn.microsoft.com/dynimg/IC573293.png" width="456" height="274" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h4&gt;Gestion du mode snap et du mode Portrait&lt;/h4&gt;  &lt;p&gt;Vérifiez le bon comportement de l’AppBar en mode Snap et Portrait où le nombre de commandes visibles est plus limité.&lt;/p&gt;  &lt;p&gt;Vous pouvez modifier le nombre de commandes dans l’AppBar en fonction du mode d’affichage ; quitte à en cacher certaines moins pertinentes ou à en regrouper dans des menus flyout.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Les exceptions&lt;/h2&gt;  &lt;h3&gt;Le bouton Back&lt;/h3&gt;  &lt;p&gt;Il sert à revenir à la page précédente et apparait à gauche du titre de la page.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3581.image_5F00_2.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5657.image_5F00_thumb.png" width="469" height="167" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Les commandes associées à des élements non sélectionnables ou au Presse-Papier&lt;/h3&gt;  &lt;p&gt;Les commandes d’édition en général comme le copier/coller doivent apparaitre sous la forme d’un menu flyout et ne pas se retrouver dans l’AppBar. Vous pouvez également utiliser un menu contextuel flyout pour toutes les commandes associées à des éléments non sélectionnables.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;Les commandes de gestion de compte de l’utilisateur&lt;/h3&gt;  &lt;p&gt;Si vous avez une notion de compte utilisateur dans votre application, les commandes associées devront se retrouver dans les settings (accessible par le charm associé). Vous pouvez néanmoins proposer une commande de connexion directement sur la page principale si la connexion est indispensable à l’utilisation de votre application.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Les commandes de paramétrage, la recherche et le partage d’information&lt;/h3&gt;  &lt;p&gt;Toutes ces fonctionnalités se retrouvent dans les charms Settings, Search et Share et sont accessibles par ce biais. &lt;/p&gt;  &lt;p&gt;Ne dupliquez pas une commande de charm dans l’AppBar. &lt;/p&gt;  &lt;p&gt;Si une de ces fonctionnalités est primordiale au fonctionnement d’une page, vous pouvez ajouter un élément directement dans la page qui permet d’accéder au charm associé.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6560.image_5F00_4.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3414.image_5F00_thumb_5F00_1.png" width="668" height="148" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4174.image_5F00_6.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4578.image_5F00_thumb_5F00_2.png" width="669" height="156" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Pour approfondir le sujet:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh761499.aspx"&gt;Commanding design for Metro style apps&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh761500.aspx"&gt;Navigation design for Metro style apps&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465302.aspx"&gt;Guidelines and checklist for app bars&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt; &lt;script type="text/javascript"&gt;// &lt;![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]&gt;&lt;/script&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx"&gt;Voir le mémo complet&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10305275" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+8/">Windows 8</category></item><item><title>Mémo Win8 : Splash screen et temps de chargement</title><link>http://blogs.msdn.com/b/stephe/archive/2012/05/11/m-233-mo-win8-splash-screen-et-temps-de-chargement.aspx</link><pubDate>Fri, 11 May 2012 14:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10304239</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10304239</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/05/11/m-233-mo-win8-splash-screen-et-temps-de-chargement.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx"&gt;Voir le mémo complet&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Votre application doit avoir un splah screen qui lui est propre (elle n’utilise pas le splash screen défini par défaut par Visual Studio). Celui-ci est composé d’une couleur de fond et d’une image. Le définition du splash screen s’effectue dans le manifest de l’application.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7282.image_5F00_4.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1030.image_5F00_thumb_5F00_1.png" width="699" height="105" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Couleur de fond&lt;/h2&gt;  &lt;p&gt;La couleur de fond est optionnelle et si elle n’est pas renseignée, c’est la couleur de la tile qui sera utilisée. Vous pouvez utiliser le nom d’une couleur ou une valeur hexa précédée de ‘#’.&lt;/p&gt;  &lt;p&gt;Veillez à avoir un bon contraste entre l’image et la couleur de fond.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Image&lt;/h2&gt;  &lt;p&gt;Il est conseillé d’utiliser une image de type .png avec un fond transparent.&lt;/p&gt;  &lt;p&gt;&lt;img title="A 50% scaled image depicting the transparency of the Sample splash screen image." alt="A 50% scaled image depicting the transparency of the Sample splash screen image." src="http://i.msdn.microsoft.com/dynimg/IC558893.png" /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;L’image du splash screen peut être définie comme un chemin vers une image ou vers une ressource. Dans ce dernier cas, il est possible de fournir différents formats d’images en fonction de l’échelle qui sera appliquée en fonction du device et de la résolution de l’écran:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8272.image_5F00_2.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7128.image_5F00_thumb.png" width="267" height="154" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Ce principe peut être appliqué de la même manière pour fournir des images différentes en fonction de la culture ou du contraste pour l’accessibilité.&lt;/p&gt;  &lt;p&gt;Voir &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/Hh831183.aspx#how_to_structure_your_app_package_for_globalization"&gt;How to structure your app package for globalization&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Le choix de la couleur et de l’image&lt;/h2&gt;  &lt;p&gt;Utilisez une couleur et une image qui identifient clairement votre application.&lt;/p&gt;  &lt;p&gt;Ne faites &lt;strong&gt;pas de publicité&lt;/strong&gt; dans votre splash screen.&lt;/p&gt;  &lt;p&gt;Ne mettez&lt;strong&gt; pas de numéro de version,&lt;/strong&gt; ou autre information du genre “About”.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Temps de chargement&lt;/h2&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Au lancement de votre application, vérifiez que le splash screen &lt;strong&gt;ne reste pas visible plus de 5 secondes.&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Votre application doit pouvoir se lancer&lt;strong&gt; même sans connectivité Internet&lt;/strong&gt;. Si celle-ci est nécessaire, indiquez à l’utilisateur l’absence de connectivité sur la page principale. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;/font&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Si le temps de chargement est plus long et que cela est justifié, il est possible d’utiliser la technique du splash screen étendu. La page d’accueil est alors un relai du splashscreen : une page indiquant que l’application est en cours de chargement. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3" face="Calibri"&gt;Vous trouverez ici les instructions pour mettre en place un splash screen étendu : &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh700390.aspx"&gt;How to display a splash screen for longer&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Dans tous les cas, l’application doit être réactive aux actions de l’utilisateur dans les 20 secondes après son lancement. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx"&gt;Voir le mémo complet&lt;/a&gt;&lt;/p&gt; &lt;script type="text/javascript"&gt;// &lt;![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]&gt;&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10304239" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+8/">Windows 8</category></item><item><title>Mémo Win8 : Le dimensionnement des contrôles cibles de touch</title><link>http://blogs.msdn.com/b/stephe/archive/2012/05/10/m-233-mo-win8-le-dimensionnement-des-contr-244-les-cibles-de-touch.aspx</link><pubDate>Thu, 10 May 2012 15:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10303825</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10303825</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/05/10/m-233-mo-win8-le-dimensionnement-des-contr-244-les-cibles-de-touch.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx"&gt;Voir le mémo complet&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Les applications Metro sont conçues pour être “Touch” et donc être majoritairement pilotées au(x) doigt(s).&lt;/p&gt;  &lt;p&gt;La dimension des contrôles qui seront touchés doit donc être adaptée à des doigts : c’est à dire être plus gros que s’ils étaient pilotés par un pointeur de souris et plus espacés les uns des autres pour éviter les erreurs de manipulation.&lt;/p&gt;  &lt;p&gt;Plus une action est importante/critique, plus le contrôle doit être grand. Au contraire, un contrôle associé à une action mineure ou peu utilisée peut être de taille plus réduite.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Voici les préconisations de dimensionnement et d’espacement pour les contrôles intégrés dans vos applications Windows 8 Metro.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;img title="Chart that shows how touch errors decrease for larger targets." alt="Chart that shows how touch errors decrease for larger targets." src="http://i.msdn.microsoft.com/dynimg/IC561733.png" /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Pour les actions standards&lt;/h3&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;7x7 mm &lt;/strong&gt;(40 pixels)&lt;strong&gt; = &lt;/strong&gt;Taille minimale recommandée pour une zone touch &lt;/p&gt;    &lt;p&gt;&lt;strong&gt;2 mm&lt;/strong&gt; (10 pixels) = espacement des contrôles&lt;/p&gt;    &lt;p&gt;&lt;img title="7x7 recommended minimum size" alt="7x7 recommended minimum size" src="http://i.msdn.microsoft.com/dynimg/IC561735.png" /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;C’est la taille minimale pour une action qui peut être annulée en 1 ou 2 gestures ou dans un intervalle de 5 secondes.&lt;/p&gt;  &lt;p&gt;L’espacement des contrôles est aussi important que la taille de ceux-ci et doit être de 10 pixels minimum (2mm)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Pour les actions importantes&lt;/h3&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;9x9 mm &lt;/strong&gt;(50 pixels)&lt;strong&gt; = &lt;/strong&gt;Taille minimale recommandée pour une zone touch entrainant une action importante&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;2 mm&lt;/strong&gt; (10 pixels) = espacement des contrôles&lt;/p&gt;    &lt;p&gt;&lt;img id="touch_targetsize_9mm_beta" title="9x9 recommended size for accuracy" alt="9x9 recommended size for accuracy" src="http://i.msdn.microsoft.com/dynimg/IC561736.png" xmlns="xmlns" /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Les commandes associés à des actions importantes ou critiques telles qu’une suppression, une fermeture, … tolèrent moins les erreurs de manipulation.&lt;/p&gt;  &lt;p&gt;Aussi il est conseillé d’utiliser des contrôles de taille plus importante dans ce cas.&lt;/p&gt;  &lt;p&gt;Cette règle s’applique également aux actions dont l’annulation nécessite plus de 2 actions/gestures ou plus de 5 secondes ou un changement de contexte.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Si vous avez des contraintes de place&lt;/h3&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;5x5 mm &lt;/strong&gt;(30 pixels)&lt;strong&gt; = &lt;/strong&gt;Taille minimale recommandée pour une zone touch dans un espace avec des contraintes de place&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;2 mm&lt;/strong&gt; (10 pixels) = espacement des contrôles&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;img title="5x5 minimum size" alt="5x5 minimum size" src="http://i.msdn.microsoft.com/dynimg/IC561737.png" /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Si vous manquez de place à l’écran pour placer vos éléments, vous pouvez descendre jusqu’à une zone de 5x5 mm mais l’action doit pouvoir être annulée en 1 seule gesture.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;L’espacement des contrôles est d’autant plus important et reste à un minimum de 2 mm.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Pas de pitié pour les gauchers ;o)&lt;/h3&gt;  &lt;p&gt;La majorité de la population étant droitière, il est conseillé de placer les commandes plutôt sur la droite de l’écran. Cela les rend plus accessibles et évite de cacher l’écran avec la main droite pour atteindre des commandes situées à l’opposé.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;img id="touch_right_handed_beta" title="Right hand occlusion" alt="Right hand occlusion" src="http://i.msdn.microsoft.com/dynimg/IC568014.png" xmlns="xmlns" /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Retrouvez &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465415.aspx"&gt;tous ces conseils ainsi que beaucoup d’autres&lt;/a&gt; sur la conception des interfaces “touch ready” !&lt;/p&gt; &lt;script type="text/javascript"&gt;// &lt;![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]&gt;&lt;/script&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx"&gt;Voir le mémo complet&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10303825" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+8/">Windows 8</category></item><item><title>Le mémo des points à surveiller pour réussir votre application Windows 8 Metro</title><link>http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx</link><pubDate>Thu, 10 May 2012 15:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10303823</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10303823</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/05/10/d-233-velopper-une-application-windows-8-metro-le-m-233-mo-des-points-224-surveiller.aspx#comments</comments><description>&lt;p&gt;&lt;em&gt;&lt;font color="#9e7c7c"&gt;&lt;strong&gt;[MAJ le 15/06/2012 : version PDF dispo]&lt;/strong&gt;&lt;/font&gt;&lt;/em&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Cela fait quelques mois que je suis l’avancement d’applications Windows 8 en cours de développement. Nous proposons à ces “early” développeurs une liste de préconisations pour aboutir à une application réussie, c’est à dire bien intégrée à la plateforme et agréable à utiliser. &lt;/p&gt;  &lt;p&gt;Je profite de ce blog pour vous faire partager celles qui me semblent les plus utiles à rappeler et qui correspondent aux principaux écueils rencontrés par ces pionniers du développement sur Windows 8.&lt;/p&gt;  &lt;p&gt;Suivre ces conseils maximisera aussi vos chances de passer avec succès la certification pour le Store Windows 8. &lt;/p&gt;  &lt;p&gt;Si vous projetez de développer une application Metro, ce mémo vous sera donc très utile:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/10/m-233-mo-win8-le-dimensionnement-des-contr-244-les-cibles-de-touch.aspx"&gt;Le dimensionnement des contrôles cibles de touch&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/11/m-233-mo-win8-splash-screen-et-temps-de-chargement.aspx"&gt;Splash screen et temps de chargement&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/15/m-233-mo-win8-l-appbar-et-les-commandes-de-mon-application.aspx"&gt;Où placer les commandes dans mon application ?&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/21/m-233-mo-win8-la-navigation.aspx"&gt;La navigation&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/29/m-233-mo-win8-pr-233-parer-la-publication-sur-le-store.aspx"&gt;Préparer la publication sur le Store&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sdrv.ms/L9KqIy"&gt;Télécharger le mémo en version PDF&lt;/a&gt;, mis à jour régulièrement au fil des nouveaux posts.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;ul&gt;&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10303823" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+8/">Windows 8</category></item><item><title>Partager du code entre plate-formes : l’application Silverlight 5 (4/4)</title><link>http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-silverlight-5-4-4.aspx</link><pubDate>Mon, 07 May 2012 15:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10301854</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10301854</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-silverlight-5-4-4.aspx#comments</comments><description>&lt;p&gt;Voici le dernier article de la série :&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-gr-226-ce-224-la-portable-class-library-1-4.aspx"&gt;Partager du code entre plate-formes grâce à la Portable Library (1/4)&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-8-metro-2-4.aspx"&gt;Partager du code entre plate-formes : l’application Windows 8 Metro (2/4)&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-phone-3-4.aspx"&gt;Partager du code entre plate-formes : l’application Windows Phone (3/4)&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- Partager du code entre plate-formes : l’application Silverlight 5 (4/4)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Retrouvez le code source des démos :&lt;/p&gt; &lt;iframe height="128" src="https://skydrive.live.com/embed?cid=63046D1C0F2DEB83&amp;amp;resid=63046D1C0F2DEB83%211516&amp;amp;authkey=APVmEuhb3kPTnpQ" frameborder="0" width="165" scrolling="no"&gt;&lt;/iframe&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;L’application Silverlight 5&lt;/h1&gt;  &lt;p&gt;Nous profitons du contrôle Pivot Viewer qui est très facile à utiliser depuis Silverlight 5 puisque tout se passe côté client avec du binding. &lt;/p&gt;  &lt;p&gt;Ajoutons un nouveau projet Silverlight 5 dans la solution CaveAVins:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5102.image_5F00_2.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1070.image_5F00_thumb.png" width="732" height="447" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Ajoutons une référence au projet CaveAVins.Portable.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;La couche DAL&lt;/h2&gt;  &lt;p&gt;L’accès aux données est similaire à celui effectué sur Windows Phone. WCF Data Services nous permet de simplifier l’accès au service OData. La même implémentation de &lt;span style="color: #2b91af"&gt;ICaveAVinsDataProvider&lt;/span&gt;&amp;#160; peut être utilisée dans cette application Silverlight, malgré tout elle ne peut pas être partagée dans la Portable Lib car WCF Data Services est implémenté par des assemblies différentes sur chaque plate-forme.&lt;/p&gt;  &lt;p&gt;Tout comme pour Windows Phone, ajoutez une référence au service &lt;font color="#a31515"&gt;&lt;a href="http://caveavins.cloudapp.net/CaveAVinsDataService.svc/"&gt;http://caveavins.cloudapp.net/CaveAVinsDataService.svc/&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Puis ajoutez la même implémentation de la classe CaveAVinsDataProvider que tout à l’heure pour Windows Phone:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Collections.Generic;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Data.Services.Client;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Linq;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.PivotViewer.ServiceReference1;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.DAL;

&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.PivotViewer.DAL
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsDataProvider &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ICaveAVinsDataProvider
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Action&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt;&amp;gt; WinesLoaded;
        &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataServiceCollection&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Wine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; _results;

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;LoadDataAsync()
        {
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsContext &lt;/span&gt;&lt;span style="background: white; color: black"&gt;ct = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsContext&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Uri&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;&amp;quot;http://caveavins.cloudapp.net/CaveAVinsDataService.svc/&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;));
            _results = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataServiceCollection&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Wine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt;(ct);
            _results.LoadCompleted += (o, e) =&amp;gt;
                {
                    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(e.Error == &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
                    {
                        &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Handle a paged data feed.
                        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(_results.Continuation != &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
                        {
                            &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Automatically load the next page.
                            &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_results.LoadNextPartialSetAsync();
                        }
                        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;else
                        &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
                           WinesLoaded(_results.Cast&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt;());
                        }
                    }
                };

            _results.LoadAsync(ct.Wines.Where(w =&amp;gt; w.PictureUrl != &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black"&gt;));
        }

    }
}

&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Ce code étant identique en dehors du nommage des namespaces locaux, il serait possible de partager directement ces fichiers entre les deux projets. 

&lt;h3&gt;&lt;font color="#a31515"&gt;&lt;/font&gt;&lt;/h3&gt;

&lt;h2&gt;La couche ViewModel&lt;/h2&gt;

&lt;p&gt;Cette fois c’est le ViewModel de l’application Windows 8 que l’on peut reprendre, toujours pour obtenir une image de l’étiquette de la bouteille de vin:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.PivotViewer.ViewModel
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;SlWineVM &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;WineVM
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;SlWineVM(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine &lt;/span&gt;&lt;span style="background: white; color: black"&gt;wine)
            : &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;base&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(wine)
        {
        }

        &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ImageSource &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_picture;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ImageSource &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Picture
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get
            &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(_picture == &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
                {
                    _picture = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;BitmapImage&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.PictureUrl);
                }
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_picture;
            }
        }
    }
}&lt;/span&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Voici la solution incluant le projet Silverlight:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7343.image_5F00_8.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5102.image_5F00_thumb_5F00_3.png" width="301" height="364" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;La couche Vue&lt;/h2&gt;

&lt;p&gt;Depuis la nouvelle version de Pivot Viewer disponible avec Silverlight 5, il est très facile de l’utiliser pour afficher, trier et filtrer une collection de données.&lt;/p&gt;

&lt;p&gt;Nous allons le mettre en oeuvre de manière très basique pour cette démo. Ajoutez une nouvel élément de type Pivot Viewer dans la page de démarrage.&lt;/p&gt;

&lt;p&gt;Associez le binding du Datacontext à la propriété Wines comme nous l’avons fait sur les plate-formes WP et Win8 dans les ListViews.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;UserControl &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;toolkit&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit&amp;quot;
             &lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;CaveAVins.PivotViewer.MainPage&amp;quot;
             &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
             &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;
             &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;d&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;
             &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;mc&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;
             &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;clr-namespace:System.Windows.Controls.Pivot;assembly=System.Windows.Controls.Pivot&amp;quot;
             &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;cnv&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;clr-namespace:CaveAVins.PivotViewer.Converters&amp;quot;
             &lt;/span&gt;&lt;span style="background: white; color: red"&gt;mc&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Ignorable&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;d&amp;quot;
             &lt;/span&gt;&lt;span style="background: white; color: red"&gt;d&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;DesignHeight&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;300&amp;quot;
             &lt;/span&gt;&lt;span style="background: white; color: red"&gt;d&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;DesignWidth&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;400&amp;quot;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot;
          &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Background&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;White&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewer &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Wines&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot;&amp;gt;

            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewer.PivotProperties&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewerStringProperty &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Name&amp;quot;
                                                 &lt;/span&gt;&lt;span style="background: white; color: red"&gt;DisplayName&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Name&amp;quot;
                                                 &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Binding&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; /&amp;gt;

                &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewerNumericProperty &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Id&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Year&amp;quot;
                                                  &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Options&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;CanFilter&amp;quot;
                                                  &lt;/span&gt;&lt;span style="background: white; color: red"&gt;DisplayName&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Year&amp;quot;
                                                  &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Binding&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Year&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; /&amp;gt;

            &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewer.PivotProperties&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;

            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewer.ItemTemplates&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                
                &lt;/span&gt;&lt;span style="background: white; color: green"&gt;&amp;lt;!-- Small--&amp;gt;
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewerItemTemplate &lt;/span&gt;&lt;span style="background: white; color: red"&gt;MaxWidth&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;100&amp;quot;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Border &lt;/span&gt;&lt;span style="background: white; color: red"&gt;BorderBrush&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Black&amp;quot;
                            &lt;/span&gt;&lt;span style="background: white; color: red"&gt;BorderThickness&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;1&amp;quot;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Source&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Path&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=Picture}&amp;quot;
                               &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Width&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;65&amp;quot;
                               &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Height&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;89&amp;quot; /&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Border&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewerItemTemplate&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;

                &lt;/span&gt;&lt;span style="background: white; color: green"&gt;&amp;lt;!-- Medium--&amp;gt;
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewerItemTemplate&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Border &lt;/span&gt;&lt;span style="background: white; color: red"&gt;BorderBrush&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Black&amp;quot;
                            &lt;/span&gt;&lt;span style="background: white; color: red"&gt;BorderThickness&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;0&amp;quot;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Orientation&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Vertical&amp;quot;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Text&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot;
                                       &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Width&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;176&amp;quot;
                                       &lt;/span&gt;&lt;span style="background: white; color: red"&gt;FontSize&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;14&amp;quot;
                                       &lt;/span&gt;&lt;span style="background: white; color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Bold&amp;quot;
                                       &lt;/span&gt;&lt;span style="background: white; color: red"&gt;TextWrapping&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Wrap&amp;quot;
                                       &lt;/span&gt;&lt;span style="background: white; color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Center&amp;quot; /&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Source&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Path&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=Picture}&amp;quot;
                                   &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Width&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;176&amp;quot;
                                   &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Height&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;240&amp;quot; /&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Border&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewerItemTemplate&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;

            &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewer.ItemTemplates&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;

        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;pivot&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;PivotViewer&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;UserControl&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nous définissons 2 templates qui correspondent à 2 manières d’afficher un vin, en fonction du niveau de zoom. Le premier est une simple image, le second est une image ainsi que le nom du vin. Il est ainsi possible d’afficher de plus en plus de détails sur l’éléments au fur et à mesure que l’on zoome sur celui-ci.&lt;/p&gt;

&lt;p&gt;On utilise le binding vers les propriétés Name, Picture et Year de manière tout à fait classique, ce qui est une nouveauté depuis Silverlight 5 et la nouvelle version de Pivot Viewer.&lt;/p&gt;

&lt;p&gt;La propriété Year est définie comme “CanFilter” et permet ainsi de filtrer les vins en fonction de leur année de production.&lt;/p&gt;

&lt;p&gt;Pour plus d’informations sur Pivot Viewer et voir une version plus évoluée de cette application (plus de niveaux de zoom, chargement par lots, commandes, personnalisation de Pivot Viewer), je vous conseille la vidéo des Techdays 2012 à ce sujet : &lt;a href="http://www.microsoft.com/fr-fr/showcase/details.aspx?uuid=1ec3181f-f385-4c0c-a25a-bd8f1992d27d"&gt;De A à Z : Utiliser PivotViewer dans une application orientée données&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&amp;#160;&lt;/h3&gt;

&lt;h2&gt;Initialisation de l’application&lt;/h2&gt;

&lt;p&gt;Le chargement des données se fait au démarrage de l’application:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;private void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Application_Startup(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;object &lt;/span&gt;&lt;span style="background: white; color: black"&gt;sender, &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;StartupEventArgs &lt;/span&gt;&lt;span style="background: white; color: black"&gt;e)
{
&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;   CaveAVinsDataProvider &lt;/span&gt;&lt;span style="background: white; color: black"&gt;dp = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsDataProvider&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();
      dp.WinesLoaded += (wines =&amp;gt;
      {
         &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;vm = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(wines.Select(w =&amp;gt; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;SlWineVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(w)));
            (&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.RootVisual &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;as &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;UserControl&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).DataContext = vm;
      });

      dp.LoadDataAsync();

      &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.RootVisual = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;MainPage&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();
}&lt;/span&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;h2&gt;&lt;span style="background: white; color: black"&gt;Go !&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;Et voici une version très basique d’application Silverlight 5 avec Pivot Viewer qui permet la manipulation de notre collection de vins.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;h2&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2860.image_5F00_4.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6758.image_5F00_thumb_5F00_1.png" width="692" height="381" /&gt;&lt;/a&gt; &lt;/h2&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6232.image_5F00_6.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7416.image_5F00_thumb_5F00_2.png" width="693" height="351" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;h1&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;Pour aller plus loin et profiter de ce partage de code, il faudrait implémenter les autres méthodes de la couche DAL, qui permettent d’éditer les données :&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ICaveAVinsDataProvider
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;event &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Action&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;IWine&lt;/span&gt;&amp;gt;&amp;gt; WinesLoaded;
    &lt;span style="color: blue"&gt;void &lt;/span&gt;LoadDataAsync();

    &lt;span style="color: green"&gt;//void UpdateItem(IWine item);
    //void AddItem(IWine item);
    //void RemoveItem(IWine item);
&lt;/span&gt;}&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cela se fait comme pour le chargement : en fonction de la plate-forme. Dans le cas de Windows 8, il faut créer la requête REST à la main, suivant le formalisme OData. Pour Windows Phone et Silverlight, il suffit d’utiliser Linq et WCF Data Services.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Au final, cela peut paraitre contraignant de passer par la Portable Lib - et ça l’est effectivement – pour parfois peu de bénéfices. Mais en fonction du projet que vous développez cela peut être une vraie valeur ajoutée. Ce projet de démo n’est peut être pas le meilleur candidat au partage de code, mais il permet d’en montrer les principes et la mise en oeuvre de manière très simple.&lt;/p&gt;

&lt;p&gt;Les principaux critères à prendre en compte pour décider de partir sur une base commune ou de développer des versions entièrement différentes sur chaque plate-forme sont les suivants:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;- la taille des équipes de développement (il est plus simple pour les développeurs de la couche de présentation d’utiliser toujours les mêmes propriétés des mêmes classes/interfaces quelle que soit la plate-forme)&lt;/p&gt;

  &lt;p&gt;- le nombre de plate-formes à supporter (économie d’échelle)&lt;/p&gt;

  &lt;p&gt;- l’évolutivité potentielle de votre application (plus facile à maintenir une fois la base commune mise en place)&lt;/p&gt;

  &lt;p&gt;- la structure et le contenu du code existant (si tout est différent sur chaque plate-forme, ça ne vaut pas forcément le coup)&lt;/p&gt;

  &lt;p&gt;- le besoin de documentation d’architecture, de preuve de portabilité et de propreté de conception (si vous faites une petite appli tout seul dans votre coin, ce n’est pas comme si vous étiez en charge d’un projet, d’une vision à moyen/long terme de votre développement, et de la meilleure manière de répartir la charge entre les développeurs)&lt;/p&gt;

  &lt;p&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;A vous de jouer !&lt;/p&gt;
&lt;script type="text/javascript"&gt;// &lt;![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]&gt;&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10301854" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/MVVM/">MVVM</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/OData/">OData</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WCF+Data+Services/">WCF Data Services</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Portable+Library/">Portable Library</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sources/">Sources</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Visual+Studio/">Visual Studio</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/CaveAVins/">CaveAVins</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Projet/">Projet</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category></item><item><title>Partager du code entre plate-formes : l’application Windows Phone (3/4)</title><link>http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-phone-3-4.aspx</link><pubDate>Mon, 07 May 2012 15:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10301837</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10301837</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-phone-3-4.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;[Edit 31/05/2012] Le sujet du portage d’application depuis Windows Phone vers Windows 8 (et donc indirectement du partage de code entre plates-formes) a aussi été traité de manière très détaillée par Pierre Cauchois dans sa suite d’articles &lt;a href="http://blogs.msdn.com/b/pierreca/archive/2012/05/28/strat-233-gies-et-techniques-de-partage-de-code-c-et-xaml-entre-windows-phone-et-windows-8-consumer-preview-partie-1-introduction-les-diff-233-rences-entre-les-plateformes-224-avoir-en-t-234-te.aspx"&gt;Stratégies et techniques de partage de code C# et XAML entre Windows Phone et Windows 8&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Voici le troisième article de la série:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-gr-226-ce-224-la-portable-class-library-1-4.aspx"&gt;Partager du code entre plate-formes grâce à la Portable Library (1/4)&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-8-metro-2-4.aspx"&gt;Partager du code entre plate-formes : l’application Windows 8 Metro (2/4)&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- Partager du code entre plate-formes : l’application Windows Phone (3/4)&lt;/p&gt;    &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-silverlight-5-4-4.aspx"&gt;Partager du code entre plate-formes : l’application Silverlight 5 (4/4)&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Retrouvez le code source des démos:&lt;/p&gt; &lt;iframe height="128" src="https://skydrive.live.com/embed?cid=63046D1C0F2DEB83&amp;amp;resid=63046D1C0F2DEB83%211516&amp;amp;authkey=APVmEuhb3kPTnpQ" frameborder="0" width="165" scrolling="no"&gt;&lt;/iframe&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;L’application Windows Phone&lt;/h1&gt;  &lt;p&gt;La version actuelle de VS11 ne permet pas de créer des applications Windows Phone et il faut donc se résoudre à créer une solution sous Visual Studio 2010 pour la version WP7 de notre démo.&lt;/p&gt;  &lt;p&gt;Le projet commun est déjà codé et prêt à être utilisé dans notre application WP, reste à créer le projet de type Windows Phone 7. Encore une fois, je choisis le template le plus simple pour ne pas surcharger la démo :&lt;/p&gt;  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image36.png"&gt;&lt;img title="image_thumb19" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb19" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3465.image_5F00_thumb19_5F00_1fc8c3f9_2D00_35bc_2D00_4d6a_2D00_a716_2D00_271b36a20b70.png" width="645" height="402" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;On ajoute le projet CaveAVins.PortableLib dans notre solution ainsi qu’une référence à celui-ci dans le projet WP7.&lt;/p&gt;  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image40.png"&gt;&lt;img title="image_thumb21" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb21" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4454.image_5F00_thumb21_5F00_7bf0f801_2D00_ebf7_2D00_4769_2D00_84bc_2D00_8992b237a2ab.png" width="287" height="379" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;La couche d’accès aux données (DAL)&lt;/h2&gt;  &lt;p&gt;Cette fois, c’est plus simple puisqu’il suffit d’ajouter une référence au service OData dans notre projet WP7 :&lt;/p&gt;  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image45.png"&gt;&lt;img title="image_thumb24" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb24" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8508.image_5F00_thumb24_5F00_372c5fb3_2D00_95c1_2D00_45a7_2D00_bfbe_2D00_26d19c640b3a.png" width="504" height="410" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Les classes proxy correspondantes seront créées automatiquement, et nous aurons donc une implémentation toute prête de notre classe Wine. Vous pouvez accéder au fichier&amp;#160; References.cs contenant les classes proxy en cliquant sur le bouton “Show All Files” permettant d’afficher les fichiers caché de la solution :&lt;/p&gt;  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image54.png"&gt;&lt;img title="image_thumb29" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb29" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3324.image_5F00_thumb29_5F00_25661a4a_2D00_69cf_2D00_4f23_2D00_b875_2D00_b0133c7be562.png" width="443" height="425" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Vous y trouverez une classe Wine avec les propriétés qui vont bien, dont Name, PictureUrl et Year:&lt;/p&gt;  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image53.png"&gt;&lt;img title="image_thumb28" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb28" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3326.image_5F00_thumb28_5F00_b57598a2_2D00_88ce_2D00_4b9a_2D00_b8a2_2D00_da2f8543c79c.png" width="565" height="231" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Le souci c’est qu’elle n’impléménte pas notre interface inter-plateforme IWine. En fait ce n’est pas vraiment un souci puisque cette classe est définie en partial et peut donc être complétée facilement comme ceci dans un fichier Wine.cs que je place dans un nouveau répertoire “Model”:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: green"&gt;// Même namespace que les classes proxy générées en faisant le Add Service reference vers mon service OData
&lt;/span&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;CaveAVins.WP.ServiceReference1
{
    &lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Wine &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IWine
    &lt;/span&gt;{
        &lt;span style="color: green"&gt;// Mes classes proxy servent d'implémentation à mon interface portable IWine
    &lt;/span&gt;}
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Le chargement de la collection de vins (notre implémentation côté DAL pour Windows Phone) sera faite grâce à WCF Data Services, de manière très classique :&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Data.Services.Client;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Linq;
&lt;span style="color: blue"&gt;using &lt;/span&gt;CaveAVins.Portable.DAL;
&lt;span style="color: blue"&gt;using &lt;/span&gt;CaveAVins.WP.ServiceReference1;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;CaveAVins.WP.DAL
{
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CaveAVinsDataProvider &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;ICaveAVinsDataProvider
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;public event &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Action&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;IWine&lt;/span&gt;&amp;gt;&amp;gt; WinesLoaded;
        &lt;span style="color: #2b91af"&gt;DataServiceCollection&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Wine&lt;/span&gt;&amp;gt; _results;

        &lt;span style="color: blue"&gt;public void &lt;/span&gt;LoadDataAsync()
        {
            &lt;span style="color: #2b91af"&gt;CaveAVinsContext &lt;/span&gt;ct = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CaveAVinsContext&lt;/span&gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;http://caveavins.cloudapp.net/CaveAVinsDataService.svc/&amp;quot;&lt;/span&gt;));
            _results = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataServiceCollection&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Wine&lt;/span&gt;&amp;gt;(ct);
            _results.LoadCompleted += (o, e) =&amp;gt;
                {
                    &lt;span style="color: blue"&gt;if &lt;/span&gt;(e.Error == &lt;span style="color: blue"&gt;null&lt;/span&gt;)
                    {
                        &lt;span style="color: green"&gt;// Handle a paged data feed.
                        &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(_results.Continuation != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
                        {
                            &lt;span style="color: green"&gt;// Automatically load the next page.
                            &lt;/span&gt;_results.LoadNextPartialSetAsync();
                        }
                        &lt;span style="color: blue"&gt;else
                        &lt;/span&gt;{
                           WinesLoaded(_results.Cast&amp;lt;&lt;span style="color: #2b91af"&gt;IWine&lt;/span&gt;&amp;gt;());
                        }
                    }
                };

            _results.LoadAsync(ct.Wines);
        }

    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;On n’oublie pas de déclencher l’évènement de fin de chargement.&lt;/p&gt;

&lt;h3&gt;La couche ViewModel&lt;/h3&gt;

&lt;p&gt;Rien à faire ici : notre implémentation disponible dans la Portable Lib nous suffit.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;La couche Vue&lt;/h3&gt;

&lt;p&gt;Encore une fois, on utilise une page fournie dans le template : MainPage.xaml que l’on complète de la manière suivante.&lt;/p&gt;

&lt;p&gt;Chaque vin est représenté par le DataTemplate suivant dont les éléments sont bindés aux propriétés Name, Year et PictureUrl de notre classe WineVM:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot;&amp;gt;
   &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
   &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
   &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;120&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;120&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;PictureUrl&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Uniform&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
   &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TextWrapping&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Wrap&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;PhoneTextLargeStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Year&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TextWrapping&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Wrap&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;12,-6,12,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;PhoneTextSubtleStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;/&amp;gt;
   &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Comme le téléphone a un écran plus long que large, on choisit plutôt un défilement vertical. C’est le fonctionnement par défaut de la ListBox:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MainListBox&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0,0,-12,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Wines&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Remarquez que les bindings sont similaires à ceux de l’application Windows 8 : en effet, les ViewModels sont communs (sauf pour l’image)!&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Voici le code complet de la page:&lt;/p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;phone&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;PhoneApplicationPage 
    &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CaveAVins.WP.MainPage&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;phone&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;shell&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;mc&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;mc&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Ignorable&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;d&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DesignWidth&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;480&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;d&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;DesignHeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;768&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;FontFamily&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;PhoneFontFamilyNormal&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;FontSize&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;PhoneFontSizeNormal&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;Foreground&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;PhoneForegroundBrush&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;SupportedOrientations&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Portrait&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Orientation&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Portrait&amp;quot;
    &lt;/span&gt;&lt;span style="color: red"&gt;shell&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;SystemTray.IsVisible&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot;
    &amp;gt;

    &lt;/span&gt;&lt;span style="color: green"&gt;&amp;lt;!--LayoutRoot is the root grid where all page content is placed--&amp;gt;
    &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LayoutRoot&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Transparent&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot;/&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot;/&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &lt;/span&gt;&lt;span style="color: green"&gt;&amp;lt;!--TitlePanel contains the name of the application and page title--&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TitlePanel&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;12,17,0,28&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ApplicationTitle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;PORTABLE LIBRARY DEMO&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;PhoneTextNormalStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;/&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;PageTitle&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Wines&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;9,-7,0,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;PhoneTextTitle1Style&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;/&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &lt;/span&gt;&lt;span style="color: green"&gt;&amp;lt;!--ContentPanel - place additional content here--&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ContentPanel&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;12,0,12,0&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;MainListBox&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0,0,-12,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Wines&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Auto&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;*&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ColumnDefinition&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;120&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;120&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Source&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;PictureUrl&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Stretch&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Uniform&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Image&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;1&amp;quot;&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TextWrapping&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Wrap&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;PhoneTextLargeStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;/&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Year&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;TextWrapping&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Wrap&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Margin&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;12,-6,12,0&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;PhoneTextSubtleStyle&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;/&amp;gt;
                            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;span style="color: green"&gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;phone&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;PhoneApplicationPage&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h3&gt;Initialisation de l’application&lt;/h3&gt;

&lt;p&gt;La chargement des données se fera au démarrage de l’application, dans l’évènement Application_Launching.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: green"&gt;// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
&lt;/span&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;Application_Launching(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;LaunchingEventArgs &lt;/span&gt;e)
{
    &lt;span style="color: #2b91af"&gt;CaveAVinsDataProvider &lt;/span&gt;dp = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CaveAVinsDataProvider&lt;/span&gt;();
    dp.WinesLoaded += (wines =&amp;gt;
    {
        _vm = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CaveAVinsVM&lt;/span&gt;(wines);
        RootFrame.DataContext = _vm;
    });

    dp.LoadDataAsync();
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Cette fois, nous pouvons utiliser le ViewModel par défaut pour les vins (celui défini dans la Portable Lib) et donc passer directement la collection wines récupérée dans l’évènement WinesLoaded. 
  &lt;br /&gt;Tout comme dans l’application Windows 8, on affecte le viewModel principal (CaveAVinsVM) au DataContext de notre page principale dont tous les contrôles hériteront.&lt;/p&gt;

&lt;h3&gt;Go !&lt;/h3&gt;

&lt;p&gt;Au démarrage de l’application, nous obtenons le résultat suivant :&lt;/p&gt;

&lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image60.png"&gt;&lt;img title="image_thumb36" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb36" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2350.image_5F00_thumb36_5F00_7712ea1d_2D00_f45e_2D00_47d5_2D00_a49c_2D00_f8d512cd297c.png" width="193" height="362" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;La suite : &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-silverlight-5-4-4.aspx"&gt;Partager du code entre plate-formes : l’application Silverlight 5 (4/4)&lt;/a&gt;&lt;/p&gt;
&lt;script type="text/javascript"&gt;// &lt;![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]&gt;&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10301837" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/MVVM/">MVVM</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WP7/">WP7</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/OData/">OData</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WCF+Data+Services/">WCF Data Services</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sources/">Sources</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Visual+Studio/">Visual Studio</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/CaveAVins/">CaveAVins</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Projet/">Projet</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone/">Windows Phone</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Mango/">Mango</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-5/">Windows Phone 7.5</category></item><item><title>Partager du code entre plate-formes : l’application Windows 8 Metro (2/4)</title><link>http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-8-metro-2-4.aspx</link><pubDate>Mon, 07 May 2012 15:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10301834</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10301834</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-8-metro-2-4.aspx#comments</comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Voici le deuxième article de la série :&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-gr-226-ce-224-la-portable-class-library-1-4.aspx"&gt;Partager du code entre plate-formes grâce à la Portable Library (1/4)&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- Partager du code entre plate-formes : l’application Windows 8 Metro (2/4)&lt;/p&gt;    &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-phone-3-4.aspx"&gt;Partager du code entre plate-formes : l’application Windows Phone (3/4)&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-silverlight-5-4-4.aspx"&gt;Partager du code entre plate-formes : l’application Silverlight 5 (4/4)&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Retrouvez le code source des démos:&lt;/p&gt; &lt;iframe height="128" src="https://skydrive.live.com/embed?cid=63046D1C0F2DEB83&amp;amp;resid=63046D1C0F2DEB83%211516&amp;amp;authkey=APVmEuhb3kPTnpQ" frameborder="0" width="165" scrolling="no"&gt;&lt;/iframe&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;L’application Windows 8 Metro&lt;/h1&gt;  &lt;p&gt;Je commence par créer un nouveau projet de type Portable Class Library sous Visual Studio 11. Celui-ci sera commun et utilisé par mes 3 applications à venir.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3704.image_5F00_6.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5367.image_5F00_thumb_5F00_2.png" width="707" height="432" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;h2&gt;Le projet de type Portable Class Library&lt;/h2&gt;  &lt;p&gt;Dans les propriétés du projet, je sélectionne les 3 plate-formes dans ma Portable Lib.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6763.image_5F00_8.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8585.image_5F00_thumb_5F00_3.png" width="387" height="433" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Je prends soin de sélectionner Windows Phone &lt;strong&gt;7.5&lt;/strong&gt; sinon je n’aurais pas accès à l’assembly System.Windows.dll qui me permet d’utiliser tout ce qui est associé au INotifyxxx et les éléments observables. En effet, j’en aurai besoin pour la couche ViewModel.&lt;/p&gt;  &lt;p&gt;On me prévient gentiment que d’autres plateformes seront aussi compatibles avec celles que j’ai sélectionnées, à savoir .Net 4.5 et Silverlight 4 et &amp;gt;.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Dans mon projet, je crée les répertoires correspondant à chacune des couches supportées par la portable lib: DAL, Model, ViewModel&lt;/p&gt;  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image11.png"&gt;&lt;img title="image_thumb8" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb8" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7026.image_5F00_thumb8_5F00_6d824207_2D00_ba56_2D00_464b_2D00_82f8_2D00_b4b36752bbbb.png" width="221" height="156" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Dans cette application simpliste, je n’aurai qu’un type de données à gérer : la classe Wine que je place dans la couche Model :&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.Model
{
&lt;/span&gt;&lt;span style="background: white; color: green"&gt;    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Wine&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Name { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public int &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Year { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;PictureUrl { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;h3&gt;La couche d’accès aux données (DAL)&lt;/h3&gt;

&lt;p&gt;Pour récupérer une collection de vins à partir de mon service OData, je vais procéder de manière différente selon que je travaille sur Win8 ou WP.&lt;/p&gt;

&lt;p&gt;C’est WCF Data Services (une implémentation pour un client OData) qui va permettre d’ajouter une référence à mon service OData dans Windows Phone (tout comme on le ferait dans .Net ou Silverlight). Dans ce cas, les classes proxy (comprenant la classe Wine) sont générées automatiquement.&lt;/p&gt;

&lt;p&gt;Avec Visual Studio 11, il n’y a pas encore de client OData disponible et nous devrons donc parser manuellement le flux Atom renvoyé par le service pour le mapper dans une collection d’éléments de type Wine.&lt;/p&gt;

&lt;p&gt;J’aurai donc plusieurs implémentations de mon modèle matérialisé par la classe Wine : l’une manuelle comme mentionné plus haut, dans Windows 8 et l’autre générée automatiquement par Visual Studio.&lt;/p&gt;

&lt;p&gt;Je rajoute donc une interface qui définira la signature de ce qu’est un vin dans notre application : un nom, une année de production et un lien vers la photo de l’étiquette de la bouteille.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.DAL
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public interface &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Name { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;int &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Year { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;PictureUrl { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Les classes Wine implémenteront cette interface 

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.Model
{
    &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Implémentation par défaut
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Wine &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Name { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public int &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Year { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;PictureUrl { &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set&lt;/span&gt;&lt;span style="background: white; color: black"&gt;; }
    }
}&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;J’ajoute également l’interface du data provider qui me permettra de manipuler les données :&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.DAL
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public interface &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ICaveAVinsDataProvider
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span&gt;event Action&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;IWine&amp;gt;&amp;gt; WinesLoaded;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;LoadDataAsync();

        &lt;/span&gt;&lt;span style="background: white; color: green"&gt;//void UpdateItem(Wine item);
        //void AddItem(Wine item);
        //void RemoveItem(Wine item);
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;}
}&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Je commence par m’occuper du chargement asynchrone des données, dont la fin est signalée par l’évènement WinesLoaded. Remarquez que c’est un simple event, j’ai choisi de ne faire intervenir les éléments notifiables qu’à partir de la couche ViewModel.&lt;/p&gt;

&lt;h3&gt;&amp;#160;&lt;/h3&gt;

&lt;h3&gt;La couche ViewModel&lt;/h3&gt;

&lt;p&gt;La couche ViewModel va permettre à la couche View d’interagir avec le modèle et la DAL par les mécanismes de binding, en utilisant des éléments “notifiables”.&lt;/p&gt;

&lt;p&gt;Nous créons une classe de base ViewModelBase qui implémente INotifyPropertyChanged pour en faire bénéficier automatiquement tous les ViewModels.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public abstract class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ViewModelBase &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;INotifyPropertyChanged
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;PropertyChangedEventHandler &lt;/span&gt;&lt;span style="background: white; color: black"&gt;PropertyChanged;

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;protected virtual void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;OnPropertyChanged(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;propName)
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(PropertyChanged != &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
            {
                PropertyChanged(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;PropertyChangedEventArgs&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(propName));
            }
        }
    }&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Nous créons ensuite un ViewModel associé à un vin : WineVM&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.ViewModel
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;WineVM &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ViewModelBase
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;WineVM(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine &lt;/span&gt;&lt;span style="background: white; color: black"&gt;wine)
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(!&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.IsNullOrEmpty(wine.PictureUrl))
            {
                _pictureUrl = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Uri&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(wine.PictureUrl);
            }
            _name = wine.Name;
            _year = wine.Year;
        }

        &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Uri &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_pictureUrl = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Uri &lt;/span&gt;&lt;span style="background: white; color: black"&gt;PictureUrl
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get
            &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_pictureUrl;
            }           
        }

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;private string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_name;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public string &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Name
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{ &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_name; }
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set 
            &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(_name != &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;value&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
                {
                    _name = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;value&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
                    OnPropertyChanged(&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);
                }
            }
        }

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;private int &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_year;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public int &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Year
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{ &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_year; }
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;set
            &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(_year != &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;value&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
                {
                    _year = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;value&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
                    OnPropertyChanged(&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;&amp;quot;Year&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);
                }
            }
        }        
    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Ainsi qu’un ViewModel permettant de manipuler la collection de vins renvoyée par la DAL:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.ViewModel
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsVM &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ViewModelBase
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVinsVM(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; wines)
        {
            _wines = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ObservableCollection&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;WineVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt;(wines.Select(w =&amp;gt; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;WineVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(w)));
        }

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVinsVM(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;WineVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; wines)
        {
            _wines = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ObservableCollection&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;WineVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt;(wines);
        }

        &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ObservableCollection&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;WineVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; _wines;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ObservableCollection&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;WineVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; Wines
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get
            &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_wines;
            }
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;private set
            &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
                _wines = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;value&lt;/span&gt;&lt;span style="background: white; color: black"&gt;;
            }
        }

    }
}&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Voici la structure de notre projet de type Portable Class Library, qui sera commun aux deux solutions Windows 8 Metro et Windows Phone:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image14%5B1%5D.png"&gt;&lt;img title="image_thumb9[1]" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb9[1]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8816.image_5F00_thumb9_5B00_1_5D005F00_af80cae8_2D00_e6e5_2D00_4848_2D00_83a0_2D00_648130727fe9.png" width="275" height="299" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Le projet Windows 8 Metro&lt;/h2&gt;

&lt;p&gt;Créons un nouveau projet de type Metro: vous pouvez choisir un template qui inclut une navigation et une présentation de collection.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image191.png"&gt;&lt;img title="image_thumb121" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb121" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7532.image_5F00_thumb121_5F00_dce722ab_2D00_d352_2D00_4c16_2D00_a777_2D00_1f9ea3a3477d.png" width="683" height="415" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Moi j’ai choisi une application vide pour me focaliser sur le sujet de cet article:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image24.png"&gt;&lt;img title="image_thumb15" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb15" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8816.image_5F00_thumb15_5F00_ca445f60_2D00_7b1f_2D00_493c_2D00_bddb_2D00_922e7e026c87.png" width="684" height="419" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;J’ajoute une référence au projet CaveAVins.Portable pour pouvoir l’utiliser dans mon application.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h3&gt;La couche d’accès aux données (DAL)&lt;/h3&gt;

&lt;p&gt;Je crée un répertoire DAL ainsi qu’un fichier CaveAVinsDataProvider.cs et sa classe CaveAVinsDataProvider qui implémente IDaveAVinsDataProvider et permet ainsi l’accès au service OData et à la collection de vins. &lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image9%5B1%5D.png"&gt;&lt;img title="image_thumb4[1]" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb4[1]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2148.image_5F00_thumb4_5B00_1_5D005F00_53b0e38d_2D00_b95a_2D00_4f6e_2D00_b899_2D00_4c33576c0623.png" width="345" height="414" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A ce jour, il n’existe pas de version de WCF Data Services pour Windows 8 et il faudra donc accéder à mon &lt;a href="http://caveavins.cloudapp.net/CaveAVinsDataService.svc/Wines"&gt;service OData&lt;/a&gt; et parser le flux de données manuellement. &lt;/p&gt;

&lt;p&gt;Voici à quoi il ressemble:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0005.image_5F00_4.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4705.image_5F00_thumb_5F00_1.png" width="751" height="477" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;J’utilise le SyndicationClient qui me permet de récupérer simplement un flux Atom. &lt;/p&gt;

&lt;p&gt;Je le parse manuellement pour n’en conserver que les propriétés Name, Year et PictureUrl. J’instancie pour chaque vin, la classe Wine que j’ai créée dans la Portable Lib, puis je déclenche l’évènement WinesLoaded pour signaler que le chargement des données est terminé.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Collections.Generic;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Linq;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Text;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Threading.Tasks;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.DAL;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.Model;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Windows.Web.Syndication;

&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Win8Metro.DAL
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsDataProvider &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ICaveAVinsDataProvider
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{        
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public event &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Action&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt;&amp;gt; WinesLoaded;

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public async void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;LoadDataAsync()
        {
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;SyndicationClient &lt;/span&gt;&lt;span style="background: white; color: black"&gt;client = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;SyndicationClient&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Uri &lt;/span&gt;&lt;span style="background: white; color: black"&gt;feedUri = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Uri&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;&amp;quot;http://caveavins.cloudapp.net/CaveAVinsDataService.svc/Wines&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IList&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Wine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; wines = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;List&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Wine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt;();

            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;SyndicationFeed &lt;/span&gt;&lt;span style="background: white; color: black"&gt;feed = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;await &lt;/span&gt;&lt;span style="background: white; color: black"&gt;client.RetrieveFeedAsync(feedUri);


            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;foreach &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;SyndicationItem &lt;/span&gt;&lt;span style="background: white; color: black"&gt;item &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;in &lt;/span&gt;&lt;span style="background: white; color: black"&gt;feed.Items)
            {
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;try
                &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
                    &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Wine &lt;/span&gt;&lt;span style="background: white; color: black"&gt;newWine = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Wine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();
                    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;attributes = item.Content.Xml.FirstChild.ChildNodes.AsEnumerable();
                    &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Func&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;, &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; parse = (an) =&amp;gt;
                    {
                        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;attr = attributes.FirstOrDefault(a =&amp;gt; a.LocalName.ToString() == an);
                        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;((attr != &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black"&gt;) &amp;amp;&amp;amp; (attr.HasChildNodes()))
                        {
                            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;attr.FirstChild.NodeValue.ToString();
                        }
                        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return string&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Empty;
                    };

                    newWine.Name = parse(&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);
                    newWine.Year = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;int&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Parse(parse(&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;&amp;quot;Year&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;));
                    newWine.PictureUrl = parse(&lt;/span&gt;&lt;span style="background: white; color: maroon"&gt;&amp;quot;PictureUrl&amp;quot;&lt;/span&gt;&lt;span style="background: white; color: black"&gt;);
                    wines.Add(newWine);
                }
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;catch
                &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
                    &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// On ajoute que les items valides
                &lt;/span&gt;&lt;span style="background: white; color: black"&gt;}
            }
            WinesLoaded(wines);
        }
    }
}
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h3&gt;La couche ViewModel&lt;/h3&gt;

&lt;p&gt;Elle est déjà créée dans la portable lib. Il reste à complémenter celle-ci avec les certaines spécificités de la plate-forme. Dans notre cas, cela revient à compléter la classe WineVM.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image18.png"&gt;&lt;img title="image_thumb9" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb9" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6371.image_5F00_thumb9_5F00_5198f8a7_2D00_f47f_2D00_467b_2D00_8809_2D00_f6deb887707f.png" width="320" height="265" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Il faut créer une BitmapImage à partir d’une Uri, pour pouvoir afficher l’image de la bouteille. Je crée donc une classe dérivée de WineVM qui comporte une propriété supplémentaire qui sera bindée à une image dans la vue.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Collections.Generic;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Linq;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Text;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;System.Threading.Tasks;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.DAL;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Portable.ViewModel;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Windows.UI.Xaml.Media;
&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;using &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Windows.UI.Xaml.Media.Imaging;

&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;CaveAVins.Win8Metro.ViewModel
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public class &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Win8WineVM &lt;/span&gt;&lt;span style="background: white; color: black"&gt;: &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;WineVM
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Win8WineVM(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine &lt;/span&gt;&lt;span style="background: white; color: black"&gt;wine) : &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;base&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(wine)
        {
        }

        &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ImageSource &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_picture;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ImageSource &lt;/span&gt;&lt;span style="background: white; color: black"&gt;Picture
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;get
            &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(_picture == &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;null&lt;/span&gt;&lt;span style="background: white; color: black"&gt;)
                {
                    _picture = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;BitmapImage&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;this&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.PictureUrl);
                }
                &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;return &lt;/span&gt;&lt;span style="background: white; color: black"&gt;_picture;
            }
        }
    }
}
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;La couche Vue&lt;/h3&gt;

&lt;p&gt;La couche Vue est belle et bien spécifique à la plate-forme et n’apparait donc pas dans la Portable Lib. Nous pourrions créer un répertoire View et y glisser les vues mais dans notre application, nous n’avons qu’une seule page qui est déjà présente dans le template d’application que nous avons choisi d’utiliser. C’est le fichier BlankPage.xaml.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image22.png"&gt;&lt;img title="image_thumb11" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb11" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6765.image_5F00_thumb11_5F00_b0045700_2D00_babb_2D00_4e7c_2D00_95ad_2D00_efd5ad477932.png" width="279" height="342" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Voici le code que j’utilise pour afficher mes éléments sous la forme d’une grille, avec un scrolling horizontal:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Page
    &lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Class&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;CaveAVins.Win8Metro.BlankPage&amp;quot;
    &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
    &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;
    &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;local&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;using:CaveAVins.Win8Metro&amp;quot;
    &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;d&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;
    &lt;/span&gt;&lt;span style="background: white; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;mc&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;
    &lt;/span&gt;&lt;span style="background: white; color: red"&gt;mc&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Ignorable&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;d&amp;quot;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Background&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ApplicationPageBackgroundBrush&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Height&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;140&amp;quot;/&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;RowDefinition &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Height&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;*&amp;quot;/&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
            
        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;pageTitle&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Text&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Portable Library Demo&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Style&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;PageHeaderTextStyle&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot;
                    &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Margin&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;116,0,40,46&amp;quot;/&amp;gt;

        &lt;/span&gt;&lt;span style="background: white; color: green"&gt;&amp;lt;!-- Horizontal scrolling grid used in most view states --&amp;gt;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;ScrollViewer
            &lt;/span&gt;&lt;span style="background: white; color: red"&gt;x&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;:&lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;itemGridScrollViewer&amp;quot;
            &lt;/span&gt;&lt;span style="background: white; color: red"&gt;AutomationProperties.AutomationId&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;ItemGridScrollViewer&amp;quot;
            &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;1&amp;quot;
            &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Margin&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;0,-3,0,0&amp;quot;
            &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Style&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;HorizontalScrollViewerStyle&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot;&amp;gt;

            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridView &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Wines&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot;
                          &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Margin&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;116,0,40,46&amp;quot;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridView.ItemTemplate&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="background: white; color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Width&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;250&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Height&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;250&amp;quot;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Source&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Picture&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Stretch&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Uniform&amp;quot;/&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="background: white; color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Bottom&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Background&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ListViewItemOverlayBackgroundBrush&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot;&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Text&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Foreground&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ListViewItemOverlayTextBrush&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Style&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;TitleTextStyle&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Height&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;60&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Margin&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;15,0,15,0&amp;quot;/&amp;gt;
                                &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Text&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Year&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Foreground&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ListViewItemOverlaySecondaryTextBrush&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Style&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;CaptionTextStyle&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;TextWrapping&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;NoWrap&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Margin&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;15,0,15,10&amp;quot;/&amp;gt;
                            &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridView.ItemTemplate&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;

            &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridView&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;ScrollViewer&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Page&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Remarquez que chaque élément de ma grille sera bindé aux propriétés Name, Year et Picture de mes vins projetés dans une collection de type WineVM. &lt;span style="background: white; color: blue"&gt;&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid &lt;/span&gt;&lt;span style="background: white; color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Left&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Width&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;250&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Height&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;250&amp;quot;&amp;gt;
   &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Image &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Source&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Picture&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Stretch&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Uniform&amp;quot;/&amp;gt;
   &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StackPanel &lt;/span&gt;&lt;span style="background: white; color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;Bottom&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Background&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ListViewItemOverlayBackgroundBrush&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Text&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Name&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Foreground&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ListViewItemOverlayTextBrush&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Style&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;TitleTextStyle&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Height&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;60&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Margin&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;15,0,15,0&amp;quot;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Text&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Year&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Foreground&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ListViewItemOverlaySecondaryTextBrush&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Style&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="background: white; color: red"&gt;CaptionTextStyle&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;TextWrapping&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;NoWrap&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Margin&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;15,0,15,10&amp;quot;/&amp;gt;
   &amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;font color="#0000ff"&gt;&lt;/font&gt;&lt;span style="background: white; color: blue"&gt;
    &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;La propriété ItemsSource de ma GridView sera bindée à la propriété Wines du viewModel &lt;span style="background: white; color: #2b91af"&gt;CaveAVinsVM.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="background: white; color: #2b91af"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;GridView &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;1&amp;quot; &lt;/span&gt;&lt;span style="background: white; color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="background: white; color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="background: white; color: red"&gt;Wines&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;}&amp;quot;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;La couche vue est prête, il faut maintenant charger les données !&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;Initalisation de l’application&lt;/h3&gt;

&lt;p&gt;Cela se passe dans le fichier app.xaml.cs, dans l’évènement OnLaunched qui correspond au lancement de l’application. Nous ajoutons le code qui nous permet de charger les données:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsDataProvider &lt;/span&gt;&lt;span style="background: white; color: black"&gt;dp = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsDataProvider&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();
            dp.WinesLoaded += dp_WinesLoaded;
            dp.LoadDataAsync();&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Ainsi que l’association des données chargées avec la vue sur déclenchement de l’évènement :&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;dp_WinesLoaded(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; wines)
        {
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsVM &lt;/span&gt;&lt;span style="background: white; color: black"&gt;vm = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(wines.Select(w =&amp;gt; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Win8WineVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(w)));
            (&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Window&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Current.Content &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;as &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Frame&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).DataContext = vm;
        }&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Pour chaque vin, on instancie un Win8WineVM et la collection résultante est passée en paramètre dans le constructeur de la classe CaveAVinsVM. Celle-ci est affectée au DataContext de notre page principale pour permettre aux bindings créés dans la vue de fonctionner.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Voici le code complet correspondant:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background: white; color: black"&gt;        &lt;/span&gt;&lt;span style="background: white; color: gray"&gt;/// &amp;lt;summary&amp;gt;
        /// &lt;/span&gt;&lt;span style="background: white; color: green"&gt;Invoked when the application is launched normally by the end user.  Other entry points
        &lt;/span&gt;&lt;span style="background: white; color: gray"&gt;/// &lt;/span&gt;&lt;span style="background: white; color: green"&gt;will be used when the application is launched to open a specific file, to display
        &lt;/span&gt;&lt;span style="background: white; color: gray"&gt;/// &lt;/span&gt;&lt;span style="background: white; color: green"&gt;search results, and so forth.
        &lt;/span&gt;&lt;span style="background: white; color: gray"&gt;/// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name=&amp;quot;args&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="background: white; color: green"&gt;Details about the launch request and process.&lt;/span&gt;&lt;span style="background: white; color: gray"&gt;&amp;lt;/param&amp;gt;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;protected override void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;OnLaunched(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;LaunchActivatedEventArgs &lt;/span&gt;&lt;span style="background: white; color: black"&gt;args)
        {
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;if &lt;/span&gt;&lt;span style="background: white; color: black"&gt;(args.PreviousExecutionState == &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;ApplicationExecutionState&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Terminated)
            {
                &lt;/span&gt;&lt;span style="background: white; color: green"&gt;//TODO: Load state from previously suspended application
            &lt;/span&gt;&lt;span style="background: white; color: black"&gt;}

            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsDataProvider &lt;/span&gt;&lt;span style="background: white; color: black"&gt;dp = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsDataProvider&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();
            dp.WinesLoaded += dp_WinesLoaded;
            dp.LoadDataAsync();

            &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Create a Frame to act navigation context and navigate to the first page
            &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;var &lt;/span&gt;&lt;span style="background: white; color: black"&gt;rootFrame = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Frame&lt;/span&gt;&lt;span style="background: white; color: black"&gt;();
            rootFrame.Navigate(&lt;/span&gt;&lt;span style="background: white; color: blue"&gt;typeof&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;BlankPage&lt;/span&gt;&lt;span style="background: white; color: black"&gt;));

            &lt;/span&gt;&lt;span style="background: white; color: green"&gt;// Place the frame in the current Window and ensure that it is active
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Window&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Current.Content = rootFrame;
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Window&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Current.Activate();
        }

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;dp_WinesLoaded(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IWine&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt; wines)
        {
            &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsVM &lt;/span&gt;&lt;span style="background: white; color: black"&gt;vm = &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;CaveAVinsVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(wines.Select(w =&amp;gt; &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;new &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Win8WineVM&lt;/span&gt;&lt;span style="background: white; color: black"&gt;(w)));
            (&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Window&lt;/span&gt;&lt;span style="background: white; color: black"&gt;.Current.Content &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;as &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;Frame&lt;/span&gt;&lt;span style="background: white; color: black"&gt;).DataContext = vm;
        }&lt;/span&gt;&lt;/pre&gt;

&lt;h2&gt;Go !&lt;/h2&gt;

&lt;p&gt;Nous pouvons démarre l’application qui affichera les bouteilles au bout de quelques secondes :&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7853.image_5F00_2.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5707.image_5F00_thumb.png" width="512" height="288" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;La suite : &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-phone-3-4.aspx"&gt;Partager du code entre plate-formes : l’application Windows Phone (3/4)&lt;/a&gt;&lt;/p&gt;
&lt;script type="text/javascript"&gt;// &lt;![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]&gt;&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10301834" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/MVVM/">MVVM</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WP7/">WP7</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/OData/">OData</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Portable+Library/">Portable Library</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sources/">Sources</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Visual+Studio/">Visual Studio</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/CaveAVins/">CaveAVins</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Projet/">Projet</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone/">Windows Phone</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-5/">Windows Phone 7.5</category></item><item><title>Partager du code entre plate-formes grâce à la Portable Class Library (1/4)</title><link>http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-gr-226-ce-224-la-portable-class-library-1-4.aspx</link><pubDate>Mon, 07 May 2012 15:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10301821</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10301821</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-gr-226-ce-224-la-portable-class-library-1-4.aspx#comments</comments><description>&lt;p&gt;Avec la multiplication des plate-formes, les besoins en terme de partage de code sont de plus en plus importants. L’arrivée de Windows 8 et les applications Metro va générer beaucoup de portage d’applications existantes et la réutilisation du code devient alors capitale. Le sujet est assez complexe puisque les frameworks ne sont pas équivalents sur les différentes plateformes mais conservent malgré tout un sous-ensemble commun.&lt;/p&gt;  &lt;p&gt;Le type de projet « Portable Library » permet justement de factoriser du code commun à plusieurs plateformes en donnant accès uniquement aux assemblies de base communes à celles-ci. On met tout le code commun dans cette librarie de classes qui est référencée par les projets spécifiques à chaque plate-forme et hop le tour est joué.&lt;/p&gt;  &lt;p&gt;Rhhha mais c’est génial ça ! Ca va me sauver la vie ? Oui et non…&lt;/p&gt;  &lt;p&gt;On sous-estime souvent les spécificités de la plateforme dans notre code et nous verrons qu’il peut être plus compliqué que prévu de conserver un code commun, au fil des 4 articles de la série:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;- Partager du code entre plate-formes grâce à la Portable Library (1/4)&lt;/p&gt;    &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-8-metro-2-4.aspx"&gt;Partager du code entre plate-formes : l’application Windows 8 Metro (2/4)&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-phone-3-4.aspx"&gt;Partager du code entre plate-formes : l’application Windows Phone (3/4)&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;- &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-silverlight-5-4-4.aspx"&gt;Partager du code entre plate-formes : l’application Silverlight 5 (4/4)&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;script type="text/javascript"&gt;// &lt;![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]&gt;&lt;/script&gt;&lt;/p&gt;  &lt;p&gt;Retrouvez le code source des démos:&lt;/p&gt; &lt;iframe height="128" src="https://skydrive.live.com/embed?cid=63046D1C0F2DEB83&amp;amp;resid=63046D1C0F2DEB83%211516&amp;amp;authkey=APVmEuhb3kPTnpQ" frameborder="0" width="165" scrolling="no"&gt;&lt;/iframe&gt;  &lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;[Edit 31/05/2012] Le sujet du portage d’application depuis Windows Phone vers Windows 8 (et donc indirectement du partage de code entre plates-formes) a aussi été traité de manière très détaillée par Pierre Cauchois dans sa suite d’articles &lt;a href="http://blogs.msdn.com/b/pierreca/archive/2012/05/28/strat-233-gies-et-techniques-de-partage-de-code-c-et-xaml-entre-windows-phone-et-windows-8-consumer-preview-partie-1-introduction-les-diff-233-rences-entre-les-plateformes-224-avoir-en-t-234-te.aspx"&gt;Stratégies et techniques de partage de code C# et XAML entre Windows Phone et Windows 8&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;La Portable Class Library&lt;/h1&gt;  &lt;p&gt;La Portable Class Library existe déjà pour Visual Studio 2010 sous forme &lt;a href="http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981/"&gt;d’extension&lt;/a&gt;. &lt;a href="http://www.microsoft.com/visualstudio/11/fr-fr/downloads#vs"&gt;Visual Studio 11 Ultimate&lt;/a&gt; intègre directement une version de la Portable Library supportant les applications Windows 8 Metro.&lt;/p&gt;  &lt;p&gt;Pour l’utiliser, il faut créer un nouveau projet de type « Portable Class Library ». &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image8.png"&gt;&lt;img title="image_thumb4" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb4" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7206.image_5F00_thumb4_5F00_18c2bac5_2D00_4eaa_2D00_40a5_2D00_8b45_2D00_751cee4e5239.png" width="675" height="414" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Dans les propriétés du projet, vous pourrez choisir les plateformes sur lesquelles votre application doit pouvoir tourner.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image13.png"&gt;&lt;img title="image_thumb71" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb71" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2502.image_5F00_thumb71_5F00_82a671ce_2D00_47f6_2D00_4d3a_2D00_b97f_2D00_db2f697a5b48.png" width="652" height="174" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image18[1].png"&gt;&lt;img title="image_thumb10" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb10" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3162.image_5F00_thumb10_5F00_cb93825c_2D00_efc2_2D00_4072_2D00_8e7e_2D00_8ca55bdb5716.png" width="349" height="330" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;En fonction des plateformes et des versions de plateformes sélectionnées, Visual Studio vous donnera accès aux librairies de base qui leur sont communes. Ainsi, plus vous sélectionnez de plate-formes, plus ce sous-ensemble sera restreint.&lt;/p&gt;  &lt;p&gt;Voici un tableau qui détaille les fonctionnalités disponibles dans la Portable Library, sur les différentes plateformes :&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5722.image_5F00_6.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0044.image_5F00_thumb_5F00_2.png" width="1010" height="463" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;h1&gt;Que peut-on mettre en commun dans un projet ?&lt;/h1&gt;  &lt;p&gt;Classiquement, on va retrouver &lt;/p&gt;  &lt;ul&gt;   &lt;ul&gt;     &lt;li&gt;Les mêmes données &lt;/li&gt;   &lt;/ul&gt;    &lt;ul&gt;     &lt;li&gt;L’accès aux mêmes services côté serveur &lt;/li&gt;   &lt;/ul&gt;    &lt;ul&gt;     &lt;li&gt;Le même métier &lt;/li&gt;      &lt;li&gt;Certains cas d’utilisation identiques &lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;Les pages, le layout ainsi que cetains cas d’utilisation seront différents car les dimensions et l’usage de chaque device diffère :&lt;/p&gt;  &lt;ul&gt;   &lt;ul&gt;     &lt;li&gt;Usage du touch contre clavier/souris &lt;/li&gt;   &lt;/ul&gt;    &lt;ul&gt;     &lt;li&gt;Grand écran/petit écran &lt;/li&gt;   &lt;/ul&gt;    &lt;ul&gt;     &lt;li&gt;Device nomade/fixe &lt;/li&gt;   &lt;/ul&gt;    &lt;ul&gt;     &lt;li&gt;… &lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;L’idéal serait de partir vers une structure de ce type avec les couches communes en bleu :&lt;/p&gt;  &lt;p&gt;   &lt;table cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td width="39"&gt;           &lt;blockquote&gt;             &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image131.png"&gt;&lt;img title="image_thumb7" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb7" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7444.image_5F00_thumb7_5F00_eda043dd_2D00_3e01_2D00_499d_2D00_a52a_2D00_f2b5f7344572.png" width="354" height="251" /&gt;&lt;/a&gt; &lt;/p&gt;           &lt;/blockquote&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;&lt;/td&gt;          &lt;td&gt;&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p&gt;En terme de structure de projets dans Visual Studio, on procéderait de la manière suivante avec un projet par plate-forme et un projet commun de type Portable Library:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/clip_image0123.jpg"&gt;&lt;img title="clip_image012_thumb" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="clip_image012_thumb" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6303.clip_5F00_image012_5F00_thumb_5F00_b27d3f7f_2D00_b90a_2D00_4df6_2D00_8dbc_2D00_dd2bbddc864b.jpg" width="228" height="115" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Et les couches relatives (DAL/Model/ViewModel) seraient associées à des répertoires sur chaque plate-forme comme sur le schéma ci-dessus :&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/clip_image0145.jpg"&gt;&lt;img title="clip_image014_thumb2" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="clip_image014_thumb2" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8030.clip_5F00_image014_5F00_thumb2_5F00_793dfc98_2D00_fff8_2D00_4af4_2D00_a3fb_2D00_693c493fa2ee.jpg" width="248" height="472" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h1&gt;Pas si vite…&lt;/h1&gt;  &lt;p&gt;Malheureusement, la couche d’accès aux données (DAL) contient souvent du code spécifique à la plate-forme. Par-exemple, l’accès à un service OData nécessite un client WCF Data Service différent sur WP7, sur Silverlight et sur Win8 (où il n’existe pas encore), bien que le service soit le même côté serveur.&lt;/p&gt;  &lt;p&gt;Dans ce cas, la DAL pourrait se retrouver dans la portable library sous la forme d’une interface, qui serait implémentée de manière différente sur chaque plate-forme:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/clip_image0163.jpg"&gt;&lt;img title="clip_image016_thumb" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="clip_image016_thumb" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6864.clip_5F00_image016_5F00_thumb_5F00_ea7aebe0_2D00_1fa6_2D00_4508_2D00_a646_2D00_0eae06b258e7.jpg" width="238" height="223" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;pre class="code"&gt;&lt;span style="background: white; color: blue"&gt;namespace &lt;/span&gt;&lt;span style="background: white; color: black"&gt;MyApp.Portable.DAL
{
    &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;public interface &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IDataProvider
    &lt;/span&gt;&lt;span style="background: white; color: black"&gt;{
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;event &lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;EventHandler&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;IEnumerable&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataItem&lt;/span&gt;&lt;span style="background: white; color: black"&gt;&amp;gt;&amp;gt; DataLoaded;
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;LoadDataAsync();

        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;UpdateItem(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataItem &lt;/span&gt;&lt;span style="background: white; color: black"&gt;item);
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;AddItem(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataItem &lt;/span&gt;&lt;span style="background: white; color: black"&gt;item);
        &lt;/span&gt;&lt;span style="background: white; color: blue"&gt;void &lt;/span&gt;&lt;span style="background: white; color: black"&gt;RemoveItem(&lt;/span&gt;&lt;span style="background: white; color: #2b91af"&gt;DataItem &lt;/span&gt;&lt;span style="background: white; color: black"&gt;item);
    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Comme on peut le voir dans le tableau plus haut, MEF est disponible pour certaines plate-formes dans la Portable Lib et peut donc nous aider à faire une gestion propre des règles d’implémentation.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Autre problématique: à ce jour les projets Windows Phone sont développés avec Visual Studio 2010 et il faudra donc 2 solutions : l’une sur VS2010 avec le projet Windows Phone, l’autre sur VS11 avec le projet Win8 Metro et Silverlight. La librairie commune – créée dans VS11 pour choisir la plate-forme Win8 - se retrouvera dans les 2 solutions. &lt;/p&gt;

&lt;p&gt;Il est néanmoins possible d’utiliser la Portable Class Library dès aujourd’hui, ce qui peut être intéressant si vous souhaitez conserver une structure commune et surtout pouvoir assurer une maintenance homogène de votre application sur les différentes plate-formes.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h1&gt;Démonstration&lt;/h1&gt;

&lt;p&gt;Je vais partir sur une application toute simple qui récupère des données depuis un service OData et les affiche à l’écran. Le but est de montrer comment réutiliser du code dans ce contexte et il faut extrapoler ce principe pour une application plus conséquente, sinon cela n’a pas vraiment d’intérêt car très peu de code sera finalement partagé dans mon exemple.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Pré-requis &lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://windows.microsoft.com/fr-FR/windows-8/download"&gt;Windows 8 Consumer Preview&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://www.microsoft.com/downloads/fr-fr/details.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5"&gt;Visual Studio 2010 avec le SP1&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;amp;id=27570"&gt;Le SDK Windows Phone 7.1&lt;/a&gt; puis &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=29233"&gt;l’update 7.1.&lt;/a&gt;1 (corrige le souci de l’émulateur WP7 quand installé à côté de VS11) &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981/"&gt;L’extension « Portable Library » pour VS 2010&lt;/a&gt; &lt;/li&gt;

  &lt;li&gt;&lt;a href="http://www.microsoft.com/visualstudio/11/fr-fr/downloads#vs"&gt;Visual Studio 11 beta&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;Présentation de l’application&lt;/h2&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;L’application démo va présenter une liste de vins avec leurs photos. Je récupère ces données depuis un service OData qui se trouve à cette adresse : &lt;a href="http://caveavins.cloudapp.net/CaveAVinsDataService.svc/Wines"&gt;http://caveavins.cloudapp.net/CaveAVinsDataService.svc/Wines&lt;/a&gt; et je les affiche à l’écran. &lt;/p&gt;

&lt;p&gt;Pour la démo je mettrai en oeuvre l’application sur 3 plate-formes:&lt;/p&gt;

&lt;h3&gt;- Windows 8&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3678.image_5F00_2.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8306.image_5F00_thumb.png" width="532" height="301" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;- Windows Phone&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7801.image_5F00_4.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6327.image_5F00_thumb_5F00_1.png" width="266" height="500" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;- Silverlight 5 avec Pivot viewer&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image[11].png"&gt;&lt;img title="image_thumb[6]" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb[6]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0640.image_5F00_thumb_5B00_6_5D005F00_3fe19015_2D00_25a4_2D00_43cc_2D00_9f79_2D00_f0423b14549e.png" width="562" height="302" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="file:///C:/Users/stephe/AppData/Local/Temp/WindowsLiveWriter1837769809/supfiles401B2/image[12].png"&gt;&lt;img title="image_thumb[7]" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image_thumb[7]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0647.image_5F00_thumb_5B00_7_5D005F00_5d6a44fe_2D00_6e19_2D00_426f_2D00_942f_2D00_3405df84d137.png" width="567" height="305" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Je vais donc créer 2 solutions : l’une sous Visual Studio 11 beta qui contiendra 3 projets:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;- La portable lib&lt;/p&gt;

  &lt;p&gt;- L’application Windows 8 Metro&lt;/p&gt;

  &lt;p&gt;- L’application Silverlight 5&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;L’autre sous Visual Studio 2010 qui contiendra 2 projets:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;- La portable lib&lt;/p&gt;

  &lt;p&gt;- L’application Windows Phone&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Voici le code source complet des applications:&lt;/p&gt;
&lt;iframe height="128" src="https://skydrive.live.com/embed?cid=63046D1C0F2DEB83&amp;amp;resid=63046D1C0F2DEB83%211516&amp;amp;authkey=APVmEuhb3kPTnpQ" frameborder="0" width="165" scrolling="no"&gt;&lt;/iframe&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;La suite : &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/05/07/partager-du-code-entre-plate-formes-l-application-windows-8-metro-2-4.aspx"&gt;Partager du code entre plate-formes : l’application Windows 8 Metro (2/4)&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10301821" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/MVVM/">MVVM</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WP7/">WP7</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/OData/">OData</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Portable+Library/">Portable Library</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sources/">Sources</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Visual+Studio/">Visual Studio</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/CaveAVins/">CaveAVins</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Projet/">Projet</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone/">Windows Phone</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Mango/">Mango</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-5/">Windows Phone 7.5</category></item><item><title>E-camp : Proposez une authentification fédérée (FB, Google, LiveId,...) avec ACS dans votre application Windows Phone</title><link>http://blogs.msdn.com/b/stephe/archive/2012/02/21/e-camp-proposez-une-authentification-f-233-d-233-r-233-e-fb-google-liveid-avec-acs-dans-votre-application-windows-phone.aspx</link><pubDate>Tue, 21 Feb 2012 19:58:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10270678</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10270678</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/02/21/e-camp-proposez-une-authentification-f-233-d-233-r-233-e-fb-google-liveid-avec-acs-dans-votre-application-windows-phone.aspx#comments</comments><description>&lt;p&gt;Un petit mot pour vous inviter à un &lt;a href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032504965&amp;amp;culture=fr-FR"&gt;E-camp&lt;/a&gt;&lt;span id="lblEventTitle"&gt; (un live meeting) que j’animerai vendredi 24 février à 13h30. &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;Je vous ferai une présentation dirigée d'un sample Windows Phone 7 qui utilise une authentification par Access Control Service. &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;Votre application proposera ainsi une connexion FB, Live, Google, … et les utilisateurs se connecteront avec un de leurs comptes existants parmi ces fournisseurs d’identité.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;Les avantages sont multiples:&lt;/span&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;span&gt;- Vous n’aurez pas à développer votre propre gestion de comptes et de profils&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;- L’utilisateur n’aura pas besoin de créer un nouveau compte spécifique à votre application&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;- Vous choisissez quels providers utiliser par simple configuration, sans modifier votre code&lt;/span&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;span&gt;Nous installerons le package NuGet permettant d’utiliser ACS sur Windows Phone, puis nous mettrons en place les différents éléments pour passer le jeton d’authentification à un web service.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;En espérant vous voir vendredi&amp;#160; !!!&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032504965&amp;amp;culture=fr-FR"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="ae4dfa93-de07-4e91-ba0c-f94896c7dddf" border="0" alt="ae4dfa93-de07-4e91-ba0c-f94896c7dddf" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2364.ae4dfa93_2D00_de07_2D00_4e91_2D00_ba0c_2D00_f94896c7dddf_5F00_49EC0929.jpg" width="686" height="172" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10270678" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Ev_26002300_233_3B00_nements/">Ev&amp;#233;nements</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-1/">Windows Phone 7.1</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone/">Windows Phone</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-5/">Windows Phone 7.5</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/ACS/">ACS</category></item><item><title>TechDays 2012 : les slides et vidéos du parcours “De A à Z” sont en ligne !</title><link>http://blogs.msdn.com/b/stephe/archive/2012/02/08/techdays-2012-les-slides-du-parcours-de-a-224-z-sont-en-ligne.aspx</link><pubDate>Wed, 08 Feb 2012 16:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10265470</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10265470</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/02/08/techdays-2012-les-slides-du-parcours-de-a-224-z-sont-en-ligne.aspx#comments</comments><description>&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;font color="#9e7c7c"&gt;[Edit du 15/03/2012: Ajout des vidéos]&lt;/font&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Après une journée J1 marathon mais passionnante, voici un début de contenu du &lt;a href="http://blogs.msdn.com/b/stephe/archive/2012/01/08/techdays-2012-en-1-journ-233-e-d-233-couvrez-de-a-224-z-comment-d-233-velopper-une-solution-applicative.aspx"&gt;parcours “De A à Z : concevoir une solution applicative”&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Merci à tous ceux qui ont suivi les sessions que j’ai animées avec grand plaisir avec des co-speakers de choc !&lt;/p&gt;  &lt;p&gt;Désolée pour ceux qui n’ont pas eu de place. Pour vous consoler, vous trouverez les vidéos et les slides des sessions ici, sur le &lt;a href="http://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#DomID=b977a229-a559-42e4-a813-cc076e2c4e62"&gt;site des techdays 2012&lt;/a&gt; et sur le showcase Microsoft.&lt;/p&gt;  &lt;h1&gt;De A à Z : Choisir une architecture pour sa solution applicative (ARC201)&lt;/h1&gt;  &lt;div style="width: 413px; height: 230px"&gt;&lt;object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="413" height="230" &gt;&lt;param name="source" value="http://www.microsoft.com/showcase/silverlight/player/1/player-fr.xap" /&gt;&lt;param name="initParams" value="Culture=fr-FR,Uuid=465dd208-6997-4e2c-9f8d-fe2bdac817f7,Autoplay=False,ShowMarketingOverlay=false,MiscControls=FullScreen;Detached,ShowMenu=True,Tabs=Embed;Email;Share;Info,VideoUrl=http://microsoft.com/showcase/fr/fr/details/465dd208-6997-4e2c-9f8d-fe2bdac817f7,Mode=Player" /&gt;&lt;param name="enableHtmlAccess" value="true" /&gt;&lt;param name="allowHtmlPopupwindow" value="true" /&gt;&lt;param name="background" value="#FF000000" /&gt;&lt;param name="minRuntimeVersion" value="4.0.50401.0" /&gt;&lt;param name="autoUpgrade" value="true" /&gt;&lt;/object&gt;&lt;/div&gt;  &lt;p&gt;&lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; padding-right: 0px; padding-top: 0px" title="Preview" height="327" marginheight="0" src="https://r.office.microsoft.com/r/rlidPowerPointEmbed?p1=1&amp;amp;p2=1&amp;amp;p3=SD63046D1C0F2DEB83!1096&amp;amp;p4=&amp;amp;ak=!ADybIBZtT34-yrE&amp;amp;kip=1&amp;amp;authkey=!ADybIBZtT34-yrE" frameborder="0" width="402" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;  &lt;h1&gt;De A à Z: Accès aux données avec Entity Framework 4.2 et publication en OData (LAN204)&lt;/h1&gt;  &lt;div style="width: 413px; height: 230px"&gt;&lt;object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="413" height="230" &gt;&lt;param name="source" value="http://www.microsoft.com/showcase/silverlight/player/1/player-fr.xap" /&gt;&lt;param name="initParams" value="Culture=fr-FR,Uuid=a8a355b9-a46c-41ab-9b7f-f14fce463c7d,Autoplay=False,ShowMarketingOverlay=false,MiscControls=FullScreen;Detached,ShowMenu=True,Tabs=Embed;Email;Share;Info,VideoUrl=http://microsoft.com/showcase/fr/fr/details/a8a355b9-a46c-41ab-9b7f-f14fce463c7d,Mode=Player" /&gt;&lt;param name="enableHtmlAccess" value="true" /&gt;&lt;param name="allowHtmlPopupwindow" value="true" /&gt;&lt;param name="background" value="#FF000000" /&gt;&lt;param name="minRuntimeVersion" value="4.0.50401.0" /&gt;&lt;param name="autoUpgrade" value="true" /&gt;&lt;/object&gt;&lt;/div&gt;  &lt;p&gt;&lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; padding-right: 0px; padding-top: 0px" title="Preview" height="327" marginheight="0" src="https://r.office.microsoft.com/r/rlidPowerPointEmbed?p1=1&amp;amp;p2=1&amp;amp;p3=SD63046D1C0F2DEB83!1099&amp;amp;p4=&amp;amp;ak=!AHkcG14HQfJ9hMI&amp;amp;kip=1&amp;amp;authkey=!AHkcG14HQfJ9hMI" frameborder="0" width="402" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;  &lt;h1&gt;De A à Z: Pourquoi et comment utiliser Azure dans son application ? (CLO207)&lt;/h1&gt;  &lt;div style="width: 413px; height: 230px"&gt;&lt;object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="413" height="230" &gt;&lt;param name="source" value="http://www.microsoft.com/showcase/silverlight/player/1/player-fr.xap" /&gt;&lt;param name="initParams" value="Culture=fr-FR,Uuid=402327b7-2bda-405b-8022-34478f195ddb,Autoplay=False,ShowMarketingOverlay=false,MiscControls=FullScreen;Detached,ShowMenu=True,Tabs=Embed;Email;Share;Info,VideoUrl=http://microsoft.com/showcase/fr/fr/details/402327b7-2bda-405b-8022-34478f195ddb,Mode=Player" /&gt;&lt;param name="enableHtmlAccess" value="true" /&gt;&lt;param name="allowHtmlPopupwindow" value="true" /&gt;&lt;param name="background" value="#FF000000" /&gt;&lt;param name="minRuntimeVersion" value="4.0.50401.0" /&gt;&lt;param name="autoUpgrade" value="true" /&gt;&lt;/object&gt;&lt;/div&gt;  &lt;p&gt;&lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; padding-right: 0px; padding-top: 0px" title="Preview" height="327" marginheight="0" src="https://r.office.microsoft.com/r/rlidPowerPointEmbed?p1=1&amp;amp;p2=1&amp;amp;p3=SD63046D1C0F2DEB83!1097&amp;amp;p4=&amp;amp;ak=!AFXaliFIO_7R_2U&amp;amp;kip=1&amp;amp;authkey=!AFXaliFIO_7R_2U" frameborder="0" width="402" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;  &lt;h1&gt;De A à Z: Développer une application Windows Phone 7.5 connectée à un service OData (WP7203)&lt;/h1&gt;  &lt;div style="width: 413px; height: 230px"&gt;&lt;object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="413" height="230" &gt;&lt;param name="source" value="http://www.microsoft.com/showcase/silverlight/player/1/player-fr.xap" /&gt;&lt;param name="initParams" value="Culture=fr-FR,Uuid=f8213678-2aa5-4af5-88ed-4a272284b41c,Autoplay=False,ShowMarketingOverlay=false,MiscControls=FullScreen;Detached,ShowMenu=True,Tabs=Embed;Email;Share;Info,VideoUrl=http://microsoft.com/showcase/fr/fr/details/f8213678-2aa5-4af5-88ed-4a272284b41c,Mode=Player" /&gt;&lt;param name="enableHtmlAccess" value="true" /&gt;&lt;param name="allowHtmlPopupwindow" value="true" /&gt;&lt;param name="background" value="#FF000000" /&gt;&lt;param name="minRuntimeVersion" value="4.0.50401.0" /&gt;&lt;param name="autoUpgrade" value="true" /&gt;&lt;/object&gt;&lt;/div&gt;  &lt;p&gt;&lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; padding-right: 0px; padding-top: 0px" title="Preview" height="327" marginheight="0" src="https://r.office.microsoft.com/r/rlidPowerPointEmbed?p1=1&amp;amp;p2=1&amp;amp;p3=SD63046D1C0F2DEB83!1100&amp;amp;p4=&amp;amp;ak=!AN_Cq5Gt8uizhGw&amp;amp;kip=1&amp;amp;authkey=!AN_Cq5Gt8uizhGw" frameborder="0" width="402" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;  &lt;h1&gt;De A à Z: Utiliser PivotViewer dans une application orientée données (RDA206)&lt;/h1&gt;  &lt;div style="width: 413px; height: 230px"&gt;&lt;object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="413" height="230" &gt;&lt;param name="source" value="http://www.microsoft.com/showcase/silverlight/player/1/player-fr.xap" /&gt;&lt;param name="initParams" value="Culture=fr-FR,Uuid=1ec3181f-f385-4c0c-a25a-bd8f1992d27d,Autoplay=False,ShowMarketingOverlay=false,MiscControls=FullScreen;Detached,ShowMenu=True,Tabs=Embed;Email;Share;Info,VideoUrl=http://microsoft.com/showcase/fr/fr/details/1ec3181f-f385-4c0c-a25a-bd8f1992d27d,Mode=Player" /&gt;&lt;param name="enableHtmlAccess" value="true" /&gt;&lt;param name="allowHtmlPopupwindow" value="true" /&gt;&lt;param name="background" value="#FF000000" /&gt;&lt;param name="minRuntimeVersion" value="4.0.50401.0" /&gt;&lt;param name="autoUpgrade" value="true" /&gt;&lt;/object&gt;&lt;/div&gt;  &lt;p&gt;&lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; padding-right: 0px; padding-top: 0px" title="Preview" height="327" marginheight="0" src="https://r.office.microsoft.com/r/rlidPowerPointEmbed?p1=1&amp;amp;p2=1&amp;amp;p3=SD63046D1C0F2DEB83!1098&amp;amp;p4=&amp;amp;ak=!AJfQpq4-GzzrE8k&amp;amp;kip=1&amp;amp;authkey=!AJfQpq4-GzzrE8k" frameborder="0" width="402" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt;  &lt;p&gt;A très bientôt !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10265470" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Ev_26002300_233_3B00_nements/">Ev&amp;#233;nements</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WP7/">WP7</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/OData/">OData</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/TechDays/">TechDays</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WCF+Data+Services/">WCF Data Services</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sql+Server/">Sql Server</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/PPT/">PPT</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Slides/">Slides</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/PowerPoint/">PowerPoint</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Entity/">Entity</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Visual+Studio/">Visual Studio</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/CaveAVins/">CaveAVins</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Projet/">Projet</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Code+First/">Code First</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/comment+d_E900_velopper+une+application/">comment développer une application</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/comment+d_26002300_233_3B00_velopper+une+application/">comment d&amp;#233;velopper une application</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sql+Azure/">Sql Azure</category></item><item><title>TechDays 2012 : En 1 journée, découvrez comment développer une solution applicative de A à Z</title><link>http://blogs.msdn.com/b/stephe/archive/2012/01/08/techdays-2012-en-1-journ-233-e-d-233-couvrez-de-a-224-z-comment-d-233-velopper-une-solution-applicative.aspx</link><pubDate>Sun, 08 Jan 2012 19:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10254361</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10254361</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2012/01/08/techdays-2012-en-1-journ-233-e-d-233-couvrez-de-a-224-z-comment-d-233-velopper-une-solution-applicative.aspx#comments</comments><description>&lt;p align="justify"&gt;Vous souhaitez repartir avec une vision complète du développement d’application ?    &lt;br clear="all" /&gt;Vous souhaitez comprendre quelles technologies mettre en œuvre pour un résultat moderne, sexy et interopérable ?     &lt;br clear="all" /&gt;Vous souhaitez actualiser vos compétences dans le développement ?     &lt;br clear="all" /&gt;Vous souhaitez développer une application sans partir dans le mur ?     &lt;br clear="all" /&gt;Vous souhaitez profiter des techdays pour acquérir les bons réflexes ?     &lt;br clear="all" /&gt;Vous hésitez quant aux sessions à suivre ?&lt;/p&gt;  &lt;p align="justify"&gt;&lt;strong&gt;Ce &lt;a href="http://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#DomID=b977a229-a559-42e4-a813-cc076e2c4e62"&gt;parcours&lt;/a&gt; est fait pour vous !&lt;/strong&gt;&amp;#160;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#DomID=b977a229-a559-42e4-a813-cc076e2c4e62"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5040.image_5F00_4789E06F.png" width="711" height="328" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Pendant une journée, il vous sert de guide pour comprendre comment construire une solution applicative de bout en bout.&lt;/p&gt;  &lt;p align="justify"&gt;A partir d’un cahier des charges, nous définirons l’architecture de la solution en justifiant le choix des technologies mises en œuvre . Nous aborderons ensuite chacun des aspects du développement de la solution, depuis le back-end jusqu’aux applications clientes, en passant par l’hébergement de ce petit monde.&lt;/p&gt;  &lt;p align="justify"&gt;Au sommaire, 5 sessions:&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#DomID=b977a229-a559-42e4-a813-cc076e2c4e62&amp;amp;SessionID=66174549-97b8-404e-89e8-7f9bfe6fc74e"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2061.image_5F00_64435584.png" width="444" height="92" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#DomID=b977a229-a559-42e4-a813-cc076e2c4e62&amp;amp;SessionID=117336a5-06cf-4aab-884e-b99a48451ca6"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1411.image_5F00_77840C23.png" width="444" height="84" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#DomID=b977a229-a559-42e4-a813-cc076e2c4e62&amp;amp;SessionID=133008d5-2afd-4d52-a33c-49018c6a1f2b"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6114.image_5F00_79DD8E21.png" width="443" height="80" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#DomID=b977a229-a559-42e4-a813-cc076e2c4e62&amp;amp;SessionID=33d0b44d-111e-448d-a4ec-e50397d9ea7a"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3386.image_5F00_5F88B765.png" width="440" height="83" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#DomID=b977a229-a559-42e4-a813-cc076e2c4e62&amp;amp;SessionID=a11ee9cf-ddfd-4f6c-8f4c-355bde302819"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4265.image_5F00_04A601D2.png" width="441" height="79" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Les sessions peuvent aussi être suivies de manière indépendante, le besoin métier (notre fil rouge) servant simplement de support aux démos.&lt;/p&gt;  &lt;p align="justify"&gt;Chaque session se déroulera en 2 phases et conviendra aussi bien au public débutant que confirmé&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;     &lt;div align="justify"&gt;Mise en œuvre basique de la techno pour l’application visée&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;Intervention d’un expert qui proposera des améliorations fonctionnelles, techniques, UX, optimisations, trucs et astuces et présentation d’outils et toolkits complémentaires.&lt;/div&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;p align="justify"&gt;Des spoilers sur le contenu des sessions bientôt &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-nyahnyah" alt="Nyah-Nyah" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8156.wlEmoticon_2D00_nyahnyah_5F00_5507E345.png" /&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&amp;#160;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://www.microsoft.com/france/mstechdays/programmes/parcours.aspx#DomID=b977a229-a559-42e4-a813-cc076e2c4e62"&gt;Le parcours “De A à Z : Développer une solution applicative”&lt;/a&gt; c’est le 7 février aux TechDays 2012…&lt;/p&gt;  &lt;p align="justify"&gt;Faites passer ! &lt;/p&gt; &lt;script type="text/javascript"&gt;

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10254361" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Ev_26002300_233_3B00_nements/">Ev&amp;#233;nements</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WP7/">WP7</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/TechDays/">TechDays</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/CaveAVins/">CaveAVins</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Projet/">Projet</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/comment+d_26002300_233_3B00_velopper+une+application/">comment d&amp;#233;velopper une application</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone/">Windows Phone</category></item><item><title>Utiliser ACS pour l’authentification dans une application WP7 et un WCF Data Service</title><link>http://blogs.msdn.com/b/stephe/archive/2011/12/23/utiliser-acs-pour-l-authentification-dans-une-application-wp7-et-un-wcf-data-service.aspx</link><pubDate>Fri, 23 Dec 2011 17:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10250714</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10250714</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2011/12/23/utiliser-acs-pour-l-authentification-dans-une-application-wp7-et-un-wcf-data-service.aspx#comments</comments><description>&lt;p align="justify"&gt;Le toolkit Azure pour Windows Phone simplifie grandement l’intégration d’Azure dans les applications. Depuis peu, il a été divisé en plusieurs packages NuGet permettant de cibler l’intégration d’une fonctionnalité précise (stockage, ACS, notifications Push, …)&lt;/p&gt;  &lt;p align="justify"&gt;L’un des packages permet d’intégrer les fonctionnalités d’une authentification auprès de providers d’identités existants (Facebook, Windows Live, Google,…) grâce à Access Control Services.&lt;/p&gt;  &lt;p align="justify"&gt;Dans mon application, l’utilisateur pourra s’authentifier auprès de ces providers et le jeton d’authentification sera réinjecté dans les requêtes OData envoyées à mon WCF Data Service. Au niveau de mon service, les données ajoutées par un utilisateur authentifié seront&amp;#160; rattachées à celui-ci et lui seul y aura accès par la suite.&lt;/p&gt;  &lt;p align="justify"&gt;Revenons à notre Toolkit Azure : notre application utilisera donc ACS et proposera une mire de connexion en fonction du provider choisi. Voici &lt;a href="http://nuget.org/packages/Phone.Identity.AccessControl.BasePage"&gt;le package NuGet&lt;/a&gt; à installer dans votre projet WP7.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://nuget.org/packages/Phone.Identity.AccessControl.BasePage"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image[52]" border="0" alt="image[52]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1882.image52_5F00_29F286C4.png" width="428" height="278" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Le mode d’emploi est explicite et il est donc relativement aisé d’intégrer une authentification OAuth 2.0 dans une application WP7. &lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image[31]" border="0" alt="image[31]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5684.image31_5F00_5FA7CC1E.png" width="430" height="324" /&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Par contre, la procédure ne détaille pas comment mettre en place le service web pour lequel pour utilisera précisément cette authentification, en réinjectant le jeton dans la requête http OData.&lt;/p&gt;  &lt;p align="justify"&gt;En fait, la solution est un mix entre &lt;a href="http://msdn.microsoft.com/en-us/gg192969"&gt;le tutoriel créé pour l’ancien toolkit&lt;/a&gt; et le mode d’emploi installé avec le package NuGet.&lt;/p&gt;  &lt;p align="justify"&gt;Voici comment faire, en quelques étapes…&lt;/p&gt;  &lt;h1&gt;&amp;#160;&lt;/h1&gt;  &lt;h1&gt;Le but&lt;/h1&gt;  &lt;p&gt;Notre application WP7 manipule des données fournies par un service OData. Mais seul un utilisateur authentifié sera autorisé récupérer ces données, et seules les données le concernant lui seront renvoyées.&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image[47]" border="0" alt="image[47]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0508.image47_5F00_3E363566.png" width="629" height="481" /&gt;&lt;/p&gt;  &lt;h1&gt;&amp;#160;&lt;/h1&gt;  &lt;h1&gt;Dans l’application Windows Phone&lt;/h1&gt;  &lt;h2&gt;&amp;#160;&lt;/h2&gt;  &lt;h2&gt;Ajouter le package NuGet package au projet&lt;/h2&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image[3]" border="0" alt="image[3]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0412.image3_5F00_5F85B535.png" width="751" height="210" /&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Ce package mettra en place tout ce qu’il faut dans votre projet pour qu’il puisse utiliser ACS et stocker le jeton qui sera réinjecté dans les requêtes OData, par la suite.&lt;/p&gt;  &lt;p align="justify"&gt;Le mode d’emploi ([Your WP7 Project]/App_Readme/Phone.Identity.Controls.BasePage.Readme.htm) s’affiche dès l’installation du package NuGet. Il suffit de suivre les étapes pour le faire fonctionner.&lt;/p&gt;  &lt;p align="justify"&gt;Vous aurez néanmoins besoin d’un ACS, que vous pouvez configurer en suivant les étapes mentionnées &lt;a href="http://msdn.microsoft.com/en-us/gg192969"&gt;ici&lt;/a&gt; dans la Task 2. &lt;/p&gt;  &lt;h2&gt;&amp;#160;&lt;/h2&gt;  &lt;h2&gt;Ajouter Web Browser Capability dans le manifest de l’application&lt;/h2&gt;  &lt;p&gt;La page de login s’affiche dans un web browser control, il faut donc le déclarer au niveau du manifest : &lt;font face="Consolas"&gt;&lt;strong&gt;WMAppManifest.xml&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;pre class="code"&gt;      &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Capability &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;ID_CAP_WEBBROWSERCOMPONENT&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;La navigation&lt;/h2&gt;

&lt;p align="justify"&gt;Ajoutez la page de login en tant que page de démarrage de votre application, comme indiqué dans le mode d’emploi.&lt;/p&gt;

&lt;p align="justify"&gt;Lorsque vous démarrez l’application, si votre jeton est encore valide vous naviguerez directement à la page d’accueil de votre application. Dans ce cas, il faut prévoir de sortir de l’application sur le bouton Back. Une manière de réaliser cette opération est de vider l’historique de navigation lorsque l’on arrive sur la page d’accueil.&lt;/p&gt;

&lt;p&gt;&lt;font face="Courier New"&gt;&lt;span style="color: blue"&gt;protected override void &lt;/span&gt;OnNavigatedTo(System.Windows.Navigation.&lt;span style="color: #2b91af"&gt;NavigationEventArgs &lt;/span&gt;e) 

    &lt;br /&gt;{ 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;base&lt;/span&gt;.OnNavigatedTo(e); 

    &lt;br /&gt;

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;while&lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;.NavigationService.BackStack.Any()) 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; { 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; NavigationService.RemoveBackEntry(); 

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } 

    &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;On essaye !&lt;/h2&gt;

&lt;p align="justify"&gt;A ce niveau, vous devriez être capable de vous logger en vous identifiant auprès d’un de vos providers préférés, par-exemple avec un Live Id:&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image[8]" border="0" alt="image[8]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3632.image8_5F00_691DFD9E.png" width="133" height="250" /&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image[12]" border="0" alt="image[12]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1172.image12_5F00_3260A29A.png" width="134" height="252" /&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image[17]" border="0" alt="image[17]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7776.image17_5F00_7798F9C3.png" width="134" height="252" /&gt;&lt;/p&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;Où est passé le jeton d’authentification ?&lt;/h2&gt;

&lt;p&gt;Une fois que l’authentification a réussi, le jeton est stocké comme un &lt;span style="color: #2b91af"&gt;&lt;font face="Consolas"&gt;SimpleWebTokenStore&lt;/font&gt;&lt;/span&gt; dans &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;Application&lt;/span&gt;.Current.Resources[&lt;span style="color: #a31515"&gt;&amp;quot;swtStore&amp;quot;&lt;/span&gt;]&lt;/pre&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;Comment je l’utilise dans mes requêtes OData ?&lt;/h2&gt;

&lt;p&gt;Le jeton doit être placé dans l’en-tête de la requête Http. Il faut s’abonner à l’évènement &lt;strong&gt;SendingRequest&lt;/strong&gt; de votre contexte WCF Data Service et y mettre à jour l’en-tête en ajoutant l’”authorization”.&lt;/p&gt;

&lt;pre class="code"&gt;_dc = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;YourDataServiceContext&lt;/span&gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;http://YourDataService.svc/&amp;quot;&lt;/span&gt;));
        
_dc.SendingRequest += &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;EventHandler&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;SendingRequestEventArgs&lt;/span&gt;&amp;gt;(SendingRequest);
 

&lt;span style="color: blue"&gt;void &lt;/span&gt;SendingRequest(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;SendingRequestEventArgs &lt;/span&gt;e)
{
   &lt;span style="color: blue"&gt;var &lt;/span&gt;simpleWebTokenStore = &lt;span style="color: #2b91af"&gt;Application&lt;/span&gt;.Current.Resources[&lt;span style="color: #a31515"&gt;&amp;quot;swtStore&amp;quot;&lt;/span&gt;] &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SimpleWebTokenStore&lt;/span&gt;;
   &lt;span style="color: blue"&gt;if &lt;/span&gt;(simpleWebTokenStore != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
   {
      e.RequestHeaders[&lt;span style="color: #a31515"&gt;&amp;quot;Authorization&amp;quot;&lt;/span&gt;] = &lt;span style="color: #a31515"&gt;&amp;quot;OAuth &amp;quot; &lt;/span&gt;+ simpleWebTokenStore.SimpleWebToken.RawToken;
   }
}&lt;/pre&gt;

&lt;p align="justify"&gt;&lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-lightbulb" alt="Ampoule" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8473.wlEmoticon_2D00_lightbulb_5F00_1DB0C103.png" /&gt;Attention, l’accès aux Resources ne peut se faire en dehors du thread de l’UI. Si c’est votre cas, il faut stocker le jeton ailleurs pour l’utiliser sans problème depuis l’événement SendingRequest.&lt;/p&gt;

&lt;h1&gt;&amp;#160;&lt;/h1&gt;

&lt;h1&gt;Dans votre WCF Data Service&lt;/h1&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;Comment je récupère le jeton depuis mon service ?&lt;/h2&gt;

&lt;p align="justify"&gt;Si votre service n’est pas configuré pour fonctionner avec OAuth 2.0, suivez l’étape &lt;strong&gt;Task 3 – Securing an OData Service with OAuth2 and Windows Identity Foundation&lt;/strong&gt; du &lt;a href="http://msdn.microsoft.com/en-us/gg192969"&gt;&lt;u&gt;tutoriel&lt;/u&gt;&lt;/a&gt; mentionné précédemment.&lt;/p&gt;

&lt;p align="justify"&gt;Votre service utilisera une librairie développée par Microsoft DPE, qui étend le mécanisme de WIF pour supporter OAuth 2.0.&lt;/p&gt;

&lt;p&gt;A ce niveau, vous devriez avoir:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ajouté une référence à &lt;strong&gt;DPE.OAuth2.dll &lt;/strong&gt;(il faut télécharger le lab pour l’obtenir) &lt;/li&gt;

  &lt;li&gt;ajouté une référence à &lt;strong&gt;Microsoft.Identity.Model.dll&lt;/strong&gt; &lt;/li&gt;

  &lt;li&gt;ajouté les différentes entrées au web.config &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;Contrôle de l’identité&lt;/h2&gt;

&lt;p&gt;L’identité de l’appelant (que l’on récupère depuis le header) va nous servir dans l’application des règles métier de notre service. &lt;/p&gt;

&lt;pre class="code"&gt;[System.ServiceModel.&lt;span style="color: #2b91af"&gt;ServiceBehavior&lt;/span&gt;(IncludeExceptionDetailInFaults = &lt;span style="color: blue"&gt;true&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;YourDataService &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;DataService&lt;/span&gt;&amp;lt;[YourContext]&amp;gt;
{
    &lt;span style="color: green"&gt;// This method is called only once to initialize service-wide policies.
    &lt;/span&gt;&lt;span style="color: blue"&gt;public static void &lt;/span&gt;InitializeService(&lt;span style="color: #2b91af"&gt;DataServiceConfiguration &lt;/span&gt;config)
    {
        config.SetEntitySetAccessRule(&lt;span style="color: #a31515"&gt;&amp;quot;[YourEntity]&amp;quot;&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;EntitySetRights&lt;/span&gt;.All);
        config.DataServiceBehavior.MaxProtocolVersion = &lt;span style="color: #2b91af"&gt;DataServiceProtocolVersion&lt;/span&gt;.V3;
    }

    &lt;span style="color: blue"&gt;string &lt;/span&gt;GetUserIdentity()
    {
        &lt;span style="color: blue"&gt;string &lt;/span&gt;userIdName = &lt;span style="color: blue"&gt;null&lt;/span&gt;;
        &lt;span style="color: blue"&gt;var &lt;/span&gt;claim = &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.User.Identity &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IClaimsIdentity&lt;/span&gt;;
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.Request.IsAuthenticated)
        {
            userIdName = &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.User.Identity.Name;
        }
        &lt;span style="color: blue"&gt;return &lt;/span&gt;userIdName;
    }&lt;/pre&gt;

&lt;p align="justify"&gt;Vous pouvez utiliser des QueryInterceptor et/ou ChangeInterceptor pour intercepter les requêtes, et ainsi modifier leur comportement par défaut suivant l’identité de l’appelant. Dans mon cas, je stocke l’identifiant de l’appelant dans chaque enregistrement qu’il ajoute dans la base. &lt;/p&gt;

&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;ChangeInterceptor&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;[YourEntity]&amp;quot;&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public void &lt;/span&gt;OnChange(&lt;span style="color: #2b91af"&gt;[YourEntityType] &lt;/span&gt;updatedRecord, &lt;span style="color: #2b91af"&gt;UpdateOperations &lt;/span&gt;operations)
{
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(operations == &lt;span style="color: #2b91af"&gt;UpdateOperations&lt;/span&gt;.Add)
    {
        &lt;span style="color: blue"&gt;var &lt;/span&gt;userIdName = GetUserIdentity();
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(userIdName == &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        {
            &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataServiceException&lt;/span&gt;(401, &lt;span style="color: #a31515"&gt;&amp;quot;Permission Denied you must be an authenticated user&amp;quot;&lt;/span&gt;);
        }
        updatedRecord.UserId = userIdName;
    }
}&lt;/pre&gt;

&lt;p&gt;Les requêtes de sélection ne revoient que les enregistrements associés à l’identité de l’appelant. Seul le créateur des enregistrements pourra y accéder.&lt;/p&gt;

&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;QueryInterceptor&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;[YourEntity]&amp;quot;&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;[YourEntityType]&lt;/span&gt;, &lt;span style="color: blue"&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; OnQuery()
{
    &lt;span style="color: blue"&gt;var &lt;/span&gt;userIdName = GetUserIdentity();
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(userIdName == &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataServiceException&lt;/span&gt;(401, &lt;span style="color: #a31515"&gt;&amp;quot;Permission Denied you must be an authenticated user&amp;quot;&lt;/span&gt;);
    }
    &lt;span style="color: blue"&gt;return &lt;/span&gt;(b =&amp;gt; b.UserId == userIdName);
}&lt;/pre&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h1&gt;&amp;#160;&lt;/h1&gt;

&lt;h1&gt;C’est parti…&lt;/h1&gt;

&lt;p align="justify"&gt;Placez un point d’arrêt dans le ChangeInterceptor ou le QueryInterceptor pour vérifier si tout ce petit monde fonctionne et si votre identité est récupérée correctement côté serveur dans votre service. Si ce n’est pas le cas, essayez d’utiliser IIS plutôt que le Visual Studio Development Server (merci à &lt;a href="http://blogs.msdn.com/b/benjguin/"&gt;&lt;u&gt;Benjamin Guinebertière&lt;/u&gt;&lt;/a&gt; pour l’astuce !)&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image[36]" border="0" alt="image[36]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6886.image36_5F00_159707B8.png" width="718" height="415" /&gt;&lt;/p&gt;

&lt;h1&gt;&amp;#160;&lt;/h1&gt;

&lt;h1&gt;On récapitule&lt;/h1&gt;

&lt;p align="justify"&gt;Chaque requête OData effectuée depuis notre application Windows Phone inclut un jeton d’authentification, renseigné par le provider d’identité. Cette opération se fait par l’intermédiaire d’ACS. Cette identité peut être utilisée dans des règles métier au niveau du WCF Data Service. Ces règles seront appliquées quel que soit le client duquel provient la requête. Il est ainsi possible de contrôler l’accès et l’édition des données effectués depuis un client aussi simpliste qu’un navigateur web. Sans jeton d’authentification, les requêtes déclencheront un erreur de sécurité (pour ceux qui ne suivent pas : c’est parce que l’on a codé en déclenchant explicitement une exception dans le service). &lt;/p&gt;

&lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image[41]" border="0" alt="image[41]" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6215.image41_5F00_4A07B433.png" width="632" height="170" /&gt;&lt;/p&gt;

&lt;p align="justify"&gt;Vous pourrez manipuler les données publiées en OData depuis votre application WP7 mais également depuis toute application tournant sur &lt;strong&gt;n’importe quelle plateforme&lt;/strong&gt; supportant une authentification OAuth 2.0. &lt;/p&gt;

&lt;p&gt;Elle est pas belle la vie ? &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-partysmile" alt="C&amp;#39;est la fête" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3162.wlEmoticon_2D00_partysmile_5F00_0D8F3F89.png" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;span id="preserve45134c78297b454e819b8b37c1096cf5" class="wlWriterPreserve"&gt;&lt;script type="text/javascript"&gt;

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();&lt;/script&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10250714" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/OData/">OData</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WCF+Data+Services/">WCF Data Services</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Claims/">Claims</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-5/">Windows Phone 7.5</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/ACS/">ACS</category></item><item><title>Using ACS to provide authentication for a WP7 application and a WCF Data Service</title><link>http://blogs.msdn.com/b/stephe/archive/2011/12/23/a-wp7-application-reinjecting-an-oauth-2-0-token-from-acs-in-an-odata-request.aspx</link><pubDate>Fri, 23 Dec 2011 15:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10250694</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10250694</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2011/12/23/a-wp7-application-reinjecting-an-oauth-2-0-token-from-acs-in-an-odata-request.aspx#comments</comments><description>&lt;p align="justify"&gt;The Windows Azure Toolkit for Windows Phone is helping a lot to integrate all kind of Azure features in the device. Recently, Azure Toolkit for Windows Phone has been split in separate parts (storage, ACS, Push notification, …), so that each can be used separately in a project (via NuGet), which is a VERY good thing.&lt;/p&gt;  &lt;p align="justify"&gt;Though, it makes it easy to deal with ACS authentication and external identity providers which is what we need in our WP7 application. We want to get an authenticated user to use our app since the OData service will associate data to this user. The service will also ensure that each user will have access to his own data only.&lt;/p&gt;  &lt;p align="justify"&gt;Back to the Azure Toolkit : we are interested in the ACS part so that our WP7 application provides a log in page and an authenticated user. The NuGet package for this &lt;a href="http://nuget.org/packages/Phone.Identity.AccessControl.BasePage"&gt;is here&lt;/a&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://nuget.org/packages/Phone.Identity.AccessControl.BasePage"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5355.image_5F00_0FB0EAF5.png" width="522" height="339" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;The How To is very explicit, though, it is very easy to handle an OAuth 2 authentication in a windows phone app. &lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6825.image_5F00_1635B8B8.png" width="480" height="361" /&gt;&lt;/p&gt;  &lt;p align="justify"&gt;But the procedure doesn’t explain how to set up your remote service so that it can handle the token you just received, and also doesn’t detail how to send it to the server. Actually the answer is a mix of &lt;a href="http://msdn.microsoft.com/en-us/gg192969"&gt;the tutorial dedicated to the inital toolkit&lt;/a&gt;, and the new “How To” procedure.&lt;u&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Here is how to do it in a few steps…&lt;/p&gt;  &lt;h1&gt;&amp;#160;&lt;/h1&gt;  &lt;h1&gt;Where we will go&lt;/h1&gt;  &lt;p align="justify"&gt;Our WP7 application needs to access data from the OData service, but only an authenticated user will be allowed to. We also want to filter resulting information according to the user identity. &lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0640.image_5F00_11FBBB26.png" width="592" height="452" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;In your Windows Phone application&lt;/h1&gt;  &lt;h2&gt;&amp;#160;&lt;/h2&gt;  &lt;h2&gt;Add the NuGet package to your WP7 project&lt;/h2&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2287.image_5F00_2D70975C.png" width="863" height="238" /&gt;&lt;/p&gt;  &lt;p align="justify"&gt;This package will install all your project needs to use ACS and store the token that will be later reinjected in the OData Http request.&lt;/p&gt;  &lt;p align="justify"&gt;The “HowTo” ([Your WP7 Project]/App_Readme/Phone.Identity.Controls.BasePage.Readme.htm) is very explicit and you just need to follow the steps to make it work. by the way, you need to have set up an ACS like explained &lt;a href="http://msdn.microsoft.com/en-us/gg192969"&gt;here&lt;/a&gt; in Task 2.&lt;/p&gt;  &lt;h2&gt;&amp;#160;&lt;/h2&gt;  &lt;h2&gt;Add the Web Browser Capability in the application manifest&lt;/h2&gt;  &lt;p align="justify"&gt;The log in page will be provided from a web browser control, so you should make it available in the manifest file &lt;font face="Consolas"&gt;&lt;strong&gt;WMAppManifest.xml&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;pre class="code"&gt;      &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Capability &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;ID_CAP_WEBBROWSERCOMPONENT&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/&amp;gt;
&lt;/span&gt;&lt;/pre&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;Handling Navigation&lt;/h2&gt;

&lt;p align="justify"&gt;Add the log in page as the welcome page in your application, as explained in the How To. &lt;/p&gt;

&lt;p align="justify"&gt;If your token is valid when you start the app, you will skip the log in page and navigate directly to your application home page. So you will have to handle the Back button from there so that you exit the application. You can do it by clearing the navigation history when you navigate to your home page:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;protected override void &lt;/span&gt;OnNavigatedTo(System.Windows.Navigation.&lt;span style="color: #2b91af"&gt;NavigationEventArgs &lt;/span&gt;e)
{
    &lt;span style="color: blue"&gt;base&lt;/span&gt;.OnNavigatedTo(e);

    &lt;span style="color: blue"&gt;while &lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;.NavigationService.BackStack.Any())
    {
        NavigationService.RemoveBackEntry();
    }
}&lt;/pre&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;Try it !&lt;/h2&gt;

&lt;p&gt;At this point, you should be able to log into your app with any of your identity provider credentials, for example with a Live ID:&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1373.image_5F00_6C9E9B2C.png" width="166" height="314" /&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5383.image_5F00_5185CC1E.png" width="168" height="317" /&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7633.image_5F00_6B798C40.png" width="168" height="317" /&gt;&lt;/p&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;Where is my token ?&lt;/h2&gt;

&lt;p&gt;Once the log in procedure succeeds, your token is stored as a &lt;span style="color: #2b91af"&gt;&lt;font face="Consolas"&gt;SimpleWebTokenStore&lt;/font&gt;&lt;/span&gt; in &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;Application&lt;/span&gt;.Current.Resources[&lt;span style="color: #a31515"&gt;&amp;quot;swtStore&amp;quot;&lt;/span&gt;]&lt;/pre&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;How do I use the token in my OData request ?&lt;/h2&gt;

&lt;p align="justify"&gt;The token will be placed in the header of the http request.You should register to the SendingRequest event of your WCF Data Service context and update the header with the authorization.&lt;/p&gt;

&lt;pre class="code"&gt;_dc = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;YourDataServiceContext&lt;/span&gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;http://YourDataService.svc/&amp;quot;&lt;/span&gt;));
        
_dc.SendingRequest += &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;EventHandler&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;SendingRequestEventArgs&lt;/span&gt;&amp;gt;(SendingRequest);
 

&lt;span style="color: blue"&gt;void &lt;/span&gt;SendingRequest(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;SendingRequestEventArgs &lt;/span&gt;e)
{
   &lt;span style="color: blue"&gt;var &lt;/span&gt;simpleWebTokenStore = &lt;span style="color: #2b91af"&gt;Application&lt;/span&gt;.Current.Resources[&lt;span style="color: #a31515"&gt;&amp;quot;swtStore&amp;quot;&lt;/span&gt;] &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SimpleWebTokenStore&lt;/span&gt;;
   &lt;span style="color: blue"&gt;if &lt;/span&gt;(simpleWebTokenStore != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
   {
      e.RequestHeaders[&lt;span style="color: #a31515"&gt;&amp;quot;Authorization&amp;quot;&lt;/span&gt;] = &lt;span style="color: #a31515"&gt;&amp;quot;OAuth &amp;quot; &lt;/span&gt;+ simpleWebTokenStore.SimpleWebToken.RawToken;
   }
}&lt;/pre&gt;

&lt;p align="justify"&gt;&lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-lightbulb" alt="Ampoule" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4861.wlEmoticon_2D00_lightbulb_5F00_6B914844.png" /&gt;The access to the Resources is not allowed from a thread different from the IU thread, so if that may happen in your case, you should save the token in some place from a BeginInvoke so that you can reuse it safely in the SendingRequest event.&lt;/p&gt;

&lt;h1&gt;&amp;#160;&lt;/h1&gt;

&lt;h1&gt;In your WCF Data Service&lt;/h1&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;How do I get it back in my WCF Data Service ?&lt;/h2&gt;

&lt;p align="justify"&gt;If your WCF Data Service has not been setup to handle OAuth 2, you should follow the step &lt;strong&gt;Task 3 – Securing an OData Service with OAuth2 and Windows Identity Foundation&lt;/strong&gt; of the great &lt;a href="http://msdn.microsoft.com/en-us/gg192969"&gt;tutorial&lt;/a&gt; mentioned earlier.&lt;/p&gt;

&lt;p align="justify"&gt;You will use an assembly developped by Microsoft DPE guys, that extends the WIF mechanism to handle OAuth.&lt;/p&gt;

&lt;p&gt;At this point you should have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Added a reference to &lt;strong&gt;DPE.OAuth2.dll &lt;/strong&gt;(you should download the lab to get this one) &lt;/li&gt;

  &lt;li&gt;Added a reference to Microsoft.Identity.Model.dll &lt;/li&gt;

  &lt;li&gt;Added entries to the web.config &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&amp;#160;&lt;/h2&gt;

&lt;h2&gt;Checking the identity&lt;/h2&gt;

&lt;p&gt;You would probably check the identity on some actions made on your data. &lt;/p&gt;

&lt;pre class="code"&gt;[System.ServiceModel.&lt;span style="color: #2b91af"&gt;ServiceBehavior&lt;/span&gt;(IncludeExceptionDetailInFaults = &lt;span style="color: blue"&gt;true&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;YourDataService &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;DataService&lt;/span&gt;&amp;lt;[YourContext]&amp;gt;
{
    &lt;span style="color: green"&gt;// This method is called only once to initialize service-wide policies.
    &lt;/span&gt;&lt;span style="color: blue"&gt;public static void &lt;/span&gt;InitializeService(&lt;span style="color: #2b91af"&gt;DataServiceConfiguration &lt;/span&gt;config)
    {
        config.SetEntitySetAccessRule(&lt;span style="color: #a31515"&gt;&amp;quot;[YourEntity]&amp;quot;&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;EntitySetRights&lt;/span&gt;.All);
        config.DataServiceBehavior.MaxProtocolVersion = &lt;span style="color: #2b91af"&gt;DataServiceProtocolVersion&lt;/span&gt;.V3;
    }

    &lt;span style="color: blue"&gt;string &lt;/span&gt;GetUserIdentity()
    {
        &lt;span style="color: blue"&gt;string &lt;/span&gt;userIdName = &lt;span style="color: blue"&gt;null&lt;/span&gt;;
        &lt;span style="color: blue"&gt;var &lt;/span&gt;claim = &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.User.Identity &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IClaimsIdentity&lt;/span&gt;;
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.Request.IsAuthenticated)
        {
            userIdName = &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.User.Identity.Name;
        }
        &lt;span style="color: blue"&gt;return &lt;/span&gt;userIdName;
    }&lt;/pre&gt;

&lt;p align="justify"&gt;You can use interceptors (QueryInterceptor or ChangeInterceptor) to do some identity validation and relative tasks, according to your business rules. In my case, I store the user identity name in each new record. &lt;/p&gt;

&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;ChangeInterceptor&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;[YourEntity]&amp;quot;&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public void &lt;/span&gt;OnChange(&lt;span style="color: #2b91af"&gt;[YourEntityType] &lt;/span&gt;updatedRecord, &lt;span style="color: #2b91af"&gt;UpdateOperations &lt;/span&gt;operations)
{
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(operations == &lt;span style="color: #2b91af"&gt;UpdateOperations&lt;/span&gt;.Add)
    {
        &lt;span style="color: blue"&gt;var &lt;/span&gt;userIdName = GetUserIdentity();
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(userIdName == &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        {
            &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataServiceException&lt;/span&gt;(401, &lt;span style="color: #a31515"&gt;&amp;quot;Permission Denied you must be an authenticated user&amp;quot;&lt;/span&gt;);
        }
        updatedRecord.UserId = userIdName;
    }
}&lt;/pre&gt;

&lt;p&gt;On queries, I return only records that are associated to the identity of the request initiator.&lt;/p&gt;

&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;QueryInterceptor&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;[YourEntity]&amp;quot;&lt;/span&gt;)]
&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;[YourEntityType]&lt;/span&gt;, &lt;span style="color: blue"&gt;bool&lt;/span&gt;&amp;gt;&amp;gt; OnQuery()
{
    &lt;span style="color: blue"&gt;var &lt;/span&gt;userIdName = GetUserIdentity();
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(userIdName == &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataServiceException&lt;/span&gt;(401, &lt;span style="color: #a31515"&gt;&amp;quot;Permission Denied you must be an authenticated user&amp;quot;&lt;/span&gt;);
    }
    &lt;span style="color: blue"&gt;return &lt;/span&gt;(b =&amp;gt; b.UserId == userIdName);
}&lt;/pre&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h1&gt;&amp;#160;&lt;/h1&gt;

&lt;h1&gt;Let’s give it a try&lt;/h1&gt;

&lt;p align="justify"&gt;You can put a breakpoint on the ChangeInterceptor and QueryInterceptor to check if everything is going fine and if your identity is retrieved properly on the service side. If not, try to use IIS instead of Visual Studio Development Server (thanks to &lt;a href="http://blogs.msdn.com/b/benjguin/"&gt;Benjamin Guinebertière&lt;/a&gt; for that tip !)&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6457.image_5F00_292673FD.png" width="679" height="393" /&gt;&lt;/p&gt;

&lt;h1&gt;&amp;#160;&lt;/h1&gt;

&lt;h1&gt;What do I finally have ?&lt;/h1&gt;

&lt;p align="justify"&gt;Each OData request made from your WP application is now including an identity token, allowed by the identity provider through ACS. You can use this identity for business rules purpose in your service, and this will be efficient wherever the request comes from. Though, you can protect your data from being accessed and updated from a simple web browser which will return a security exception. &lt;/p&gt;

&lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0247.image_5F00_76FF23B2.png" width="742" height="196" /&gt;&lt;/p&gt;

&lt;p align="justify"&gt;You can still use these data from any application running on &lt;strong&gt;any platform&lt;/strong&gt; that is able to send an OAuth http authorization header. &lt;/p&gt;
&lt;script type="text/javascript"&gt;
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10250694" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/OData/">OData</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WCF+Data+Services/">WCF Data Services</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Claims/">Claims</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-5/">Windows Phone 7.5</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/ACS/">ACS</category></item><item><title>WP7 : Real-time video scan a barcode/QR code in your app using ZXing lib</title><link>http://blogs.msdn.com/b/stephe/archive/2011/11/07/wp7-real-time-video-scan-a-barcode-qr-code-in-your-app-using-zxing-lib.aspx</link><pubDate>Mon, 07 Nov 2011 08:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10234406</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>14</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10234406</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2011/11/07/wp7-real-time-video-scan-a-barcode-qr-code-in-your-app-using-zxing-lib.aspx#comments</comments><description>&lt;p&gt;&lt;font face="Calibri"&gt;Now that we can &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/10/18/application-caveavins-pour-wp7-1-scanner-un-code-barre.aspx"&gt;&lt;font face="Calibri"&gt;scan a barcode from a picture&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; thanks to &lt;a href="http://silverlightzxing.codeplex.com/"&gt;ZXing lib&lt;/a&gt;, let’s try to improve the user experience.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;It would be much better to scan a barcode in real time, just like WP7 does out of the box. I wanted to provide this kind of experience in my own application. You can do the same by downloading the following lib and use the code below.&lt;/font&gt;&lt;/p&gt; &lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="500" height=300"&gt;                      &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_18.xap" /&gt;                      &lt;param name="initParams" value="m=http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-video/8054.P1030036.wmv,autostart=false,autohide=true,showembed=true" /&gt;                      &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt;                          &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt;                      &lt;/a&gt;                  &lt;/object&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Usage&lt;/font&gt;&lt;/h1&gt;  &lt;h2&gt;&lt;font color="#646b86" face="Calibri"&gt;Download the lib&lt;/font&gt;&lt;/h2&gt; &lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="https://skydrive.live.com/embedicon.aspx/Articles/WP7.VideoScan/WP7.VideoScanZXing%20bin.zip?cid=63046d1c0f2deb83&amp;amp;sc=documents" frameborder="0" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;Download the binaries and add a reference to both dlls in your own project.&lt;/font&gt;&lt;/p&gt;  &lt;h2&gt;&lt;font color="#646b86" face="Calibri"&gt;Write the code&lt;/font&gt;&lt;/h2&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;Use the video scan lib by calling the static StartScan method of the BarCodeManager static class.&lt;/font&gt;&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;
/// &lt;/span&gt;&lt;span style="color: green"&gt;Starts the scan : navigates to the scan page and starts reading video stream
&lt;/span&gt;&lt;span style="color: gray"&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;Note : Scan will auto-stop if navigation occurs
&lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;
/// &amp;lt;param name=&amp;quot;onBarCodeFound&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;Delegate Action on a barcode found&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;
/// &amp;lt;param name=&amp;quot;onError&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;Delegate Action on error&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;
/// &amp;lt;param name=&amp;quot;zxingReader&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;(optional) A specific reader format, Default will be EAN13Reader &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;public static void &lt;/span&gt;StartScan(&lt;span style="color: #2b91af"&gt;Action&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; onBarCodeFound, &lt;span style="color: #2b91af"&gt;Action&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt;&amp;gt; onError, &lt;span style="color: #2b91af"&gt;BarcodeFormat &lt;/span&gt;barcodeFormat = &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;/pre&gt;

&lt;p&gt;&lt;font face="Calibri"&gt;Parameters are:&lt;/font&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;&lt;font color="#000000"&gt;-&lt;/font&gt; Action&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; onBarCodeFound : &lt;font face="Calibri"&gt;a delegate called on a background thread as soon as a barcode/QR code is detected. The parameter is the associated barcode/QR string &lt;br clear="all" /&gt;&lt;/font&gt;&lt;span style="color: #2b91af"&gt;&lt;font color="#000000"&gt;-&lt;/font&gt; Action&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt;&amp;gt; onError &lt;font face="Arial"&gt;:&lt;/font&gt;&lt;font face="Calibri"&gt; a delegate on error. The parameter is the associated exception that generated the error
&lt;/font&gt;&lt;span style="color: #2b91af"&gt;&lt;font color="#000000"&gt;-&lt;/font&gt; BarcodeFormat &lt;/span&gt;barcodeFormat = &lt;span style="color: blue"&gt;null : &lt;font color="#333333" face="Calibri"&gt;the type of code that should be scanned (default = UPC_EAN):&lt;/font&gt;
&lt;/span&gt;     ALL_1D;&lt;br /&gt;     CODE_128;&lt;br /&gt;     CODE_39;&lt;br /&gt;     DATAMATRIX;&lt;br /&gt;     EAN_13;&lt;br /&gt;     EAN_8;&lt;br /&gt;     ITF;&lt;br /&gt;     PDF417;&lt;br /&gt;     QR_CODE;&lt;br /&gt;     UPC_A;&lt;br /&gt;     UPC_E;&lt;br /&gt;&lt;span style="color: green"&gt;     // Auto detect&lt;br /&gt;&lt;/span&gt;     UPC_EAN;&lt;br /&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;font face="Calibri"&gt;Calling StartScan will launch the WP7 camera, and start the scanning process which consists in: &lt;/font&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;font face="Calibri"&gt;start focusing&lt;/font&gt;&lt;/li&gt;

  &lt;li&gt;&lt;font face="Calibri"&gt;once focused, try scanning during 1.5 sec &lt;/font&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;font face="Calibri"&gt;If unsuccessful, it will retry 15 times after what it will call the onError callback with a &lt;span style="color: #2b91af"&gt;VideoScanException &lt;/span&gt;exception as a parameter. You can update the trial count by setting &lt;span style="color: #2b91af"&gt;BarCodeManager&lt;/span&gt;.MaxTry (default is 15).&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font face="Calibri"&gt;If a code was found, the onBarCodeFound callback will be called with the string code found as a parameter.&lt;/font&gt; 

  &lt;br /&gt;&lt;/p&gt;

&lt;h1&gt;&lt;font color="#4f81bd"&gt;Example&lt;/font&gt;&lt;/h1&gt;

&lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5444.image_5F00_5973DEC7.png" width="295" height="536" /&gt;&lt;/p&gt;

&lt;h2&gt;&lt;font color="#646b86"&gt;Scan a bar code&lt;/font&gt;&lt;/h2&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;Button_Click(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e)
{
    WP7.ScanBarCode.&lt;span style="color: #2b91af"&gt;BarCodeManager&lt;/span&gt;.StartScan(
        &lt;span style="color: green"&gt;// on success
        &lt;/span&gt;(b) =&amp;gt; Dispatcher.BeginInvoke(() =&amp;gt; 
            {
                tbScanResultBarCode.Text = b;
                NavigationService.GoBack();
            }),
        &lt;span style="color: green"&gt;// on error
        &lt;/span&gt;(ex) =&amp;gt; Dispatcher.BeginInvoke(() =&amp;gt; 
            {
                tbScanResultBarCode.Text = ex.Message;
                NavigationService.GoBack();
            })
        &lt;span style="color: green"&gt;// Default : please, decode any bar-code
        &lt;/span&gt;);
                                 
}&lt;/pre&gt;

&lt;h2&gt;&lt;font color="#646b86"&gt;Scan a QR code&lt;/font&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/h2&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;Button_Click_1(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e)
{
    WP7.ScanBarCode.&lt;span style="color: #2b91af"&gt;BarCodeManager&lt;/span&gt;.StartScan(
        &lt;span style="color: green"&gt;// on success
        &lt;/span&gt;(b) =&amp;gt; Dispatcher.BeginInvoke(() =&amp;gt; 
            {
                tbScanResultQR.Text = b;
                NavigationService.GoBack();
            }),
        &lt;span style="color: green"&gt;// on error
        &lt;/span&gt;(ex) =&amp;gt; Dispatcher.BeginInvoke(() =&amp;gt; 
            {
                tbScanResultQR.Text = ex.Message;
                NavigationService.GoBack();
            }),
        &lt;span style="color: green"&gt;// Please, decode a QR Code
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;BarcodeFormat&lt;/span&gt;.QR_CODE);
}&lt;/pre&gt;

&lt;pre class="code"&gt;&amp;#160;&lt;/pre&gt;

&lt;h2&gt;&lt;font color="#4f81bd"&gt;Get the source code and test the sample application&lt;/font&gt;&lt;/h2&gt;

&lt;p&gt;&lt;font face="Calibri"&gt;You can test the sample application ang get the whole code here.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font face="Calibri"&gt;The lib uses the video capabilities of WP7.1 SDK with the &lt;span style="color: #2b91af"&gt;PhotoCamera &lt;/span&gt;class. The code is inspired from the original idea of Pierre Cauchois and includes some snippets from SLAR toolkit.&lt;/font&gt;&lt;font face="Arial"&gt; &lt;/font&gt;&lt;/p&gt;
&lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="https://skydrive.live.com/embedicon.aspx/Articles/WP7.VideoScan/WP7.VideoScanZXing%20Src.zip?cid=63046d1c0f2deb83&amp;amp;sc=documents" frameborder="0" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;

&lt;p&gt;&lt;font face="Calibri"&gt;[This is an early version made for my own purpose and was not tested for production]&lt;/font&gt;&lt;/p&gt;
&lt;script type="text/javascript"&gt;
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10234406" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WP7/">WP7</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sources/">Sources</category></item><item><title>Evènement communauté Silverlight mercredi après-midi, 26 octobre</title><link>http://blogs.msdn.com/b/stephe/archive/2011/10/24/ev-232-nement-communaut-233-silverlight-mercredi-apr-232-s-midi-26-octobre.aspx</link><pubDate>Mon, 24 Oct 2011 14:54:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10229342</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10229342</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2011/10/24/ev-232-nement-communaut-233-silverlight-mercredi-apr-232-s-midi-26-octobre.aspx#comments</comments><description>&lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;La communauté Silverlight qui s’est montée récemment sur Facebook (&lt;a href="http://on.fb.me/pVH80X"&gt;http://on.fb.me/pVH80X&lt;/a&gt;) organise son premier évènement dans nos locaux ce mercredi après-midi (le 26 octobre).&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&amp;#160;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;N’hésitez pas à venir assister aux sessions inédites :&lt;font face="Calibri"&gt;&lt;font color="#000000"&gt;&lt;font size="3"&gt;                &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&amp;#160;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;img class="img" alt="" src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/276848_255137814508829_5856375_s.jpg" /&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: &amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #333333; font-size: 12pt; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;; mso-fareast-language: fr; mso-bidi-font-size: 8.5pt"&gt;La communauté Silverlight France se lance, venez participer à sa naissance !      &lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: &amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #333333; font-size: 8.5pt; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;; mso-fareast-language: fr"&gt;     &lt;br /&gt;      &lt;br /&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;- Session “Présentation de la Communauté” (15mn)        &lt;br /&gt;&lt;/b&gt;      &lt;br /&gt;Découvrez la communauté, son site web, son mode de fonctionnement et comment contribuer à celle-ci. Vous aimez Silverlight et vous souhaitez partager ? Alors venez aider et contribuer ! Vous aimez Silverlight mais vous ne savez pas par quel bout commencer ? Venez comprendre comment apprendre auprès d’experts reconnus sur le meilleur des ressources francophones. Vous ne connaissez pas encore Silverlight ? Venez découvrir et mesurer tout le potentiel de cette technologie qui a déjà fait ses preuves aujourd’hui et qui réserve bien des surprises à l’avenir.       &lt;br /&gt;      &lt;br /&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;- Session “Silverlight 5 : Nouveautés et 3D” (1h20&lt;/b&gt;)       &lt;br /&gt;      &lt;br /&gt;Présenté par David Catuhe (Microsoft France), Cyril Cathala (So@t) et Nathanael Marchand (So@t)       &lt;br /&gt;      &lt;br /&gt;Silverlight 5 arrive et apporte son lot de nouveautés. A travers cette session, vous allez pouvoir découvrir, comprendre et analyser toutes les nouveautés de cette version qui repousse encore plus loin les limites des RIA. Au menu, fenêtres natives, intégration encore plus poussée avec Windows, capacités multimédia améliorées tout ceci en proposant des outils encore plus performants pour le développement et le débogage.       &lt;br /&gt;      &lt;br /&gt;Mais la plus grosse innovation de Silverlight reste l’intégration du moteur XNA: la 3D dans Silverlight. Aidés de la dernière version du Silverlight Toolkit, nous découvrirons comment profiter d’une des plateformes de référence utilisée pour les jeux vidéo (sur XBOX et Windows Phone 7) afin que vos visiteurs soient époustouflés par des visites virtuelles, des catalogues de produits animés et d’autres raffinements qu’aucune autre technologie web ne permet si simplement.       &lt;br /&gt;      &lt;br /&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;- Session “Rx Framework” (40mn)&lt;/b&gt;       &lt;br /&gt;      &lt;br /&gt;Présenté par Aymeric Lagier (SUPINFO/MSP Expert Silverlight), Christophe Argento (Ineat Conseil) et Kévin Alexandre (Wygwam)       &lt;br /&gt;      &lt;br /&gt;Le challenge des interfaces d’aujourd’hui est de proposer toujours plus de fluidité tout en poussant la complexité tant au niveau des sources de données que du volume de données. Venez découvrir cette       &lt;br /&gt;      &lt;br /&gt;bibliothèque de Microsoft qui permet de simplifier le développement, gagner en fluidité tout en maitrisant les pièges de l’asynchrone.       &lt;br /&gt;      &lt;br /&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;- Session “Communication en Silverlight” (40mn)&lt;/b&gt;       &lt;br /&gt;      &lt;br /&gt;Présenté par John Thiriet (MCNext) et Matthieu Mezil (Infinite Square/MVP)       &lt;br /&gt;      &lt;br /&gt;Communiquer efficacement en Silverlight est un challenge. Vous pourrez découvrir lors de cette session des méthodes et astuces pour que votre application soit efficace face aux scénarios les plus complexes. La nouvelle couche Low Latency de Silverlight 5, la comparaison entre la pile de communication navigateur et client, WCF pour Silverlight seront notamment les sujets abordés lors de cet après-midi.       &lt;br /&gt;      &lt;br /&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;- Session “Retour d’expérience MVVM” (40mn)&lt;/b&gt;       &lt;br /&gt;      &lt;br /&gt;Animé par Stéphanie Hertrich (Microsoft France) et Jonathan Antoine (Infinite Square/MVP)       &lt;br /&gt;      &lt;br /&gt;Session spéciale, interactive et inédite : nous discuterons ensemble de MVVM afin de bénéficier du retour d'expérience de chacun. La session se voudra agile et sera construite d'après vos retours, en abordant de nombreux thèmes comme les difficultés rencontrées fréquemment avec ce pattern, les frameworks du marché, etc.       &lt;br /&gt;      &lt;br /&gt;      &lt;br /&gt;A la suite de ces sessions, &lt;b style="mso-bidi-font-weight: normal"&gt;un petit cocktail sera proposé&lt;/b&gt; afin de partager en toute convivialité avec les acteurs de la communauté ainsi que l’équipe de développement du Silverlight 5 Toolkit présente en exclusivité pour vous.&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: &amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #333333; font-size: 8.5pt; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;; mso-fareast-language: fr"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: &amp;#39;Tahoma&amp;#39;,&amp;#39;sans-serif&amp;#39;; color: #333333; font-size: 8.5pt; mso-fareast-font-family: &amp;#39;Times New Roman&amp;#39;; mso-fareast-language: fr"&gt;        &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;   &lt;table class="uiInfoTable mvm profileInfoTable"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;th class="label"&gt;Heure&lt;/th&gt;          &lt;td class="data"&gt;           &lt;div&gt;mercredi 26 octobre · &lt;span class="dtstart"&gt;&lt;span class="value-title" title="2011-10-26T14:00:00"&gt;&lt;/span&gt;14:00&lt;/span&gt; - &lt;span class="dtend"&gt;&lt;span class="value-title" title="2011-10-26T18:00:00"&gt;&lt;/span&gt;18:00&lt;/span&gt;&lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr class="spacer"&gt;         &lt;td colspan="2"&gt;           &lt;hr /&gt;&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;th class="label"&gt;Lieu&lt;/th&gt;          &lt;td class="data"&gt;           &lt;div class="location vcard"&gt;&lt;span class="fn org"&gt;Campus Microsoft&lt;/span&gt;               &lt;div class="adr"&gt;               &lt;div class="street-address"&gt;41 Quai du Président Roosevelt&lt;/div&gt;                &lt;div class="locality"&gt;Issy-les-Moulineau, France&lt;/div&gt;             &lt;/div&gt;           &lt;/div&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&amp;#160;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;A mercredi ! &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-martiniglass" alt="Verre à cocktail" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1663.wlEmoticon_2D00_martiniglass_5F00_7B518E8E.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10229342" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/MVVM/">MVVM</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Ev_26002300_233_3B00_nements/">Ev&amp;#233;nements</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Rx/">Rx</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category></item><item><title>Application CaveAVins pour Windows Phone : Scanner un code barre</title><link>http://blogs.msdn.com/b/stephe/archive/2011/10/18/application-caveavins-pour-wp7-1-scanner-un-code-barre.aspx</link><pubDate>Tue, 18 Oct 2011 15:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10226909</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10226909</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2011/10/18/application-caveavins-pour-wp7-1-scanner-un-code-barre.aspx#comments</comments><description>&lt;p align="justify"&gt;&lt;span style="background-color: #edeee6; color: #747162;"&gt;&lt;strong&gt;&lt;em&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Edit 14/11/2011&lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt; : &lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Mieux que de prendre le code en photo : Scannez un code barre/QR en live dans un flux vid&amp;eacute;o en 1 ligne de code ! &lt;/span&gt;&lt;/em&gt;&lt;em&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;&lt;a href="http://bit.ly/ud2rFn" title="http://bit.ly/ud2rFn" target="_blank"&gt;&lt;span style="background-color: #edeee6; color: #747162;"&gt;http://bit.ly/ud2rFn&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span style="color: #8b8674;"&gt;&lt;strong&gt;&lt;em&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Cet article compl&amp;egrave;te &lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/22/caveavins-wp7.aspx"&gt;la premi&amp;egrave;re maquette de l&amp;rsquo;application CaveAVins&lt;/a&gt; pour Windows Phone 7.5, en ajoutant une fonction d&amp;rsquo;aide &amp;agrave; l&amp;rsquo;achat gr&amp;acirc;ce au scan du code-barre de la bouteille.&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span class="Apple-style-span" style="font-family: Calibri;"&gt;L&amp;rsquo;application initiale permet d&amp;rsquo;ajouter, modifier, noter, localiser g&amp;eacute;ographiquement un vin. Pour simplifier la cr&amp;eacute;ation d&amp;rsquo;un vin et surtout obtenir une aide &amp;agrave; l&amp;rsquo;achat d&amp;rsquo;un vin en boutique, il sera possible de prendre le code-barre de la bouteille en photo, de visualiser les notes qui lui ont &amp;eacute;t&amp;eacute; donn&amp;eacute;es par les autre utilisateurs et d&amp;rsquo;obtenir la fiche compl&amp;egrave;te du vin. Si cette bouteille n&amp;rsquo;a pas encore &amp;eacute;t&amp;eacute; &amp;eacute;valu&amp;eacute;e, la fiche du vin devra &amp;ecirc;tre cr&amp;eacute;&amp;eacute;e manuellement et sera ainsi pr&amp;ecirc;te pour les prochains acheteurs.&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4062.image_5F00_0961CE7F.png" width="201" height="367" /&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Nous compl&amp;egrave;terons l&amp;rsquo;application existante, en mettant en place les &amp;eacute;l&amp;eacute;ments suivants:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Utilisation de la &lt;/span&gt;&lt;a href="http://silverlightzxing.codeplex.com/"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;librairie de scan de code-barres et QR code ZXing&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;, sur CodePlex &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Ajout d&amp;rsquo;une tuile secondaire permettant d&amp;rsquo;acc&amp;eacute;der au scan en 1 clic, depuis l&amp;rsquo;&amp;eacute;cran d&amp;rsquo;accueil &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Ajout de la note moyenne des utilisateurs sur la fiche de vin&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 align="justify"&gt;&lt;span color="#4f81bd" face="Calibri" style="color: #4f81bd; font-family: Calibri;"&gt;R&amp;eacute;sum&amp;eacute; des &amp;eacute;pisodes pr&amp;eacute;c&amp;eacute;dents&lt;/span&gt;&lt;/h1&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Articles:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/10/d-233-velopper-un-projet-aujourd-hui-comment-faire-par-o-249-commencer-1-9.aspx"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;D&amp;eacute;velopper un projet aujourd&amp;rsquo;hui : comment faire, par o&amp;ugrave; commencer ?&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/14/d-233-velopper-un-projet-aujourd-hui-architecture-et-d-233-coupage-2-9.aspx"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Architecture et d&amp;eacute;coupage du projet&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/21/d-233-velopper-un-projet-aujourd-hui-le-stockage-des-donn-233-es-3-9.aspx"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Stockage des donn&amp;eacute;es avec Sql Server, EF Code First et Azure&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/24/d-233-velopper-un-projet-aujourd-hui-publication-des-donn-233-es-4-9.aspx"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;La publication des donn&amp;eacute;es&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/21/d-233-velopper-un-projet-aujourd-hui-la-migration-dans-azure.aspx"&gt;La migration dans Azure&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/22/caveavins-wp7.aspx"&gt;L&amp;rsquo;application Windows Phone basique&lt;/a&gt;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Ajout de la fonction d&amp;rsquo;aide &amp;agrave; l&amp;rsquo;achat (vous &amp;ecirc;tes ici &lt;img alt="Star" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2541.wlEmoticon_2D00_star_5F00_5132E5EC.png" /&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Ajout des notifications sur les vins en promotions &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;L&amp;rsquo;application Silverlight&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Tutoriels:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/21/caveavins-tutoriel-1-l-acc-232-s-aux-donn-233-es-entity-framework-code-first-et-sql-azure.aspx"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;CaveAVins Tutoriel 1 : L&amp;rsquo;acc&amp;egrave;s aux donn&amp;eacute;es avec Sql Server et EF Code First&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/07/01/caveavins-tutoriel-2-la-publication-des-donn-233-es-en-odata-avec-wcf-data-services.aspx"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;CaveAVins Tutoriel 2 : La publication des donn&amp;eacute;es en OData avec WCF Data Services&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/01/caveavins-tutoriel-3-migration-des-donn-233-es-et-services-dans-azure.aspx"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;CaveAVins Tutoriel 3 : Migration d&amp;rsquo;une base SQL Server vers SQL Azure&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/05/caveavins-tutoriel-4-migration-du-service-odata-dans-azure.aspx"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;CaveAVins Tutoriel 4 : H&amp;eacute;bergement du service WCF Data Services dans Azure&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 align="justify"&gt;&lt;/h1&gt;
&lt;h1 align="justify"&gt;&lt;span color="#4f81bd" face="Calibri" style="color: #4f81bd; font-family: Calibri;"&gt;Le fonctionnement dans l&amp;rsquo;application&lt;/span&gt;&lt;/h1&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;1 - Le scan de code-barre est accessible &amp;agrave; partir de la tuile secondaire ou de la page d&amp;rsquo;ajout/&amp;eacute;dition d&amp;rsquo;un vin&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2742.image_5F00_6742F719.png" width="224" height="427" /&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6064.image_5F00_450AEB93.png" width="235" height="429" /&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;2 - Le code-barre d&amp;rsquo;une bouteille est pris en photo&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="WP_000243" border="0" alt="WP_000243" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8130.WP_5F00_000243_5F00_3BCEB052.jpg" width="240" height="181" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;3 &amp;ndash; Ce vin existe d&amp;eacute;j&amp;agrave; dans le catalogue : sa fiche est compl&amp;eacute;t&amp;eacute;e automatiquement, ou une nouvelle fiche de vin sera cr&amp;eacute;&amp;eacute;e. La note moyenne donn&amp;eacute;e par les utilisateurs s&amp;rsquo;affiche au bas de la photo.&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3731.image_5F00_61582DB3.png" width="240" height="439" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h1 align="justify"&gt;&lt;/h1&gt;
&lt;h1 align="justify"&gt;&lt;span color="#4f81bd" face="Calibri" style="color: #4f81bd; font-family: Calibri;"&gt;Utilisation de la librairie ZXing&lt;/span&gt;&lt;/h1&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;T&amp;eacute;l&amp;eacute;chargez &lt;/span&gt;&lt;a href="http://silverlightzxing.codeplex.com/"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;la librairie ZXing&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt; sur codeplex. Elle permet de scanner diff&amp;eacute;rents types de code-barres ainsi que des code QR dont voici la liste:&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;UPC-A and UPC-E &lt;br /&gt;EAN-8 and EAN-13 &lt;br /&gt;Code 39 &lt;br /&gt;Code 128 &lt;br /&gt;QR Code &lt;br /&gt;ITF &lt;br /&gt;Data Matrix (Not tested) &lt;br /&gt;PDF417 (Not tested)&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Dans notre cas, nous utiliserons le type Code 128.&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;La librairie est sous licence Apache 2.0 et peut donc &amp;ecirc;tre utilis&amp;eacute;e sur le marketplace. &lt;br clear="all" /&gt;Plus d&amp;rsquo;information concernant l&amp;rsquo;utilisation de librairies open-source sur le marketplace:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/03/08/an-update-on-windows-phone-marketplace-new-tips-policies-and-regional-access-program.aspx"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;An Update on Windows Phone Marketplace; new tips, policies and regional access program&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://create.msdn.com/en-us/home/legal/Windows_Phone_Marketplace_Application_Provider_Agreement"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Windows Phone Marketplace Application Provider Agreement&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Pour utiliser la librairie, r&amp;eacute;f&amp;eacute;rencez-la dans votre application Windows Phone&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6567.image_5F00_49DD7982.png" width="238" height="263" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Le scan de code barre est d&amp;eacute;clench&amp;eacute; par le code ci-dessous o&amp;ugrave; l&amp;rsquo;on r&amp;eacute;cup&amp;egrave;re le r&amp;eacute;sultat de mani&amp;egrave;re asynchrone:&lt;/span&gt;&lt;/p&gt;
&lt;div align="justify"&gt;
&lt;pre class="code"&gt;&lt;span style="color: gray;"&gt;/// &amp;lt;summary&amp;gt; /// &lt;/span&gt;&lt;span style="color: green;"&gt;Button click handler to initiate scanning. This should be ted to the click event for a button in your application &lt;/span&gt;&lt;span style="color: gray;"&gt;/// &amp;lt;/summary&amp;gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;public void &lt;/span&gt;ScanBarCode()
{
    &lt;span style="color: blue;"&gt;try &lt;/span&gt;{
        &lt;span style="color: #2b91af;"&gt;WP7BarcodeManager&lt;/span&gt;.ScanMode = com.google.zxing.&lt;span style="color: #2b91af;"&gt;BarcodeFormat&lt;/span&gt;.UPC_EAN;
        &lt;span style="color: #2b91af;"&gt;WP7BarcodeManager&lt;/span&gt;.ScanBarcode(BarcodeResults_Finished); &lt;span style="color: green;"&gt;//Provide callback method &lt;/span&gt;    }
    &lt;span style="color: blue;"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Exception &lt;/span&gt;ex)
    {
        &lt;span style="color: #2b91af;"&gt;Debug&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"Error processing image."&lt;/span&gt;, ex);
    }
}

&lt;span style="color: gray;"&gt;/// &amp;lt;summary&amp;gt; /// &lt;/span&gt;&lt;span style="color: green;"&gt;Callback method that processes results returned by the WP7BarcodeManager. Results are also stored at WP7BarcodeManager.LastCaptureResults. &lt;/span&gt;&lt;span style="color: gray;"&gt;/// &amp;lt;/summary&amp;gt; /// &amp;lt;param name="BCResults"&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;Object that holds all the results of processing the barcode. Results are also stored at WP7BarcodeManager.LastCaptureResults.&lt;/span&gt;&lt;span style="color: gray;"&gt;&amp;lt;/param&amp;gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;public void &lt;/span&gt;BarcodeResults_Finished(&lt;span style="color: #2b91af;"&gt;BarcodeCaptureResult &lt;/span&gt;BCResults)
{
  &lt;span style="color: #2b91af;"&gt;Deployment&lt;/span&gt;.Current.Dispatcher.BeginInvoke(() =&amp;gt;
  {
    &lt;span style="color: blue;"&gt;try &lt;/span&gt;{
        &lt;span style="color: blue;"&gt;if &lt;/span&gt;(BCResults.State == &lt;span style="color: #2b91af;"&gt;CaptureState&lt;/span&gt;.Success)
        {
            BarCode = BCResults.BarcodeText; &lt;span style="color: green;"&gt;//Use results &lt;/span&gt;FindWineFromBarCode(_BarCode);
        }
        &lt;span style="color: blue;"&gt;else &lt;/span&gt;{
            &lt;span style="color: #2b91af;"&gt;MessageBox&lt;/span&gt;.Show(BCResults.ErrorMessage);
        }
    }
    &lt;span style="color: blue;"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Exception &lt;/span&gt;ex)
    {
        &lt;span style="color: #2b91af;"&gt;MessageBox&lt;/span&gt;.Show(&lt;span style="color: #2b91af;"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515;"&gt;"Barcode Processing Error: {0}"&lt;/span&gt;, ex.Message));
    }
  });
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;En suivant &lt;/span&gt;&lt;a href="http://silverlightzxing.codeplex.com/documentation"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;l&amp;rsquo;exemple de code plus complet fourni dans la page de documentation&lt;/span&gt;&lt;/a&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;, vous pourrez m&amp;ecirc;me faire fonctionner votre application dans l&amp;rsquo;&amp;eacute;mulateur : il suffit dans ce cas de choisir une image sur votre disque plut&amp;ocirc;t que de prendre une photo.&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;On recherche ensuite un vin ayant le code-barre d&amp;eacute;tect&amp;eacute; et on charge sa fiche s&amp;rsquo;il existe d&amp;eacute;j&amp;agrave; dans la base, la fiche reste vierge en dehors du code-barre et devra &amp;ecirc;tre remplie manuellement.&lt;/span&gt;&lt;/p&gt;
&lt;div align="justify"&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;private void &lt;/span&gt;FindWineFromBarCode(&lt;span style="color: blue;"&gt;string &lt;/span&gt;barCode)
{
    &lt;span style="color: green;"&gt;// On cherche d'abord dans notre propre cave &amp;agrave; vins &lt;/span&gt;&lt;span style="color: blue;"&gt;var &lt;/span&gt;existingWine = &lt;span style="color: #2b91af;"&gt;CaveAVinsModel&lt;/span&gt;.Instance.Bottles.FirstOrDefault(b =&amp;gt; b.WineInfos.BarCode == barCode);
    &lt;span style="color: blue;"&gt;if &lt;/span&gt;(existingWine != &lt;span style="color: blue;"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: #2b91af;"&gt;MessageBox&lt;/span&gt;.Show(Resources.&lt;span style="color: #2b91af;"&gt;Strings&lt;/span&gt;.Wine_AlreadyExistsInYourCave);
        SelectedBottle = existingWine;
    }
    &lt;span style="color: blue;"&gt;else &lt;/span&gt;{
        &lt;span style="color: green;"&gt;// sinon on recherche le vin dans le catalogue complet &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;CaveAVinsModel&lt;/span&gt;.Instance.FindWineFromBarCode(SelectedBottle, barCode,
             () =&amp;gt; RefreshWineInfos(SelectedBottle));
    }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;h1 align="justify"&gt;&lt;span color="#4f81bd" face="Calibri" style="color: #4f81bd; font-family: Calibri;"&gt;Ajout d&amp;rsquo;une tuile secondaire pour scanner une bouteille en 1 clic depuis l&amp;rsquo;&amp;eacute;cran d&amp;rsquo;accueil&lt;/span&gt;&lt;/h1&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Pour faciliter l&amp;rsquo;ajout d&amp;rsquo;un vin, il est possible d&amp;rsquo;&amp;eacute;pingler la fonction de scan d&amp;rsquo;un code-barre directement sur la page d&amp;rsquo;accueil du t&amp;eacute;l&amp;eacute;phone. &lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1016.image_5F00_74CC5933.png" width="114" height="114" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;La tuile secondaire est cr&amp;eacute;&amp;eacute;e en cliquant sur le bouton &lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0677.image_5F00_27A56DFC.png" width="26" height="25" /&gt; visible sur la page d&amp;rsquo;&amp;eacute;dition du vin. &lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Voici le code utilis&amp;eacute; pour cr&amp;eacute;er la tuile :&lt;/span&gt;&lt;/p&gt;
&lt;div align="justify"&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;void &lt;/span&gt;CreateApplicationSecondaryTile()
{
    &lt;span style="color: blue;"&gt;var &lt;/span&gt;appTile = &lt;span style="color: #2b91af;"&gt;ShellTile&lt;/span&gt;.ActiveTiles
        .FirstOrDefault(t =&amp;gt; t.NavigationUri.ToString().Contains(&lt;span style="color: #a31515;"&gt;"Scan"&lt;/span&gt;));
    &lt;span style="color: blue;"&gt;if &lt;/span&gt;(appTile == &lt;span style="color: blue;"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: #2b91af;"&gt;StandardTileData &lt;/span&gt;secTileData = &lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;StandardTileData&lt;/span&gt;()
        {
            BackgroundImage = &lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Uri&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"/icons/barcode.png"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;UriKind&lt;/span&gt;.Relative),
            Title = &lt;span style="color: #2b91af;"&gt;Strings&lt;/span&gt;.secTileBarCode_Title,
        };

        &lt;span style="color: #2b91af;"&gt;ShellTile&lt;/span&gt;.Create(&lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;Uri&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"/View/EditWineView.xaml?Scan=1"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;UriKind&lt;/span&gt;.Relative), secTileData);
    }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Un param&amp;egrave;tre &amp;ldquo;Scan&amp;rdquo; est pass&amp;eacute; &amp;agrave; la page EditWineView pour diff&amp;eacute;rencier les sources d&amp;rsquo;appel : depuis la tuile ou depuis l&amp;rsquo;application. Si c&amp;rsquo;est la tuile qui a d&amp;eacute;clench&amp;eacute; la navigation sur la page, on lance directement la fonction de scan, pour minimiser le nombre de clics. Cette op&amp;eacute;ration est r&amp;eacute;alis&amp;eacute;e en surchargeant la m&amp;eacute;thode OnNavigatedTo:&lt;/span&gt;&lt;/p&gt;
&lt;div align="justify"&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;protected override void &lt;/span&gt;OnNavigatedTo(System.Windows.Navigation.&lt;span style="color: #2b91af;"&gt;NavigationEventArgs &lt;/span&gt;e)
{
    &lt;span style="color: blue;"&gt;if &lt;/span&gt;(e.NavigationMode == System.Windows.Navigation.&lt;span style="color: #2b91af;"&gt;NavigationMode&lt;/span&gt;.New)
    {
        &lt;span style="color: blue;"&gt;if &lt;/span&gt;(NavigationContext.QueryString.ContainsKey(&lt;span style="color: #a31515;"&gt;"Scan"&lt;/span&gt;))
        {
            &lt;span style="color: #2b91af;"&gt;App&lt;/span&gt;.ViewModel.EditWineViewModel.ScanBarCode();
        }
    }
    &lt;span style="color: blue;"&gt;else &lt;/span&gt;{
        &lt;span style="color: blue;"&gt;base&lt;/span&gt;.OnNavigatedTo(e);
    }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;h1 align="justify"&gt;&lt;span color="#4f81bd" face="Calibri" style="color: #4f81bd; font-family: Calibri;"&gt;Ajout de la note moyenne des utilisateurs sur la fiche de vin&lt;/span&gt;&lt;/h1&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Il faut pouvoir diff&amp;eacute;rencier la note que l&amp;rsquo;on donne au vin, de la moyenne de celles donn&amp;eacute;es par les autres utilisateurs. C&amp;rsquo;est pourquoi l&amp;rsquo;affichage de la note moyenne du vin est ajout&amp;eacute; au bas de la photo, sur la fiche du vin. &lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4456.image_5F00_015A0650.png" width="253" height="175" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Pour l&amp;rsquo;instant, celle-ci est calcul&amp;eacute;e en temps r&amp;eacute;el lors de l&amp;rsquo;ouverture de la fiche : on r&amp;eacute;cup&amp;egrave;re toutes les fiches de caves associ&amp;eacute;es &amp;agrave; ce vin qui comportent une note et on en fait une moyenne. Mais on pourrait imaginer la stocker dans la fiche et la mettre &amp;agrave; jour &amp;agrave; partir de notre WCF Data Service &amp;agrave; l&amp;rsquo;aide d&amp;rsquo;un intercepteur sur les requ&amp;ecirc;tes d&amp;rsquo;ajout/modification sur l&amp;rsquo;entite MyWine. Ceci permettrait d&amp;rsquo;optimiser la communication entre l&amp;rsquo;application et la base de donn&amp;eacute;es. Ce principe d&amp;rsquo;intercepteurs a d&amp;eacute;j&amp;agrave; &amp;eacute;t&amp;eacute; utilis&amp;eacute; dans &lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/22/caveavins-wp7.aspx"&gt;l&amp;rsquo;article pr&amp;eacute;c&amp;eacute;dent&lt;/a&gt;, pour stocker la latitude et la longitude associ&amp;eacute;s &amp;agrave; une adresse g&amp;eacute;ographique et vous pouvez vous y r&amp;eacute;f&amp;eacute;rer pour comprendre comment cela fonctionne. &lt;/span&gt;&lt;/p&gt;
&lt;h1 align="justify"&gt;&lt;span color="#4f81bd" face="Calibri" style="color: #4f81bd; font-family: Calibri;"&gt;Conclusion&lt;/span&gt;&lt;/h1&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Cette fois-ci , l&amp;rsquo;application est r&amp;eacute;ellement collaborative ! On retrouve une bouteille de vin d&amp;eacute;j&amp;agrave; pr&amp;eacute;sente dans le catalogue, on peut voir la moyenne des notes qui lui ont &amp;eacute;t&amp;eacute; attribu&amp;eacute;es et &amp;eacute;galement la noter soi-m&amp;ecirc;me. De l&amp;agrave; &amp;agrave; ce qu&amp;rsquo;elle soit vraiment fonctionnelle, il n&amp;rsquo;y a qu&amp;rsquo;un pas&amp;hellip;ou peut-&amp;ecirc;tre plusieurs, soit. Il manque encore plein de petits plus tr&amp;egrave;s pratiques comme pouvoir saisir le code-barre &amp;agrave; la main ou retrouver une bouteille &amp;agrave; partir de son nom. Il faudrait &amp;eacute;galement pouvoir classer les vins dans des cat&amp;eacute;gories et c&amp;eacute;pages.&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;Mais vous l&amp;rsquo;aurez compris, le principe pour r&amp;eacute;aliser ces fonctions sont du m&amp;ecirc;me ordre que celles qui ont d&amp;eacute;j&amp;agrave; &amp;eacute;t&amp;eacute; r&amp;eacute;alis&amp;eacute;es et ne justifient pas l&amp;rsquo;&amp;eacute;criture d&amp;rsquo;un tutoriel d&amp;eacute;di&amp;eacute;. D&amp;rsquo;autres fonctions collaboratives seraient n&amp;eacute;anmoins int&amp;eacute;ressantes comme le partage sur Facebook ou la possibilit&amp;eacute; de faire partager un vin &amp;agrave; un autre utilisateur de l&amp;rsquo;application.&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;D&amp;rsquo;autres plateformes peuvent aussi &amp;ecirc;tre tr&amp;egrave;s int&amp;eacute;ressantes pour ce genre d&amp;rsquo;applications avec notamment des possibilit&amp;eacute;s avanc&amp;eacute;es pour le partage d&amp;rsquo;information et les notifications.&lt;/span&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;span face="Calibri" style="font-family: Calibri;"&gt;A suivre&amp;nbsp; &lt;img style="border-style: none;" class="wlEmoticon wlEmoticon-smilewithtongueout" alt="Tire la langue" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3443.wlEmoticon_2D00_smilewithtongueout_5F00_42A8172C.png" /&gt; !&lt;/span&gt;&lt;/p&gt;
&lt;script type="text/javascript"&gt;// &lt;![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]&gt;&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10226909" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WP7/">WP7</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/C_2300_/">C#</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+7/">Windows 7</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/CaveAVins/">CaveAVins</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Projet/">Projet</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/comment+d_26002300_233_3B00_velopper+une+application/">comment d&amp;#233;velopper une application</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-1/">Windows Phone 7.1</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone/">Windows Phone</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Mango/">Mango</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-5/">Windows Phone 7.5</category></item><item><title>Nouvelle saison 2011 des MsDays</title><link>http://blogs.msdn.com/b/stephe/archive/2011/09/23/nouvelle-saison-2011-des-msdays.aspx</link><pubDate>Fri, 23 Sep 2011 14:57:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10215860</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10215860</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2011/09/23/nouvelle-saison-2011-des-msdays.aspx#comments</comments><description>&lt;p align="justify"&gt;&lt;a href="http://www.microsoft.com/france/microsoft-days/"&gt;&lt;font face="Calibri"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="ban-GENERIQUE_480x252" border="0" alt="ban-GENERIQUE_480x252" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8267.ban_2D00_GENERIQUE_5F00_480x252_5F00_725D94F9.jpg" width="405" height="215" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Plus que quelques jours avant la nouvelle saison 2011 des MsDays. &lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;J’aurai le plaisir de participer à 2 sessions très différentes.&lt;/font&gt;&lt;/p&gt;  &lt;h2 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Concevoir une application : mode d’emploi – les dessous de l’application CaveAVins&lt;/font&gt;&lt;/h2&gt;  &lt;p align="justify"&gt;&lt;em&gt;&lt;font face="Calibri"&gt;En partant du besoin fonctionnel de départ, nous choisirons les technologies adéquates pour implémenter notre application. D'Entity Framework, à WCF Data Services, en passant par la migration dans le Cloud, SQL Azure, WP7, Bing Map. Le but étant de vous en montrer les points clés.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Une session co-présentée avec Eric Vernie, qui reprend le fil conducteur de la série d’articles sur la cave à vins. &lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Comment développer une application avec les technologies actuelles, en respectant l’évolution des usages. Un bon résumé de la conception de bout en bout, depuis le stockage des données jusqu’à l’application Windows Phone et à l’ouverture vers d’autres technologies clientes. Une session dense, avec du code, qui vous permettra d’avoir un bon tour d’horizon des technologies de développement.&lt;/font&gt;&lt;/p&gt;  &lt;h2 align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/h2&gt;  &lt;h2 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Office 365 : Industrialisation du dev Sharepoint Online&lt;/font&gt;&lt;/h2&gt;  &lt;p align="justify"&gt;&lt;em&gt;&lt;font face="Calibri"&gt;Office 365 vient d’être lancé avec son offre de plateforme collaborative adaptée à toutes les tailles d’Entreprise, de la messagerie aux solutions synchrones, en passant par le portail collaboratif.        &lt;br /&gt;Vous connaissez déjà les bonnes pratiques de développement sur SharePoint Online : sandbox, intégration Silverlight, Linq to SharePoint, WCF, etc.         &lt;br /&gt;Venez découvrir dans cette session comment passer à la vitesse supérieure en industrialisant vos développements de bout en bout, des spécifications fonctionnelles au déploiement et à la maintenance applicative dans le cloud.        &lt;br /&gt;Un témoignage exclusif de Calinda Software, une Start-up française éditrice de solution sociale autour de SharePoint, qui viendra illustrer cette vision à travers leur propre expérience sur la Marketplace Office 365 pour le portage de leur solution dans le Cloud.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Une session co-présentée avec Na-Young Kwon (responsable produit Sharepoint) et la société Calinda. &lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Après un rappel des différences entre Sharepoint et Sharepoint Online par Na-Young, Calinda vous parlera des principales difficultés rencontrées lors du passage sur Sharepoint Online te sur la Marketplace. J’entrerai ensuite plus dans le code en vous montrant quelques astuces pour le développement sur la version Online de Sharepoint. &lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;A très bientôt !&lt;/font&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10215860" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Ev_26002300_233_3B00_nements/">Ev&amp;#233;nements</category></item><item><title>Développer un projet aujourd’hui : L’application CaveAVins pour Windows Phone 7.1</title><link>http://blogs.msdn.com/b/stephe/archive/2011/08/22/caveavins-wp7.aspx</link><pubDate>Mon, 22 Aug 2011 10:03:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10198411</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10198411</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2011/08/22/caveavins-wp7.aspx#comments</comments><description>&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;em&gt;&lt;font color="#9e7c7c" size="2"&gt;Update 18/10/2011: l’url du service OData devient &lt;/font&gt;&lt;/em&gt;&lt;a href="http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc"&gt;&lt;em&gt;&lt;font size="2"&gt;http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc&lt;/font&gt;&lt;/em&gt;&lt;/a&gt;&lt;font color="#9e7c7c"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Cet article décrit le fonctionnement de la première maquette de l’application Cave A Vins pour Windows Phone. Il explique les points sensibles de l’application et détaille leur réalisation, sans rentrer autant dans le détail qu’un tutoriel. &lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Pas si basique que cela, notre application va mettre en œuvre les concepts suivants:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Accès au service OData Azure du catalogue des vins : &lt;a href="http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc"&gt;http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc&lt;/a&gt;&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Identification de l’utilisateur par un numéro unique correspondant au LiveId &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Utilisation de l’API de prise de photo de WP7 &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Utilisation du &lt;a href="http://silverlight.codeplex.com/releases/view/71550"&gt;toolkit Silverlight pour WP7&lt;/a&gt;, des &lt;a href="http://coding4fun.codeplex.com/"&gt;tools Coding4Fun pour WP7&lt;/a&gt; et d’autres contrôles disponibles sur CodePlex &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Intégration du contrôle BingMap pour situer l’origine des bouteilles &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Gestion dynamique des tuiles double-face et affichage contextuel &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Stockage des photos prises par le téléphone dans les blobs Azure &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Utilisation du &lt;/font&gt;&lt;a href="http://watoolkitwp7.codeplex.com/"&gt;&lt;font face="Calibri"&gt;Toolkit Azure pour Windows Phone&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; permettant entre autres d’attaquer les stockages Azure &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Nous allons également modifier le service WCF Data Services pour le rendre plus intelligent et effectuer automatiquement la transformation d’une adresse en coordonnées latitude/longitude que l’on ajoutera aux informations sur le vin.&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;&lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-lightbulb" alt="Ampoule" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3716.wlEmoticon_2D00_lightbulb_5F00_12CE7D8A.png" /&gt; L’application est développée pour Windows Phone 7.1. Pour découvrir les nouveautés par-rapport à la version 7.0, c’est &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff637516(v=VS.92).aspx"&gt;&lt;font face="Calibri"&gt;ici&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;.      &lt;br clear="all" /&gt;Prérequis : &lt;/font&gt;&lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=27153"&gt;Windows Phone SDK 7.1 Release Candidate&lt;/a&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Un petit aperçu du résultat:&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="512" height="384"&gt;                      &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/VideoPlayer10_01_18.xap" /&gt;                      &lt;param name="initParams" value="m=http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-video/5226.ScreenCapture_5F00_22_2D00_08_2D00_2011-14.41.19.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2664.image_5F00_39A4B26F.png postid=556970" /&gt;                      &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt;                          &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt;                      &lt;/a&gt;                  &lt;/object&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&amp;#160;&lt;/p&gt;  &lt;h1 align="justify"&gt;&amp;#160;&lt;/h1&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Résumé des épisodes précédents&lt;/font&gt;&lt;/h1&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Articles:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/10/d-233-velopper-un-projet-aujourd-hui-comment-faire-par-o-249-commencer-1-9.aspx"&gt;&lt;font face="Calibri"&gt;Développer un projet aujourd’hui : comment faire, par où commencer ?&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/14/d-233-velopper-un-projet-aujourd-hui-architecture-et-d-233-coupage-2-9.aspx"&gt;&lt;font face="Calibri"&gt;Architecture et découpage du projet&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/21/d-233-velopper-un-projet-aujourd-hui-le-stockage-des-donn-233-es-3-9.aspx"&gt;&lt;font face="Calibri"&gt;Stockage des données avec Sql Server, EF Code First et Azure&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/24/d-233-velopper-un-projet-aujourd-hui-publication-des-donn-233-es-4-9.aspx"&gt;&lt;font face="Calibri"&gt;La publication des données&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/21/d-233-velopper-un-projet-aujourd-hui-la-migration-dans-azure.aspx"&gt;La migration dans Azure&lt;/a&gt;&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;L’application Windows Phone basique (vous êtes ici &lt;img alt="Star" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2541.wlEmoticon_2D00_star_5F00_5132E5EC.png" /&gt;) &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/10/18/application-caveavins-pour-wp7-1-scanner-un-code-barre.aspx"&gt;Ajout de la fonction d’aide à l’achat&lt;/a&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Ajout des notifications sur les vins en promotions &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;L’application Silverlight&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Tutoriels:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/21/caveavins-tutoriel-1-l-acc-232-s-aux-donn-233-es-entity-framework-code-first-et-sql-azure.aspx"&gt;&lt;font face="Calibri"&gt;CaveAVins Tutoriel 1 : L’accès aux données avec Sql Server et EF Code First&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/07/01/caveavins-tutoriel-2-la-publication-des-donn-233-es-en-odata-avec-wcf-data-services.aspx"&gt;&lt;font face="Calibri"&gt;CaveAVins Tutoriel 2 : La publication des données en OData avec WCF Data Services&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/01/caveavins-tutoriel-3-migration-des-donn-233-es-et-services-dans-azure.aspx"&gt;&lt;font face="Calibri"&gt;CaveAVins Tutoriel 3 : Migration d’une base SQL Server vers SQL Azure&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/05/caveavins-tutoriel-4-migration-du-service-odata-dans-azure.aspx"&gt;&lt;font face="Calibri"&gt;CaveAVins Tutoriel 4 : Hébergement du service WCF Data Services dans Azure&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h1 class="content-item" align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;  &lt;h1 class="content-item" align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Présentation des écrans&lt;/font&gt;&lt;/h1&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Voilà à quoi ressemble notre application de gestion de Cave A Vins.      &lt;br clear="all" /&gt;L’application utilise un contrôle Panorama, avec un en-tête déroulant affichant autant d’images de bouteilles que vous avez de vins différents dans votre cave. Si vous avez des yeux de lynx (‘achement dur ne pas écrire Linq ou Lync &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-alien" alt="Extra-terrestre" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4621.wlEmoticon_2D00_alien_5F00_2AF1E7E5.png" /&gt;), vous remarquerez qu’elles portent le nom du vin sur leur étiquette. Bon c’est pas fait pour être lisible, juste décoratif : les bouteilles défilent quand vous passez d’un item panorama à un autre &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smilewithtongueout" alt="Tire la langue" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2146.wlEmoticon_2D00_smilewithtongueout_5F00_3C6248BD.png" /&gt; (cf vidéo).&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;1 &lt;img title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2664.image_5F00_39A4B26F.png" width="261" height="473" /&gt; 2 &lt;img title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6864.image_5F00_2D73127B.png" width="262" height="474" /&gt; 3 &lt;img title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3125.image_5F00_3AA975C1.png" width="262" height="475" /&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;1 - La première page affiche la liste des vins présents dans la cave triés par date décroissante d’achat.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;2 - La seconde utilise le contrôle LongListSelector du toolkit Silverlight pour WP7 pour afficher la même liste, groupée par année. On pourrait imaginer ajouter les informations sur les cépages et proposer le même type de vue groupée ce qui serait très pratique.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;3 - La troisième page utilise le contrôle Bing Maps pour afficher l’origine des vins et le nombre de bouteilles associées. Cela permet de repérer facilement ce qu’il manque à la cave pour être suffisamment variée géographiquement parlant.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;4 &lt;img title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4606.image_5F00_1B56A921.png" width="246" height="466" /&gt; 5 &lt;img title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5857.image_5F00_65250B04.png" width="253" height="459" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;4 – le menu contextuel permet de décrémenter le nombre de bouteilles du vin sélectionné, d’ajouter/éditer/supprimer un vin de sa cave.&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;5 – l’édition d’un vin permet de saisir les informations qui lui sont relatives ainsi que de prendre la photo de son étiquette&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h1 class="content-item" align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;  &lt;h1 class="content-item" align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Architecture de la solution&lt;/font&gt;&lt;/h1&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Rappel de l’architecture existante après la migration dans Azure:&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8688.image48_5F00_460D2C92.png"&gt;&lt;font face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image48" border="0" alt="image48" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7522.image48_5F00_thumb_5F00_4383FAD4.png" width="481" height="297" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Et l’architecture qui sera mise en place dans le contexte de cet article :&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;&lt;img title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0842.image_5F00_73274922.png" width="688" height="481" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;&lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-lightbulb" alt="Ampoule" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3716.wlEmoticon_2D00_lightbulb_5F00_12CE7D8A.png" /&gt; Le service proxy d’authentification “CaveAVins Blob Authentifier” est facultatif mais conseillé pour ne pas divulguer les clés d’accès au storage Azure.&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;A ce stade, plusieurs questions restent encore en suspens :&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Quelle architecture vais-je mettre en place dans mon application WP ?&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Comment identifier le propriétaire de la cave pour retrouver quelles sont ses bouteilles dans la base de données ?&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Comment situer géographiquement mes vins sur un contrôle Bing Map à partir d’une simple adresse ?&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Comment accéder aux blobs Azure depuis le téléphone, pour y stocker les photos ?&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Comment modifier la structure des données créée avec Entity Framework Code First pour y ajouter de nouvelles informations ?&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Existe-t-il des contrôles gratuits pour faciliter le développement ? Liste groupée, contrôle rating pour la note associée à la bouteille, menu contextuel, animations …&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;L’architecture logique de mon application WP&lt;/font&gt;&lt;/h1&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;De mon point vue, la question est moins triviale pour une application Silverlight WP7 que pour du Silverlight classique.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Pour ma part, en Silverlight je pars toujours sur du “MVVM-like” plus ou moins strict, selon l’importance et la durée de vie de mon application. Je pars soit de mes classes de base et méthodes d’extension qui constituent ma boite à outils que j’ai créé au fil des projets, soit d’un framework ou partie de framework existant type MVVMLight, Caliburn, Prism…&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;em&gt;&lt;span style="color: #666666" color="#666666"&gt;&lt;font face="Calibri"&gt;&lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-lightbulb" alt="Ampoule" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3716.wlEmoticon_2D00_lightbulb_5F00_12CE7D8A.png" /&gt;En 3 mots, si vous ne savez pas ce qu’est MVVM (Model – View – ViewModel) : c’est une architecture 3-tiers avec&lt;/font&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;&lt;em&gt;&lt;span style="color: #666666" color="#666666"&gt;Model = le modèle (les données)&lt;/span&gt;&lt;/em&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;&lt;em&gt;&lt;span style="color: #666666" color="#666666"&gt;View = une vue (une page ou morceau de page, contrôle, …bref, un truc qui s’affiche à l’écran et se décrit en xaml &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smilewithtongueout" alt="Tire la langue" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2146.wlEmoticon_2D00_smilewithtongueout_5F00_3C6248BD.png" /&gt;)&lt;/span&gt;&lt;/em&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;&lt;em&gt;&lt;span style="color: #666666" color="#666666"&gt;ViewModel = un cas d’utilisation associé à une ou plusieurs vues. Un ViewModel est une classe qui présente des propriétés “notifiables” et bindables à la vue. En principe il n’y a pas ou peu de code-behind dans les vues et ainsi tout le code lié au cas d’utilisation exprimé par la vue est concentré dans la classe ViewModel qui lui est associé.&lt;/span&gt;&lt;/em&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p align="justify"&gt;&lt;em&gt;&lt;font face="Calibri"&gt;&lt;span style="color: #666666" color="#666666"&gt;La bible de ce qu’est l’architecture MVVM, avec un petit exemple et le code associé qui va bien :&lt;/span&gt;&lt;span style="color: #4f81bd" color="#4f81bd"&gt; &lt;/span&gt;&lt;/font&gt;&lt;/em&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx"&gt;&lt;em&gt;&lt;font face="Calibri"&gt;http://msdn.microsoft.com/en-us/magazine/dd419663.aspx&lt;/font&gt;&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Le choix est moins immédiat sur WP7 qu’en Silverlight classique ou WPF, car beaucoup de contrôles standards “metro styled” n’intègrent pas complètement les bindings (ex : les boutons de la barres de menu). Heureusement, plusieurs variantes de frameworks MVVM ont été portées pour WP7, comme MVVMLight, Caliburn, …&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Dans mon cas, je n’utiliserai pas de framework prêt à l’emploi – ce n’est pas le sujet de cet article -, mais je reste sur une architecture de type MVVM, sans être trop stricte, en conservant du code behind, notamment pour la navigation, et la gestion des boutons de la barre de menus.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;img title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2234.image_5F00_41A8669F.png" width="653" height="457" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;strong&gt;La couche View&lt;/strong&gt; est composée de vues : MainView qui contient le panorama à 3 items et EditWineView qui permet d’éditer un vin.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;strong&gt;La couche ViewModel&lt;/strong&gt; contient les 2 ViewModels&amp;#160; associés aux vues : MainViewModel et EditWineViewModel.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;strong&gt;La couche Model&lt;/strong&gt; est composée de la classe CaveAVinsModel qui est générée automatiquement lors de l’ajout du service CaveAVins, à partir des metadata, ce qui fait gagner un temps fou. D’autant plus que ces classes proxy implémentent déjà les mécanismes de notification (INotifyPropertyChanged). Du coup, mon MainviewModel va pouvoir directement exposer ces collections à la vue, sans passer par une classe WineViewModel intermédiaire. C’est un premier raccourci par-rapport à du MVVM.strict, mais dans ce cas là, c’est nettement plus productif.       &lt;br clear="all" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;La classe métier UploadPhoto prend en charge la sauvegarde des photos dans l’Azure Blob Storage, permettant ainsi que les couches Viewmodel et View ne soient pas couplées au mécanisme des blobs. On pourrait ainsi facilement stocker les photos ailleurs sans retoucher aux couches de présentation.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;strong&gt;La couche DAL&lt;/strong&gt; correspond à l’accès aux données : aux blobs Azure et à notre service WCF Data Services hébergé lui aussi dans Azure.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Identifier le propriétaire de la cave&lt;/font&gt;&lt;/h1&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Pour pouvoir associer des bouteilles à un propriétaire, plusieurs options s’offrent à nous et en l’occurrence, c’est la plus simple qui a été retenue.&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Le téléphone stocke un numéro associé au Live Id du propriétaire (renseigné dès le téléchargement de la première application sur le MarketPlace). Nous pouvons donc utiliser cet identifiant pour rattacher un vin à son propriétaire, sans pour autant lui demander d’informations d’authentification ou de connexion. Et si vous changez de téléphone, vous ne perdez pas pour autant votre cave à vins.&lt;/font&gt;&lt;/p&gt;  &lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Voici un exemple de code permettant d’accéder au numéro de l’utilisateur:&lt;/font&gt;&lt;/p&gt;  &lt;div align="justify"&gt;   &lt;pre class="code"&gt;&lt;span style="color: blue"&gt; public string &lt;/span&gt;GetUserAnId()
        {
            &lt;span style="color: blue"&gt;string &lt;/span&gt;myId = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty;
            &lt;span style="color: blue"&gt;string &lt;/span&gt;anid = &lt;span style="color: #2b91af"&gt;UserExtendedProperties&lt;/span&gt;.GetValue(&lt;span style="color: #a31515"&gt;&amp;quot;ANID&amp;quot;&lt;/span&gt;) &lt;span style="color: blue"&gt;as string&lt;/span&gt;;
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(anid != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
            { 
                myId = anid.Substring(2, 32);
            }

            &lt;span style="color: blue"&gt;return &lt;/span&gt;myId;
        }&lt;/pre&gt;
&lt;/div&gt;

&lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Une autre solution serait d’utiliser la fédération d’identité, en utilisant Azure Access Control Services (ACS) et un compte provenant d’un fournisseur d’identité comme Hotmail, Facebook, Google,… Cela évite à l’utilisateur de créer un énième compte dédié à l’application de cave à vins et ça permet au développeur de ne pas réinventer la roue en créant un mécanisme de gestion de comptes qui lui est propre.&lt;/font&gt;&lt;/p&gt;

&lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;Le &lt;/font&gt;&lt;a href="http://watoolkitwp7.codeplex.com/"&gt;&lt;font face="Calibri"&gt;Toolkit Azure pour Windows Phone&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; permet de simplifier cette opération en fournissant un template tout prêt pour ce genre d’applications. Benjamin a réalisé une &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/benjguin/archive/2011/07/28/authentification-f-233-d-233-r-233-e-depuis-une-application-de-smartphone.aspx"&gt;&lt;font face="Calibri"&gt;vidéo de quelques minutes&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; pour vous montrer comment utiliser le toolkit pour la gestion des authentifications.&lt;/font&gt;&lt;/p&gt;

&lt;p class="content-item" align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Localiser les vins sur un contrôle Bing Map&lt;/font&gt;&lt;/h1&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Une des vues de mon panorama est une carte Bing Map matérialisant les quantités restantes de chacun des vins de ma cave. C’est une bonne aide à l’achat pour garantir une cave variée et cela me permet de vérifier rapidement si je ne manque pas de vin d’Alsace !&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Le contrôle Bing Map fait cela très bien en affichant des punaises correspondant à une liste de coordonnées géographiques (latitude, longitude). Dans notre cas, la fiche d’un vin contient une adresse et il faut donc passer par une étape intermédiaire avant de pouvoir afficher la punaise : la transformation de l’adresse en latitude et longitude. Bing Map fournit un service de résolution utilisable avec un &lt;/font&gt;&lt;a href="http://www.bingmapsportal.com/"&gt;&lt;font face="Calibri"&gt;compte développeur&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; gratuit. Pour plus d’information sur les conditions d’utilisation : &lt;/font&gt;&lt;a href="http://www.microsoft.com/maps/product/licensing.aspx"&gt;&lt;font face="Calibri"&gt;http://www.microsoft.com/maps/product/licensing.aspx&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;L’application Windows Phone pourrait réaliser cette résolution dynamiquement lors du lancement de l’application, mais cela signifie que je ferais autant de résolutions que de vins dans ma cave, à chaque chargement des données. Une meilleure idée serait de modifier directement la fiche du vin lors de l’ajout ou de la modification d’un vin. Mais si c’est mon application WP7 qui s’en charge, cela signifie que tout autre client potentiel qui ajouterait des vins dans la cave ne disposerait pas de la latitude et longitude. L’idéal serait que quiconque utilise le service bénéficie de cette résolution d’adresse, même un simple client http.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Nous allons donc déporter cette résolution au niveau du service WCF Data Services à l’aide d’”intercepteurs”'. Voici comment cela se met place dans notre solution, dans la classe CaveAVinsDataService :&lt;/font&gt;&lt;/p&gt;

&lt;div align="justify"&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt; public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CaveAVinsDataService &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;DataService&lt;/span&gt;&amp;lt;CaveAVins.Db.&lt;span style="color: #2b91af"&gt;CaveAVinsContext&lt;/span&gt;&amp;gt;
    {
        &lt;span style="color: green"&gt;// This method is called only once to initialize service-wide policies. &lt;/span&gt;&lt;span style="color: blue"&gt;public static void &lt;/span&gt;InitializeService(&lt;span style="color: #2b91af"&gt;DataServiceConfiguration &lt;/span&gt;config)
        {
            config.SetEntitySetAccessRule(&lt;span style="color: #a31515"&gt;&amp;quot;Wines&amp;quot;&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;EntitySetRights&lt;/span&gt;.All);
            config.SetEntitySetAccessRule(&lt;span style="color: #a31515"&gt;&amp;quot;Bottles&amp;quot;&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;EntitySetRights&lt;/span&gt;.All);
            config.DataServiceBehavior.MaxProtocolVersion = &lt;span style="color: #2b91af"&gt;DataServiceProtocolVersion&lt;/span&gt;.V3;
        }


        &lt;span style="color: green"&gt;// Define a change interceptor for the Products entity set. &lt;/span&gt;[&lt;span style="color: #2b91af"&gt;ChangeInterceptor&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Wines&amp;quot;&lt;/span&gt;)]
        &lt;span style="color: blue"&gt;public void &lt;/span&gt;OnChangeProducts(&lt;span style="color: #2b91af"&gt;Wine &lt;/span&gt;updatedWine, &lt;span style="color: #2b91af"&gt;UpdateOperations &lt;/span&gt;operations)
        {
            CurrentDataSource.ChangeTracker.DetectChanges();
            &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;var &lt;/span&gt;uw &lt;span style="color: blue"&gt;in &lt;/span&gt;CurrentDataSource.ChangeTracker.Entries&amp;lt;&lt;span style="color: #2b91af"&gt;Wine&lt;/span&gt;&amp;gt;())
            {
                &lt;span style="color: blue"&gt;string &lt;/span&gt;oldValue = &lt;span style="color: blue"&gt;null&lt;/span&gt;;
                &lt;span style="color: blue"&gt;if &lt;/span&gt;(operations == &lt;span style="color: #2b91af"&gt;UpdateOperations&lt;/span&gt;.Change)
                {
                    oldValue = CurrentDataSource.ChangeTracker.Entries&amp;lt;&lt;span style="color: #2b91af"&gt;Wine&lt;/span&gt;&amp;gt;().First().OriginalValues.GetValue&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Address&amp;quot;&lt;/span&gt;);
                }

                &lt;span style="color: blue"&gt;if &lt;/span&gt;(oldValue != updatedWine.Address)
                {
                    &lt;span style="color: green"&gt;// Update Latitude &amp;amp; longitude &lt;/span&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;geoloc = MakeGeocodeRequest(updatedWine.Address);
                    &lt;span style="color: blue"&gt;if &lt;/span&gt;(geoloc != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
                    {
                        uw.Entity.Latitude = geoloc.Latitude;
                        uw.Entity.Longitude = geoloc.Longitude;
                    }
                }
            }

        }&lt;/pre&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;On ajoute une méthode préfixée d’un custom attribute &lt;span style="font-family: courier new" face="Courier New"&gt;&lt;span style="white-space: pre"&gt;&lt;span style="color: #2b91af" color="#2b91af"&gt;ChangeInterceptor&lt;/span&gt;&lt;/span&gt;(&lt;span style="white-space: pre"&gt;&lt;span style="color: #a31515" color="#a31515"&gt;&amp;quot;Wines&amp;quot;&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt;qui permet d’intercepter les requêtes de modification et d’ajout sur la table Wine. Si cette opération concerne un ajout ou qu’une modification de la propriété Address a été détectée, on appelle le service BingMap qui nous renverra une latitude et une longitude à partir de l’adresse. Ces informations sont alors répercutées directement dans l’entité Wine.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;C’est tout côté serveur.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Dans l’application, il suffit de binder la collection de vins au contrôle Bing Map.&lt;/font&gt; &lt;/p&gt;

&lt;div align="justify"&gt;
  &lt;pre class="code"&gt;     &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Map &lt;/span&gt;&lt;span style="color: red"&gt;CredentialsProvider&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;font style="background-color: #ffff00"&gt;Your credentials&lt;/font&gt;&amp;quot;
             &lt;/span&gt;&lt;span style="color: red"&gt;Center&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;46.642000079154968,2.3379997909069061&amp;quot;
             &lt;/span&gt;&lt;span style="color: red"&gt;ZoomLevel&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;5&amp;quot;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;MapItemsControl &lt;/span&gt;&lt;font style="background-color: #ffff00"&gt;&lt;span style="color: red"&gt;ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Model&lt;/span&gt;&lt;/font&gt;&lt;span style="color: blue"&gt;&lt;font style="background-color: #ffff00"&gt;.Bottles&lt;/font&gt;}&amp;quot;&amp;gt;
               &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;MapItemsControl.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                         &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Pushpin &lt;/span&gt;&lt;font style="background-color: #ffff00"&gt;&lt;span style="color: red"&gt;Location&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Converter&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource &lt;/span&gt;&lt;span style="color: red"&gt;BottlesToLocationConv&lt;/span&gt;&lt;/font&gt;&lt;span style="color: blue"&gt;&lt;font style="background-color: #ffff00"&gt;}&lt;/font&gt;}&amp;quot;                                             
                                     &lt;/span&gt;&lt;span style="color: red"&gt;Tap&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Image_Tap&amp;quot;
                                     &lt;/span&gt;&lt;span style="color: red"&gt;Background&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;DarkRed&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Bold&amp;quot;&amp;gt;
                                    
                             &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBlock &lt;/span&gt;&lt;span style="color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Center&amp;quot; 
                                        &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding &lt;/span&gt;&lt;span style="color: red"&gt;Count&lt;/span&gt;&lt;span style="color: blue"&gt;}&amp;quot;/&amp;gt;
    
                             &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Pushpin.Template&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;                                  …
                             &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Pushpin.Template&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                         &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Pushpin&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
              &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;MapItemsControl.ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;MapItemsControl&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;my&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Map&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Pour cela, j’utilise un converter qui me renvoit une instance de Geocoordinates (latitude, longitude) à partir d’une instance de Wine. Puis je personnalise le PushPin pour qu’il affiche le nombre de bouteilles, c’est à dire la propriété Count de la classe MyWine.&lt;/font&gt;&lt;/p&gt;

&lt;div align="justify"&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;BottlesToLocationConverter &lt;/span&gt;: IValueConverter
{
    &lt;span style="color: blue"&gt;public object &lt;/span&gt;Convert(&lt;span style="color: blue"&gt;object &lt;/span&gt;value, &lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;targetType, &lt;span style="color: blue"&gt;object &lt;/span&gt;parameter, System.Globalization.&lt;span style="color: #2b91af"&gt;CultureInfo &lt;/span&gt;culture)
    {
        MyWine wine = value &lt;span style="color: blue"&gt;as &lt;/span&gt;MyWine;
        GeoCoordinate result = &lt;span style="color: blue"&gt;null&lt;/span&gt;;

        &lt;span style="color: blue"&gt;if &lt;/span&gt;(wine != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        {
            result = &lt;span style="color: blue"&gt;new &lt;/span&gt;GeoCoordinate(wine.WineInfos.Latitude.GetValueOrDefault(), 
                wine.WineInfos.Longitude.GetValueOrDefault());
        }

        &lt;span style="color: blue"&gt;return &lt;/span&gt;result;
    }

    &lt;span style="color: blue"&gt;public object &lt;/span&gt;ConvertBack(&lt;span style="color: blue"&gt;object &lt;/span&gt;value, &lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;targetType, &lt;span style="color: blue"&gt;object &lt;/span&gt;parameter, System.Globalization.&lt;span style="color: #2b91af"&gt;CultureInfo &lt;/span&gt;culture)
    {
        &lt;span style="color: blue"&gt;return null&lt;/span&gt;;
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Le tour est joué !&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Accéder au service OData&lt;/font&gt;&lt;/h1&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Le SDK Windows Phone 7.1 fournit un client WCF Data Services (vive Linq) ainsi que la possibilité de générer les classes proxy d’un service directement dans Visual Studio : bref, c’est tout pareil qu’en Silverlight classique.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;On commencer par ajouter la référence du service de cave à vins : &lt;a href="http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc"&gt;http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc&lt;/a&gt;&lt;/font&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;font face="Calibri"&gt;. Puis on instancie la classe de contexte qui vient d’être générée. Ensuite on construit sa requête de sélection ou on effectue les opérations CUD et on exécute tout cela de manière asynchrone.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Reste la gestion du tombstoning du contexte WCF Data Services qui permettra de retrouver un état cohérent de nos entités : &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hh286409(v=VS.92).aspx"&gt;&lt;font face="Calibri"&gt;How to persist the state of an OData client for Windows Phone&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;. En effet, depuis Windows Phone 7.1, la persistence des données est facilitée par la nouvelle méthode “Serialize” au niveau du contexte WCF Data Services.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Tous les détails dans le tutoriel associé à paraitre.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Modification de la structure de la base de données&lt;/font&gt;&lt;/h1&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Pour permettre de réaliser ces fonctionnalités, nous avons besoin d’ajouter des informations dans la base de données et donc de modifier sa structure. Rappelons que celle-ci a été créée automatiquement à partir de nos classes POCOs, grâce à Entity Framework Code First.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Il est également possible d’associer des classes POCOs à une base de données existante, et c’est ce qui a été fait dans notre cas, pour ajouter de nouvelles colonnes/propriétés. La structure de la base a été modifiée directement à partir du portail SQL Azure et les nouvelles propriétés de nos POCOS sont associées aux nouvelles colonnes de nos tables grâce à l’API Fluent pour Entity Framework Code First.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Avant :&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6153.image_5F00_52CCC232.png" width="470" height="278" /&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Maintenant:&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;img title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7217.image_5F00_3C1D451C.png" width="376" height="251" /&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;L’entité MyWine est complétée par&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;la date d’achat du vin : pour le tri dans l’application et pouvoir visualiser facilement la dernière bouteille achetée &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;L’entité Wine est complétée par:&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Latitude: pour effectuer 1 seule fois la transformation Addresse/Coordonnées pour chaque vin affiché sur contrôle BingMap &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Longitude : idem latitude &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;BarCode : pour identifier une bouteille à partir de la photo de son code barre – à venir &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Avec Fluent, cela se fait en quelques lignes dans le contructeur du contexte, après avoir complété les POCOs par les nouvelles propriétés:&lt;/font&gt;&lt;/p&gt;

&lt;div align="justify"&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CaveAVinsContext &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;DbContext &lt;/span&gt;{
    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DbSet&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;MyWine&lt;/span&gt;&amp;gt; Bottles { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DbSet&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Wine&lt;/span&gt;&amp;gt; Wines { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;CaveAVinsContext()
        : &lt;span style="color: blue"&gt;base&lt;/span&gt;()
    {
        &lt;span style="color: #2b91af"&gt;Database&lt;/span&gt;.SetInitializer&amp;lt;&lt;span style="color: #2b91af"&gt;CaveAVinsContext&lt;/span&gt;&amp;gt;(&lt;span style="color: blue"&gt;null&lt;/span&gt;);
    }

    &lt;span style="color: blue"&gt;protected override void &lt;/span&gt;OnModelCreating(&lt;span style="color: #2b91af"&gt;DbModelBuilder &lt;/span&gt;modelBuilder)
    {
        modelBuilder.Entity&amp;lt;&lt;span style="color: #2b91af"&gt;MyWine&lt;/span&gt;&amp;gt;().Property(p =&amp;gt; p.UserId);
        modelBuilder.Entity&amp;lt;&lt;span style="color: #2b91af"&gt;MyWine&lt;/span&gt;&amp;gt;().Property(p =&amp;gt; p.AddedDate);

        modelBuilder.Entity&amp;lt;&lt;span style="color: #2b91af"&gt;Wine&lt;/span&gt;&amp;gt;().Property(p =&amp;gt; p.BarCode);

        modelBuilder.Entity&amp;lt;&lt;span style="color: #2b91af"&gt;Wine&lt;/span&gt;&amp;gt;().Property(p =&amp;gt; p.Latitude);
        modelBuilder.Entity&amp;lt;&lt;span style="color: #2b91af"&gt;Wine&lt;/span&gt;&amp;gt;().Property(p =&amp;gt; p.Longitude);
        &lt;span style="color: blue"&gt;base&lt;/span&gt;.OnModelCreating(modelBuilder);
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Prendre la bouteille en photo&lt;/font&gt;&lt;/h1&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;C’est très facile grâce à l’API WP7 dédiée et cela se fait en quelques lignes, du genre :&lt;/font&gt;&lt;/p&gt;

&lt;div align="justify"&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;void &lt;/span&gt;TakeAPic()
{
    &lt;span style="color: #2b91af"&gt;CameraCaptureTask &lt;/span&gt;task = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CameraCaptureTask&lt;/span&gt;();
    task.Completed += (sender, photoResult) =&amp;gt;
    {
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(photoResult.TaskResult == &lt;span style="color: #2b91af"&gt;TaskResult&lt;/span&gt;.OK)
        {
            &lt;span style="color: #2b91af"&gt;BitmapImage &lt;/span&gt;bmp = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;BitmapImage&lt;/span&gt;();
            bmp.SetSource(photoResult.ChosenPhoto);
            PhotoSource = bmp;                                
        }
    };
    task.Show();
}&lt;/pre&gt;
&lt;/div&gt;

&lt;h1 align="justify"&gt;&lt;/h1&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Attention de pas oublier de :&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;faire une rotation de l’image pour la stocker en mode portrait. On pourrait le faire à l’affichage par un RenderTransform mais du coup il faudrait l’effectuer dans chaque application cliente =&amp;gt; factorisation métier côté serveur quand on peut ! &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;réduire la taille de la photo avant de la stocker dans le blob storage, puisque nous n’utiliserons que des vignettes. &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Stocker les photos dans le blob Azure&lt;/font&gt;&lt;/h1&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Une fois la photo prise et la fiche enregistrée, il faut :&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;soumettre la requête de modification au service WCF Data Services de notre Cave à Vins &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;uploader la photo (nommée avec un nouveau Guid pour pouvoir l’identifier de manière unique) dans les blobs Azure. &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Une fois de plus, le &lt;/font&gt;&lt;a href="http://watoolkitwp7.codeplex.com/"&gt;&lt;font face="Calibri"&gt;Toolkit Azure pour Windows Phone&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; va nous aider en facilitant l’utilisation des blobs à partir de notre smartphone grâce à la librairie WindowsPhoneCloud.StorageClient.dll&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Pour commencer simplement, vous pouvez partir &lt;/font&gt;&lt;a href="https://wazmobiletoolkit.blob.core.windows.net/public/WP7CloudAppWithoutToolkitServices.zip"&gt;&lt;font face="Calibri"&gt;d’un sample de code&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; issu du toolkit qui ne cible que la partie storage (merci &lt;/font&gt;&lt;a href="http://watoolkitwp7.codeplex.com/discussions/251433"&gt;&lt;font face="Calibri"&gt;Wade&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;). Les credentials sont placés dans les ressources de l’application et sont donc visibles par tout un chacun, ce qui n’est pas recommandé. Mais dans un premier temps, on s’en contentera pour simplifier.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Grâce à la classe CloudBlobClient fournie dans WindowsPhoneCloud.StorageClient.dll, l’upload de la photo (propriété PhotoStream de type Stream) s’effectue ainsi :&lt;/font&gt;&lt;/p&gt;

&lt;div align="justify"&gt;
  &lt;pre class="code"&gt;    &lt;span style="color: blue"&gt;public void &lt;/span&gt;UploadPhoto(&lt;span style="color: #2b91af"&gt;Action &lt;/span&gt;callback = &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: blue"&gt;this&lt;/span&gt;.IsUploading = &lt;span style="color: blue"&gt;true&lt;/span&gt;;

        &lt;span style="color: blue"&gt;this&lt;/span&gt;.blobClient.Upload(
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.BlobName,
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.PhotoStream,
            r =&amp;gt; &lt;span style="color: blue"&gt;this&lt;/span&gt;.dispatcher.BeginInvoke(
                    () =&amp;gt;
                    {
                        &lt;span style="color: blue"&gt;this&lt;/span&gt;.IsUploading = &lt;span style="color: blue"&gt;false&lt;/span&gt;;

                        &lt;span style="color: blue"&gt;if &lt;/span&gt;(r.Exception == &lt;span style="color: blue"&gt;null&lt;/span&gt;)
                        {
                            &lt;span style="color: #2b91af"&gt;MessageBox&lt;/span&gt;.Show(
                                &lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #2b91af"&gt;CultureInfo&lt;/span&gt;.InvariantCulture, 
                                &lt;span style="color: #a31515"&gt;&amp;quot;Image file {0} successfully uploaded!&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;this&lt;/span&gt;.BlobName),
                                &lt;span style="color: #a31515"&gt;&amp;quot;Upload Photo Result&amp;quot;&lt;/span&gt;,
                                &lt;span style="color: #2b91af"&gt;MessageBoxButton&lt;/span&gt;.OK);

                            &lt;span style="color: blue"&gt;if &lt;/span&gt;(callback != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
                            {
                                callback.Invoke();
                            }
                        }
                        &lt;span style="color: blue"&gt;else
                        &lt;/span&gt;{
                            &lt;span style="color: #2b91af"&gt;MessageBox&lt;/span&gt;.Show(
                                &lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(
                                    &lt;span style="color: #2b91af"&gt;CultureInfo&lt;/span&gt;.InvariantCulture,
                                    &lt;span style="color: #a31515"&gt;&amp;quot;Error: {0}&amp;quot;&lt;/span&gt;,
                                    r.Exception.Message),
                                &lt;span style="color: #a31515"&gt;&amp;quot;Upload Photo Result&amp;quot;&lt;/span&gt;,
                                &lt;span style="color: #2b91af"&gt;MessageBoxButton&lt;/span&gt;.OK);
                        }
                    }));
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-lightbulb" alt="Ampoule" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3716.wlEmoticon_2D00_lightbulb_5F00_12CE7D8A.png" /&gt;La version complète du toolkit vous permet de réaliser la même opération en version sécurisée, en ajoutant un service qui fait office de proxy d’authentification. C’est lui qui contiendra les credentials plutôt que votre application WP7 !&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Plus de contrôles Silverlight pour Windows Phone&lt;/font&gt;&lt;/h1&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Le toolkit le plus utilisé est sans conteste le &lt;/font&gt;&lt;a href="http://silverlight.codeplex.com/"&gt;&lt;font face="Calibri"&gt;Silverlight Toolkit pour WP&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; disponible sur codeplex.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;J’ai utilisé :&lt;/font&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;le LongListSelector permettant d’afficher une liste découpée selon un group by &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;une animation sur les listes :le TiltEffect, qui permet d’avoir un retour visuel sur sélection d’un élément &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;le menu contextuel : indispensable pour une bonne expérience utilisateur et éviter d’avoir trop de boutons partout &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;… &lt;/font&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;J’avais également besoin d’un contrôle Rating et j’ai réutilisé &lt;/font&gt;&lt;a href="http://mark-dot-net.blogspot.com/2011/06/silverlight-star-rating-control.html"&gt;&lt;font face="Calibri"&gt;celui-ci&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; (sur codeplex) qui n’est pas prévu pour WP7, mais qui fonctionne bien du moment que l’on désactive le contrôle pendant une gesture. 
    &lt;br clear="all" /&gt;Un Rating control est également disponible dans le &lt;/font&gt;&lt;a href="http://silverlight.codeplex.com/wikipage?title=Silverlight%20Toolkit%20Control%20Overview%20Pg3"&gt;&lt;font face="Calibri"&gt;Silverlight Toolkit&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;, mais je ne l’ai pas essayé dans le cadre d’une application WP.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Le &lt;/font&gt;&lt;a href="http://coding4fun.codeplex.com/"&gt;&lt;font face="Calibri"&gt;Coding4fun Tools&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; est également très sympa (surtout qu’un de mes propres contrôles y a été intégré &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Clignement d&amp;#39;œil" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6036.wlEmoticon_2D00_winkingsmile_5F00_34D6D950.png" /&gt;). Vous y trouverez un menu about, un colorpicker, etc, …&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Faites votre marché &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Rire" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3618.wlEmoticon_2D00_openmouthedsmile_5F00_702A3F0E.png" /&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;&lt;/font&gt;&lt;/h1&gt;

&lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Les tuiles dynamiques de l’écran d’accueil&lt;/font&gt;&lt;/h1&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Avec WP7.1, il est ultra simple de rendre vos tuiles dynamiques.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Un simple appel de méthode permet de mettre à jour une ou les deux faces de la tuile associée à votre application. Pour la Cave à Vins, la 1ère face affiche le nom de l’application, un petit dessin ainsi que le nombre total de bouteilles de votre cave. La 2ème face affiche le nom de la dernière bouteille achetée. Et c’est aussi simple que :&lt;/font&gt;&lt;/p&gt;

&lt;div align="justify"&gt;
  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public void &lt;/span&gt;CreateApplicationTile(&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;MyWine&lt;/span&gt;&amp;gt; bottles = &lt;span style="color: blue"&gt;null&lt;/span&gt;)
{            
    &lt;span style="color: blue"&gt;var &lt;/span&gt;appTile = &lt;span style="color: #2b91af"&gt;ShellTile&lt;/span&gt;.ActiveTiles.First();

    &lt;span style="color: blue"&gt;if &lt;/span&gt;(appTile != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: blue"&gt;var &lt;/span&gt;standardTile = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StandardTileData &lt;/span&gt;{
            Title = &lt;span style="color: #a31515"&gt;&amp;quot;Cave A Vins&amp;quot;&lt;/span&gt;,
            BackgroundImage = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;/icons/tileBackground2.png&amp;quot;&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;UriKind&lt;/span&gt;.Relative),                    
            BackTitle = &lt;span style="color: #a31515"&gt;&amp;quot;Dernier achat&amp;quot;&lt;/span&gt;,
        };

        &lt;span style="color: blue"&gt;if &lt;/span&gt;(bottles != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        {
            standardTile.Count = bottles.Sum(b =&amp;gt; b.Count);
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(bottles.Any())
            {
                standardTile.BackContent = 
                    bottles.OrderByDescending(w =&amp;gt; w.AddedDate)
                            .First()
                            .WineInfos.Name;
            }
        }

        appTile.Update(standardTile);
    }
}  &lt;/pre&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Côté pile, un MAGNIFIQUE petit dessin ainsi que le nombre total de bouteilles de votre cave :&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1854.image_5F00_3609FE74.png" width="126" height="123" /&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Côté face : la dernière bouteille achetée&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1351.image_5F00_61DA5263.png" width="123" height="123" /&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&amp;#160;&lt;/p&gt;

&lt;p align="justify"&gt;&amp;#160;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Voilà, tous les points sensibles de l’application sont maintenant exposés et détaillés. Je ne ferai pas de tutoriel pas à pas pour chacun des points, mais si vous rencontrez des difficultés avec l’un d’entre eux, je peux tout à fait développer le sujet dans un autre article.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Reste à peaufiner l’application, à la localiser et à gérer le tombstoning correctement (notamment en ce qui concerne WCF Data Services).&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Dans le &lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/10/18/application-caveavins-pour-wp7-1-scanner-un-code-barre.aspx"&gt;prochain article&lt;/a&gt;, nous verrons comment retrouver une bouteille à partir de la photo de son code barre et profiter ainsi des bouteilles déjà saisies par la communauté des utilisateur de l’application CaveAVins.&lt;/font&gt;&lt;/p&gt;

&lt;p align="justify"&gt;&lt;script type="text/javascript"&gt;
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
&lt;/script&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10198411" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/MVVM/">MVVM</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Silverlight/">Silverlight</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WP7/">WP7</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/OData/">OData</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WCF+Data+Services/">WCF Data Services</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Entity/">Entity</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/CaveAVins/">CaveAVins</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Projet/">Projet</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Code+First/">Code First</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/comment+d_26002300_233_3B00_velopper+une+application/">comment d&amp;#233;velopper une application</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-1/">Windows Phone 7.1</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone/">Windows Phone</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Mango/">Mango</category></item><item><title>Développer un projet aujourd’hui : La migration dans Azure</title><link>http://blogs.msdn.com/b/stephe/archive/2011/08/21/d-233-velopper-un-projet-aujourd-hui-la-migration-dans-azure.aspx</link><pubDate>Sun, 21 Aug 2011 15:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10198558</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10198558</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2011/08/21/d-233-velopper-un-projet-aujourd-hui-la-migration-dans-azure.aspx#comments</comments><description>&lt;p&gt;&lt;font face="Calibri"&gt;&lt;em&gt;&lt;font color="#9e7c7c" size="2"&gt;Update 18/10/2011: l’url du service OData devient &lt;/font&gt;&lt;/em&gt;&lt;a href="http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc"&gt;&lt;em&gt;&lt;font size="2"&gt;http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc&lt;/font&gt;&lt;/em&gt;&lt;/a&gt;&lt;font color="#9e7c7c"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;Un petit mot pour vous présenter les deux tutoriels qui vous permettront de faire migrer la base de données ainsi que le service de publication dans Azure.&lt;/font&gt;&lt;/p&gt; &lt;font face="Calibri"&gt;   &lt;h1 align="justify"&gt;&lt;font color="#4f81bd" face="Calibri"&gt;Résumé des épisodes précédents&lt;/font&gt;&lt;/h1&gt;    &lt;ul&gt;     &lt;li&gt;       &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/10/d-233-velopper-un-projet-aujourd-hui-comment-faire-par-o-249-commencer-1-9.aspx"&gt;&lt;font face="Calibri"&gt;Développer un projet aujourd’hui : comment faire, par où commencer ?&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/14/d-233-velopper-un-projet-aujourd-hui-architecture-et-d-233-coupage-2-9.aspx"&gt;&lt;font face="Calibri"&gt;Architecture et découpage du projet&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/21/d-233-velopper-un-projet-aujourd-hui-le-stockage-des-donn-233-es-3-9.aspx"&gt;&lt;font face="Calibri"&gt;Stockage des données avec Sql Server, EF Code First et Azure&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/24/d-233-velopper-un-projet-aujourd-hui-publication-des-donn-233-es-4-9.aspx"&gt;&lt;font face="Calibri"&gt;La publication des données&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;La migration dans Azure (vous êtes ici &lt;img alt="Star" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2541.wlEmoticon_2D00_star_5F00_5132E5EC.png" /&gt;)&lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/22/caveavins-wp7.aspx"&gt;L’application Windows Phone basique&lt;/a&gt;&amp;#160; &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/10/18/application-caveavins-pour-wp7-1-scanner-un-code-barre.aspx"&gt;Ajout de la fonction d’aide à l’achat&lt;/a&gt; &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;&lt;font face="Calibri"&gt;Ajout des notifications sur les vins en promotions &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;L’application Silverlight &lt;/div&gt;     &lt;/li&gt;   &lt;/ul&gt;    &lt;p align="justify"&gt;&lt;font face="Calibri"&gt;Tutoriels:&lt;/font&gt;&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;       &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/21/caveavins-tutoriel-1-l-acc-232-s-aux-donn-233-es-entity-framework-code-first-et-sql-azure.aspx"&gt;&lt;font face="Calibri"&gt;CaveAVins Tutoriel 1 : L’accès aux données avec Sql Server et EF Code First&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/07/01/caveavins-tutoriel-2-la-publication-des-donn-233-es-en-odata-avec-wcf-data-services.aspx"&gt;&lt;font face="Calibri"&gt;CaveAVins Tutoriel 2 : La publication des données en OData avec WCF Data Services&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/01/caveavins-tutoriel-3-migration-des-donn-233-es-et-services-dans-azure.aspx"&gt;&lt;font face="Calibri"&gt;CaveAVins Tutoriel 3 : Migration d’une base SQL Server vers SQL Azure&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;div align="justify"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/05/caveavins-tutoriel-4-migration-du-service-odata-dans-azure.aspx"&gt;&lt;font face="Calibri"&gt;CaveAVins Tutoriel 4 : Hébergement du service WCF Data Services dans Azure&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;     &lt;/li&gt;   &lt;/ul&gt; &lt;/font&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;Architecture On Premises :&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;&lt;img title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2148.image6_5F00_526D2283.png" width="280" height="214" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;Après la mise en pratique des deux tutoriels:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;- &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/01/caveavins-tutoriel-3-migration-des-donn-233-es-et-services-dans-azure.aspx"&gt;&lt;font face="Calibri"&gt;CaveAVins Tutoriel 3 : Migration d’une base SQL Server vers SQL Azure&lt;/font&gt;&lt;/a&gt;     &lt;br /&gt;&lt;font face="Calibri"&gt;- &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/05/caveavins-tutoriel-4-migration-du-service-odata-dans-azure.aspx"&gt;&lt;font face="Calibri"&gt;CaveAVins Tutoriel 4 : Hébergement du service WCF Data Services dans Azure&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;On obtient l’architecture suivante:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;&lt;img title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2642.image_5F00_101A0A40.png" width="398" height="246" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;Le service OData publiant les données de la cave à vins est maintenant en ligne : &lt;a href="http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc"&gt;http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc&lt;/a&gt;&lt;/font&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;Vous pouvez l’utiliser très simplement dans un projet Visual Studio en faisant un “Add Service Reference”, ou sur d’autres plateformes clientes grâces aux différents helpers : &lt;/font&gt;&lt;a href="http://www.odata.org/developers/odata-sdk"&gt;&lt;font face="Calibri"&gt;http://www.odata.org/developers/odata-sdk&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;script type="text/javascript"&gt;
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
&lt;/script&gt;&lt;/p&gt;  &lt;p&gt;Le &lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/22/caveavins-wp7.aspx"&gt;prochain article&lt;/a&gt; sera consacré à l’application CaveAVins pour Windows Phone 7.1. : avec Mango, c’est encore plus simple d’utiliser un service OData !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10198558" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/OData/">OData</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WCF+Data+Services/">WCF Data Services</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sql+Server/">Sql Server</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/CaveAVins/">CaveAVins</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Projet/">Projet</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/comment+d_26002300_233_3B00_velopper+une+application/">comment d&amp;#233;velopper une application</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sql+Azure/">Sql Azure</category></item><item><title>Liste des nouvelles API pour WP7.1 Mango</title><link>http://blogs.msdn.com/b/stephe/archive/2011/08/08/documentation-sur-les-nouvelles-api-pour-wp7-1-mango.aspx</link><pubDate>Mon, 08 Aug 2011 10:53:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10193600</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10193600</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2011/08/08/documentation-sur-les-nouvelles-api-pour-wp7-1-mango.aspx#comments</comments><description>&lt;p&gt;&lt;font size="2" face="Calibri"&gt;Petit rappel vite fait pour vous attaquer aux nouveautés de Windows Phone 7.1 (Mango)…&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2" face="Calibri"&gt;Voici &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hh202995(v=VS.92).aspx"&gt;&lt;font size="2" face="Calibri"&gt;la documentation MSDN&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Calibri"&gt; détaillant les nouvelles API pour Windows Phone 7.1.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2" face="Calibri"&gt;Et toujours &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff637516(v=VS.92).aspx"&gt;&lt;font size="2" face="Calibri"&gt;la liste des nouveautés&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Calibri"&gt; avec les exemples et “How To” qui vont bien.&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Et aussi pour les apps existantes : &lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx"&gt;&lt;font size="2" face="Calibri"&gt;Vérifiez que votre application est compatible avec Silverlight 4&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Calibri"&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/hh202997(v=VS.92).aspx"&gt;&lt;font size="2" face="Calibri"&gt;Les API 7.0 modifiées&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Calibri"&gt; en 7.1&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt; &lt;script type="text/javascript"&gt;
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10193600" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WP7/">WP7</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/API/">API</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone+7-1/">Windows Phone 7.1</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Windows+Phone/">Windows Phone</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Mango/">Mango</category></item><item><title>CaveAVins Tutoriel 4 : Hébergement du service WCF Data Services dans Azure</title><link>http://blogs.msdn.com/b/stephe/archive/2011/08/05/caveavins-tutoriel-4-migration-du-service-odata-dans-azure.aspx</link><pubDate>Fri, 05 Aug 2011 09:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10192113</guid><dc:creator>Stephanie Hertrich</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/stephe/rsscomments.aspx?WeblogPostID=10192113</wfw:commentRss><comments>http://blogs.msdn.com/b/stephe/archive/2011/08/05/caveavins-tutoriel-4-migration-du-service-odata-dans-azure.aspx#comments</comments><description>&lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;font color="#9e7c7c"&gt;&lt;em&gt;Update 18/10/2011: l’url du service OData devient &lt;/em&gt;&lt;/font&gt;&lt;a href="http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc"&gt;&lt;em&gt;http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc&lt;/em&gt;&lt;/a&gt;&lt;font color="#9e7c7c"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Après la migration des données dans SQL Azure effectuée dans le &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/01/caveavins-tutoriel-3-migration-des-donn-233-es-et-services-dans-azure.aspx"&gt;&lt;font size="2" face="Calibri"&gt;précédent tutoriel&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Calibri"&gt;, c’est au tour du service WCF Data Services de publication des données d’être hébergé sur la plateforme Cloud. Il sera ainsi accessible facilement depuis l’extérieur, y compris par un smartphone.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Les étapes décrites dans ce tutoriel sont valables pour n’importe quelle ASP.Net Web Application.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Nous irons “de là”&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6064.image_5F00_6E472A90.png" width="371" height="247" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;à “de là”:&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4863.image_5F00_64948E5E.png" width="389" height="240" /&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd"&gt;Résumé des épisodes précédents&lt;/font&gt;&lt;/h1&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/10/d-233-velopper-un-projet-aujourd-hui-comment-faire-par-o-249-commencer-1-9.aspx"&gt;&lt;font size="2" face="Calibri"&gt;Développer un projet aujourd’hui : comment faire, par où commencer ?&lt;/font&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/14/d-233-velopper-un-projet-aujourd-hui-architecture-et-d-233-coupage-2-9.aspx"&gt;&lt;font size="2" face="Calibri"&gt;Architecture et découpage du projet&lt;/font&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/21/d-233-velopper-un-projet-aujourd-hui-le-stockage-des-donn-233-es-3-9.aspx"&gt;&lt;font size="2" face="Calibri"&gt;Stockage des données avec Sql Server, EF Code First et Azure&lt;/font&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/24/d-233-velopper-un-projet-aujourd-hui-publication-des-donn-233-es-4-9.aspx"&gt;&lt;font size="2" face="Calibri"&gt;La publication des données&lt;/font&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2" face="Calibri"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/21/d-233-velopper-un-projet-aujourd-hui-la-migration-dans-azure.aspx"&gt;La migration dans Azure&lt;/a&gt;&amp;#160;&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2" face="Calibri"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/22/caveavins-wp7.aspx"&gt;L’application Windows Phone basique&lt;/a&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2" face="Calibri"&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/10/18/application-caveavins-pour-wp7-1-scanner-un-code-barre.aspx"&gt;Ajout de la fonction d’aide à l’achat&lt;/a&gt; &lt;/font&gt;&lt;/li&gt;    &lt;li&gt;&lt;font size="2" face="Calibri"&gt;Ajout des notifications sur les vins en promotions&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2" face="Calibri"&gt;L’application Silverlight &lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Tutoriels:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;- &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/06/21/caveavins-tutoriel-1-l-acc-232-s-aux-donn-233-es-entity-framework-code-first-et-sql-azure.aspx"&gt;&lt;font size="2" face="Calibri"&gt;CaveAVins Tutoriel 1 : L’accès aux données avec Sql Server et EF Code First&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Calibri"&gt; &lt;/font&gt;&lt;a href="http://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/&amp;lt;span style='color: #333333;' color='#333333'&amp;gt;CaveAVins Tutoriel 1 : L&amp;amp;rsquo;acc&amp;amp;egrave;s aux donn&amp;amp;eacute;es avec Sql Server et EF Code First &amp;lt;/span&amp;gt;&amp;lt;span style='color: #333333;' color='#333333'&amp;gt; &amp;lt;br clear=&amp;quot;all&amp;quot; /&amp;gt;&amp;lt;/span&amp;gt;"&gt;     &lt;br /&gt;&lt;/a&gt;&lt;font size="2" face="Calibri"&gt;- &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/07/01/caveavins-tutoriel-2-la-publication-des-donn-233-es-en-odata-avec-wcf-data-services.aspx"&gt;&lt;font size="2" face="Calibri"&gt;CaveAVins Tutoriel 2 : La publication des données en OData avec WCF Data Services&lt;/font&gt;&lt;/a&gt;     &lt;br /&gt;&lt;font size="2" face="Calibri"&gt;- &lt;/font&gt;&lt;a href="http://blogs.msdn.com/b/stephe/archive/2011/08/01/caveavins-tutoriel-3-migration-des-donn-233-es-et-services-dans-azure.aspx"&gt;&lt;font size="2" face="Calibri"&gt;CaveAVins Tutoriel 3 : Migration d’une base SQL Server vers SQL Azure&lt;/font&gt;&lt;/a&gt;     &lt;br clear="all" /&gt;&lt;font size="2" face="Calibri"&gt;- CaveAVins Tutoriel 4 : Hébergement du service WCF Data Services dans Azure (vous êtes ici &lt;img alt="Star" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2541.wlEmoticon_2D00_star_5F00_5132E5EC.png" /&gt;)&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd"&gt;&lt;/font&gt;&lt;/h1&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd"&gt;Pré-requis:&lt;/font&gt;&lt;/h1&gt;  &lt;ol&gt;   &lt;li&gt;     &lt;div align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Il vous faut un compte Azure que vous obtiendrez gratuitement pour une période de 30 jours: &lt;/font&gt;&lt;a href="http://windowsazurepass.com/?campid=223BC7CB-564B-E011-98E3-001F29C8E9A8"&gt;&lt;font size="2" face="Calibri"&gt;Azure Pass&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Calibri"&gt; &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Installez le &lt;/font&gt;&lt;a href="http://www.microsoft.com/downloads/fr-fr/details.aspx?FamilyID=7a1089b6-4050-4307-86c4-9dadaa5ed018"&gt;&lt;font size="2" face="Calibri"&gt;kit de développement et outils Azure&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Vous pouvez utiliser n’importe quel service pour suivre ce tutoriel. Pour l’illustration nous partons de la solution construite depuis les 2 précédents tutoriels, que vous pouvez télécharger ici:          &lt;br clear="all" /&gt;&lt;/font&gt;&lt;iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="https://skydrive.live.com/embedicon.aspx/Articles/CaveAVins/CaveAVins%20Tuto%202%20Src.zip?cid=63046d1c0f2deb83&amp;amp;sc=documents" frameborder="0" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;        &lt;br clear="all" /&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Dans cette solution, il vous faudra modifier le fichier de configuration pour pointer sur votre base de données SQL Azure, comme expliqué dans le précédent tutoriel.          &lt;br clear="all" /&gt;Cela revient à ajouter la chaine de connexion appropriée dans le web.config du projet web comme par-exemple:&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;blockquote&gt;   &lt;p align="left"&gt;&lt;span style="font-size: small"&gt;&lt;font face="Calibri"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;connectionStrings&lt;/span&gt;&lt;/font&gt;&lt;span style="color: blue"&gt;&lt;font face="Calibri"&gt;&amp;gt;            &lt;br clear="all" /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;add&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;CaveAVinsContext&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;connectionString&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Server=tcp:oy7122pvo6.database.windows.net,1433;Database=CaveAVins.Db.Azure;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size: small"&gt;&lt;font face="Calibri"&gt;&lt;span style="color: blue"&gt;User ID=stephe@oy7122pvo6;Password=myPassword;Trusted_Connection=False;Encrypt=True;&lt;/span&gt;&amp;quot;           &lt;br clear="all" /&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-size: small"&gt;&lt;font face="Calibri"&gt;&lt;span style="color: red"&gt;providerName&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;System.Data.SqlClient&lt;/span&gt;&amp;quot;&lt;/font&gt;&lt;span style="color: blue"&gt;&lt;font face="Calibri"&gt;/&amp;gt;            &lt;br clear="all" /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small"&gt;&lt;font face="Calibri"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163,21,21)"&gt;connectionStrings&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p align="justify"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: blue"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p align="justify"&gt;&lt;span style="font-size: small"&gt;&lt;span style="color: blue"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd"&gt;Les étapes&lt;/font&gt;&lt;/h1&gt;  &lt;ol&gt;   &lt;li&gt;     &lt;div align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Pour héberger un service sur Azure, il suffit d’ajouter un projet de type Azure dans la solution Visual Studio. &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Ce projet Azure permettra d’associer le projet web à un web rôle dans Azure et de le configurer. &lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Il est ensuite possible d’exécuter le service dans l’émulateur Azure directement sur votre poste de travail, ce qui vous permet de rendre votre solution fonctionnelle et de la débugger sans utiliser de compte Azure.&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Quelques modifications de configuration seront nécessaires pour permettre l’hébergement dans Azure.&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Vous pourrez ensuite déployer le service dans Azure directement depuis Visual Studio, en pré-production&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Et la passer en production pour la rendre disponible publiquement avec une URL du type &lt;/font&gt;&lt;font size="2" face="Calibri"&gt;&lt;a href="http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc"&gt;http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc&lt;/a&gt;&lt;/font&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ol&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd"&gt;C’est parti !&lt;/font&gt;&lt;/h1&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Ouvrez la solution CaveAVins dans Visual Studio.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Modifiez les propriétés de l’application Web de manière à ce qu’elle se positionne directement sur le service OData au démarrage:&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2678.image_5F00_40E594C0.png" width="685" height="200" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Ajoutez un nouveau projet de type Windows Azure.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1780.image_5F00_296AE08F.png" width="671" height="323" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Appelez-le CaveAVins.Azure et cliquez sur OK.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2671.image_5F00_7F3B32A6.png" width="530" height="385" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Visual Studio nous propose d’ajouter de nouveaux projets pour les associer à des rôles, mais comme c’est un projet Web existant que nous souhaitons héberger dans Azure, nous avons déjà ce qu’il nous faut.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5808.image_5F00_49E1FA74.png" width="241" height="216" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Le nouveau projet Azure est ajouté à la solution. Remarquez que le répertoire “Roles” est vide. Nous allons donc associer un web role au projet web existant : CaveAVins.WebApplication.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/8561.image_5F00_15CD5B21.png" width="544" height="181" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Faites un clic droit sur “Roles” et ajoutez un nouveau web role pour un projet de la solution&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/7484.image_5F00_77336A77.png" width="468" height="329" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Notre projet CaveAVins.WebApplication apparait, et nous le sélectionnons.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5417.image_5F00_75166BAE.png" width="236" height="225" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Notre web role apparait dans le projet Azure : il sera hébergé sur la plateforme lors du déploiement.&lt;/font&gt;&lt;/p&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd"&gt;Exécution dans l’émulateur Azure&lt;/font&gt;&lt;/h1&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;En exécutant votre application (en veillant bien à ce que le projet de démarrage soit CaveAVins.Azure), l’émulateur Azure hébergera votre service. Vous avez accès à l’instance à travers la console de l’émulateur. Vous la trouverez dans les icones en bas à droite de votre écran:&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2287.image_5F00_4101CC5B.png" width="280" height="223" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1538.image_5F00_2C2FD3DB.png" width="458" height="344" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Le service apparait dans la page lors du lancement :&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5773.image_5F00_3CCC43A8.png" width="618" height="249" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Maintenant que le service fonctionne dans l’émulateur, déployons le réellement dans Azure.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;h1 align="justify"&gt;&lt;font color="#4f81bd"&gt;Déploiement du service dans Azure&lt;/font&gt;&lt;/h1&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Avant de déployer, modifions le nombre d’instances configurés pour le service et passons-le à 2. &lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;En effet, les caractéristiques de haute disponibilité d’Azure ne peuvent être garanties si vous ne déployez qu’une seule instance, et d’ailleurs la console d’administration vous préviendra de ce risque, comme ci-dessous :&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2477.image_5F00_07DF3E6B.png" width="880" height="545" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-lightbulb" alt="Ampoule" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2068.wlEmoticon_2D00_lightbulb_5F00_4B66C9C0.png" /&gt; Pour vous familiariser avec le portail Azure, je vous conseille les fiches pratiques : &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/fr-fr/windowsazure/gg685452"&gt;&lt;font size="2" face="Calibri"&gt;Premiers Pas dans l’administration de Windows Azure&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Calibri"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Nous modifions également la taille de la VM pour choisir le minimum correspondant à nos besoins et faire ainsi baisser le cout de mon hébergement.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Puis nous désactivons les options de diagnostique.&amp;#160; Pour les utiliser sur Azure, il faudra modifier la valeur par défaut pour l’associer à votre compte de stockage azure.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4544.image_5F00_43DB5A53.png" width="427" height="316" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Pour que les librairies spécifiques à notre projet soient incluses dans le package Azure, il faut activer la copie locale, dans les propriétés. Dans notre, cas il faudra l’appliquer à CaveAVins.Db et à EntityFramework.&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5518.image_5F00_6FABAE42.png" width="227" height="378" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;Compilez (F6), faites un clic droit sur le projet Azure et choisissez “Publish”&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3554.image_5F00_5F503689.png" width="380" height="215" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Vous allez pouvoir travailler directement dans dans Visual Studio pour vos projets Azure, que ce soit pour le développement ou pour le déploiement. Mais pour cela il faut commencer par associer votre projet à votre compte Azure et environnement de travail (stockage, service host).&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Pour un premier déploiement, il vous faut donc accéder au portail Azure pour créer un Storage…&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/0334.image_5F00_762F0805.png" width="460" height="238" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;…ainsi qu’un nouveau Hosted Service.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5040.image_5F00_6CF2CCC4.png" width="628" height="209" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Lorsque vous créerez le hosted service qui servira à héberger votre projet, il faudra décocher l’option de publication par défaut, puisque c’est à partir de Visual Studio que nous orchestrerons tout cela:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1325.image_5F00_46444077.png" width="430" height="487" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Si vous êtes perdus, suivez les étapes qui sont plus détaillées dans &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/fr-fr/windowsazure/gg685460"&gt;&lt;font size="2" face="Calibri"&gt;la fiche pratique de création d’un nouveau service&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Revenons à présent à notre déploiement depuis Visual Studio et créons les informations d’authentification nécessaires pour que l’utilisation du compte Azure puisse se faire.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1325.image_5F00_3C9BD241.png" width="360" height="344" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3404.image_5F00_4BEF3450.png" width="475" height="329" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Ensuite suivez les étapes 2 et 3 indiquées sur la page, à savoir copier le chemin vers le certificat qui a été créé localement sur la machine.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3007.image_5F00_44171BE1.png" width="483" height="339" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;L’ajouter dans le portail Azure&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1348.image_5F00_209A777C.png" width="606" height="254" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Copier le “subscription ID” comme demandé à l’étape 3, que vous trouverez ici:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5076.image_5F00_103EFFC3.png" width="559" height="399" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;On y arrive !&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5078.image_5F00_3483E445.png" width="401" height="392" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Par défaut, le déploiement est proposé dans l’environnement de staging (pré-production), ce qui nous convient bien pour le moment.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Le déploiement sur Azure prendra un peu de temps, et vous pouvez évaluer l’avancement dans l’”Azure Activity Log” de Visual Studio.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2450.image_5F00_22E3D3AD.png" width="824" height="131" /&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Ou dans l’explorateur de serveur toujours dans Visual Studio.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/3835.image_5F00_59DDB1E6.png" width="260" height="254" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Ou encore directement dans le portail Azure.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/1307.image_5F00_57C0B31D.png" width="677" height="305" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Vos efforts sont payants : la prochaine fois que vous modifierez votre service et que vous voudrez le déployer, cela se fera en un clic…(bon disons deux : ”Publish” et “Ok”).&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-lightbulb" alt="Ampoule" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/2068.wlEmoticon_2D00_lightbulb_5F00_4B66C9C0.png" /&gt; Vous pouvez aussi utiliser Web Deploy pour le déploiement dans Azure, grâce à &lt;/font&gt;&lt;a href="http://waawebroles.codeplex.com/"&gt;&lt;font size="2" face="Calibri"&gt;Windows Azure Accelerator for Web Role&lt;/font&gt;&lt;/a&gt;&lt;font size="2" face="Calibri"&gt;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Votre service est maintenant prêt à être utilisé à l’adresse de staging : &lt;/font&gt;&lt;a href="http://db4da25d018242349e92ad4b830b162b.cloudapp.net/CaveAVinsDataService.svc"&gt;&lt;font face="Calibri"&gt;&lt;font size="2"&gt;http://db4da25d018242349e92ad4b830b162b.cloudapp.net/&lt;strong&gt;&lt;font color="#36648b"&gt;CaveAVinsDataService.svc&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Vous pouvez passer votre service en production en publiant sur l’environnement de production dans Visual Studio ou en passant le service de pré-prod en production par le portail Azure :&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/5504.image_5F00_096BAAA6.png" width="602" height="260" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Calibri"&gt;&lt;font size="2"&gt;Une fois l’opération réalisée, le service est disponible en production, et donc disponible à travers l’URL fixe &lt;a href="http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc"&gt;http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc&lt;/a&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/6406.image_5F00_1F721638.png" width="716" height="251" /&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Cliquez sur &lt;/font&gt;&lt;font size="2" face="Calibri"&gt;&lt;a href="http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc"&gt;http://stephecaveavins.cloudapp.net/CaveAVinsDataService.svc&lt;/a&gt;&lt;/font&gt;&lt;font size="2" face="Calibri"&gt; pour accéder au service.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4527.image_5F00_7542684F.png" width="419" height="233" /&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Et voilà !&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Notre architecture devient:&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-39-52-metablogapi/4786.image_5F00_5B58531D.png" width="389" height="240" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Calibri"&gt;Nous pouvons maintenant accéder aux données à partir d’une application Windows Phone : c’est le sujet de nos prochains tutoriels.&lt;/font&gt;&lt;/p&gt; &lt;script type="text/javascript"&gt;
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17658568-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
&lt;/script&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10192113" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/stephe/archive/tags/OData/">OData</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/WCF+Data+Services/">WCF Data Services</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/C_2300_/">C#</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sql+Server/">Sql Server</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sources/">Sources</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Azure/">Azure</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/CaveAVins/">CaveAVins</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Projet/">Projet</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Architecture/">Architecture</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/comment+d_26002300_233_3B00_velopper+une+application/">comment d&amp;#233;velopper une application</category><category domain="http://blogs.msdn.com/b/stephe/archive/tags/Sql+Azure/">Sql Azure</category></item></channel></rss>