﻿<?xml version="1.0" encoding="UTF-8"?>
<!--RSS généré par le Générateur RSS Microsoft SharePoint Foundation sur 24/05/2013 00:24:22 -->
<?xml-stylesheet type="text/xsl" href="/blog/cpe/_layouts/RssXslt.aspx?List=200937ab-393a-4f9a-861e-3a725a103d1e" version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Blog Christophe Peerens : Billets</title>
    <link>http://www.mytic.be/blog/cpe/Lists/Billets/AllPosts.aspx</link>
    <description>Flux RSS pour la liste Billets.</description>
    <lastBuildDate>Thu, 23 May 2013 22:24:22 GMT</lastBuildDate>
    <generator>Générateur RSS Microsoft SharePoint Foundation</generator>
    <ttl>60</ttl>
    <language>fr-FR</language>
    <image>
      <title>Blog myTIC - Christophe Peerens : Billets</title>
      <url>http://www.mytic.be/blog/cpe/_layouts/images/siteIcon.png</url>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/AllPosts.aspx</link>
    </image>
    <item>
      <title>Donner un “petit” nom à vos threads .NET et/ou natif</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=4</link>
      <description><![CDATA[<div><b>Publié:</b> 06/10/2010 09:33</div>
<div><b>Titre:</b> Donner un “petit” nom à vos threads .NET et/ou natif</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=7&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=7&RootFolder=*">Debugging</a>; <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=5&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=5&RootFolder=*">C++</a>; <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=4&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=4&RootFolder=*">.Net</a>; <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=6&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=6&RootFolder=*">Threading</a></div>
<div><b>Corps:</b> <div class="ExternalClassB7456E5D26D3425685EA8DEB1CA88225">   <p>Lors de développement multithread, il arrive que plusieurs threads exécutent le même code. Lors du debugging, il n’est pas toujours commode de savoir dans quel thread le debugger fait du pas à pas. Il faut regarder le contexte, soit par les paramètres, soit par les variables.</p>    <p>Voici un petit exemple de code qui illustre 3 threads manipulant des fichiers:</p>   <style>
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode, .ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode pre
{font-size:small;color:black;font-family:consolas, &quot;Courier New&quot;, courier, monospace;background-color:#ffffff;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode pre
{margin:0em;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode .rem
{color:#008000;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode .kwrd
{color:#0000ff;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode .str
{color:#006080;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode .op
{color:#0000c0;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode .preproc
{color:#cc6633;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode .asp
{background-color:#ffff00;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode .html
{color:#800000;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode .attr
{color:#ff0000;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode .alt
{background-color:#f4f4f4;width:100%;margin:0em;}
.ExternalClassB7456E5D26D3425685EA8DEB1CA88225 .csharpcode .lnum
{color:#606060;}
</style>    <div class="csharpcode">     <pre class="alt"><span class="lnum">   1:  </span><span class="kwrd">using</span> System;</pre>

    <pre><span class="lnum">   2:  </span><span class="kwrd">using</span> System.Collections.Generic;</pre>

    <pre class="alt"><span class="lnum">   3:  </span><span class="kwrd">using</span> System.ComponentModel;</pre>

    <pre><span class="lnum">   4:  </span><span class="kwrd">using</span> System.Data;</pre>

    <pre class="alt"><span class="lnum">   5:  </span><span class="kwrd">using</span> System.Drawing;</pre>

    <pre><span class="lnum">   6:  </span><span class="kwrd">using</span> System.Linq;</pre>

    <pre class="alt"><span class="lnum">   7:  </span><span class="kwrd">using</span> System.Text;</pre>

    <pre><span class="lnum">   8:  </span><span class="kwrd">using</span> System.Windows.Forms;</pre>

    <pre class="alt"><span class="lnum">   9:  </span><span class="kwrd">using</span> System.Threading;</pre>

    <pre><span class="lnum">  10:  </span> </pre>

    <pre class="alt"><span class="lnum">  11:  </span><span class="kwrd">namespace</span> WindowsFormsApplication1</pre>

    <pre><span class="lnum">  12:  </span>{</pre>

    <pre class="alt"><span class="lnum">  13:  </span>    <span class="kwrd">public</span> <span class="kwrd">partial</span> <span class="kwrd">class</span> Form1 : Form</pre>

    <pre><span class="lnum">  14:  </span>    {</pre>

    <pre class="alt"><span class="lnum">  15:  </span>        <span class="kwrd">public</span> Form1()</pre>

    <pre><span class="lnum">  16:  </span>        {</pre>

    <pre class="alt"><span class="lnum">  17:  </span>            InitializeComponent();</pre>

    <pre><span class="lnum">  18:  </span>        }</pre>

    <pre class="alt"><span class="lnum">  19:  </span> </pre>

    <pre><span class="lnum">  20:  </span>        <span class="kwrd">static</span> <span class="kwrd">void</span> MyThread(<span class="kwrd">object</span> str)</pre>

    <pre class="alt"><span class="lnum">  21:  </span>        {</pre>

    <pre><span class="lnum">  22:  </span>            <span class="rem">// Faire le traitement dans le thread</span></pre>

    <pre class="alt"><span class="lnum">  23:  </span>            Thread.Sleep(1000);</pre>

    <pre><span class="lnum">  24:  </span>        }</pre>

    <pre class="alt"><span class="lnum">  25:  </span> </pre>

    <pre><span class="lnum">  26:  </span>        <span class="kwrd">private</span> <span class="kwrd">void</span> button1_Click(<span class="kwrd">object</span> sender, EventArgs e)</pre>

    <pre class="alt"><span class="lnum">  27:  </span>        {</pre>

    <pre><span class="lnum">  28:  </span>            <span class="rem">// Initialisation des thread</span></pre>

    <pre class="alt"><span class="lnum">  29:  </span>            Thread T1;</pre>

    <pre><span class="lnum">  30:  </span>            Thread T2;</pre>

    <pre class="alt"><span class="lnum">  31:  </span>            Thread T3;</pre>

    <pre><span class="lnum">  32:  </span> </pre>

    <pre class="alt"><span class="lnum">  33:  </span>            ParameterizedThreadStart PTS = <span class="kwrd">new</span> ParameterizedThreadStart(MyThread);</pre>

    <pre><span class="lnum">  34:  </span>            T1 = <span class="kwrd">new</span> Thread(PTS);</pre>

    <pre class="alt"><span class="lnum">  35:  </span>            T2 = <span class="kwrd">new</span> Thread(PTS);</pre>

    <pre><span class="lnum">  36:  </span>            T3 = <span class="kwrd">new</span> Thread(PTS);</pre>

    <pre class="alt"><span class="lnum">  37:  </span> </pre>

    <pre><span class="lnum">  38:  </span>            <span class="rem">// Execution des threads</span></pre>

    <pre class="alt"><span class="lnum">  39:  </span>            T1.Start(<span class="str">&quot;File1qui est plus long que 16 caraecteres&quot;</span>);</pre>

    <pre><span class="lnum">  40:  </span>            T2.Start(<span class="str">&quot;File2&quot;</span>);</pre>

    <pre class="alt"><span class="lnum">  41:  </span>            T3.Start(<span class="str">&quot;File3&quot;</span>);</pre>

    <pre><span class="lnum">  42:  </span> </pre>

    <pre class="alt"><span class="lnum">  43:  </span>            <span class="rem">// Attendre la fin de l'execution des threads</span></pre>

    <pre><span class="lnum">  44:  </span>            T1.Join();</pre>

    <pre class="alt"><span class="lnum">  45:  </span>            T2.Join();</pre>

    <pre><span class="lnum">  46:  </span>            T3.Join();</pre>

    <pre class="alt"><span class="lnum">  47:  </span>        }</pre>

    <pre><span class="lnum">  48:  </span>    }</pre>

    <pre class="alt"><span class="lnum">  49:  </span>}</pre>
  </div>

  <p> </p>

  <p><a href="/blog/cpe/Lists/Billets/Attachments/4/T1_2_17E62D87.png"><img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px" title="T1" border="0" alt="T1" src="/blog/cpe/Lists/Billets/Attachments/4/T1_thumb_17E62D87.png" width="672" height="360" /></a></p>

  <p><a href="/blog/cpe/Lists/Billets/Attachments/4/T1_1_2_17E62D87.png"><img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px" title="T1_1" border="0" alt="T1_1" src="/blog/cpe/Lists/Billets/Attachments/4/T1_1_thumb_17E62D87.png" width="672" height="54" /></a></p>

  <p> </p>

  <p>Le debugger va afficher les threads, le nom de la fonction… Mais il n’y a pas d’indication contextuelle. C’est au développeur de s’y retrouver, en basculant d’un thread à un autre.</p>

  <p>Le Framework .NET permet de donner un nom a chaque thread grâce a la propriété “Thread.CurrentThread.Name”</p>

  <p> </p>

  <p>Voici la modification du code du thread:</p>

  <div class="csharpcode">
    <pre class="alt"><span class="lnum">   1:  </span><span class="kwrd">static</span> <span class="kwrd">void</span> MyThread(<span class="kwrd">object</span> str)</pre>

    <pre><span class="lnum">   2:  </span>{</pre>

    <pre class="alt"><span class="lnum">   3:  </span>    Thread.CurrentThread.Name = (<span class="kwrd">string</span>)str;</pre>

    <pre><span class="lnum">   4:  </span>    <span class="rem">// Faire le traitement dans le thread</span></pre>

    <pre class="alt"><span class="lnum">   5:  </span>    Thread.Sleep(1000);</pre>

    <pre><span class="lnum">   6:  </span>}</pre>
  </div>

  <p> </p>

  <p>De cette manière, le debugger va afficher le nom, permettant en un seul coup d’œil de s’y retrouver.</p>

  <p> </p>

  <p><a href="/blog/cpe/Lists/Billets/Attachments/4/T2_2_17E62D87.png"><img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px" title="T2" border="0" alt="T2" src="/blog/cpe/Lists/Billets/Attachments/4/T2_thumb_17E62D87.png" width="672" height="360" /></a></p>

  <p><a href="/blog/cpe/Lists/Billets/Attachments/4/T2_1_2_17E62D87.png"><img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px" title="T2_1" border="0" alt="T2_1" src="/blog/cpe/Lists/Billets/Attachments/4/T2_1_thumb_17E62D87.png" width="672" height="54" /></a></p>

  <p> </p>

  <p>Le Framework .NET permet de le faire aisément via une propriété. Pour les développeur c/c++, il n’y a pas de propriété! Mais la même fonctionnalité est possible.</p>

  <p> </p>

  <p>Voici le code similaire écrit en c/c++ :</p>

  <div class="csharpcode">
    <pre class="alt"><span class="lnum">   1:  </span>#include <span class="str">&quot;stdafx.h&quot;</span></pre>

    <pre><span class="lnum">   2:  </span>#include &lt;Windows.h&gt;</pre>

    <pre class="alt"><span class="lnum">   3:  </span> </pre>

    <pre><span class="lnum">   4:  </span>DWORD WINAPI MyThread( <span class="kwrd">void</span>* v )</pre>

    <pre class="alt"><span class="lnum">   5:  </span>{</pre>

    <pre><span class="lnum">   6:  </span>    <span class="kwrd">const</span> DWORD MS_VC_EXCEPTION=0x406D1388;</pre>

    <pre class="alt"><span class="lnum">   7:  </span> </pre>

    <pre><span class="lnum">   8:  </span>    <span class="preproc">#pragma</span> pack(push,8)</pre>

    <pre class="alt"><span class="lnum">   9:  </span>    typedef <span class="kwrd">struct</span> tagTHREADNAME_INFO</pre>

    <pre><span class="lnum">  10:  </span>    {</pre>

    <pre class="alt"><span class="lnum">  11:  </span>        DWORD dwType; <span class="rem">// Must be 0x1000.</span></pre>

    <pre><span class="lnum">  12:  </span>        LPCSTR szName; <span class="rem">// Pointer to name (in user addr space).</span></pre>

    <pre class="alt"><span class="lnum">  13:  </span>        DWORD dwThreadID; <span class="rem">// Thread ID (-1=caller thread).</span></pre>

    <pre><span class="lnum">  14:  </span>        DWORD dwFlags; <span class="rem">// Reserved for future use, must be zero.</span></pre>

    <pre class="alt"><span class="lnum">  15:  </span>    } THREADNAME_INFO;</pre>

    <pre><span class="lnum">  16:  </span>    <span class="preproc">#pragma</span> pack(pop)</pre>

    <pre class="alt"><span class="lnum">  17:  </span> </pre>

    <pre><span class="lnum">  18:  </span>    THREADNAME_INFO info;</pre>

    <pre class="alt"><span class="lnum">  19:  </span>    info.dwType = 0x1000;</pre>

    <pre><span class="lnum">  20:  </span>    info.szName = (LPCSTR)v;</pre>

    <pre class="alt"><span class="lnum">  21:  </span>    info.dwThreadID = GetCurrentThreadId();</pre>

    <pre><span class="lnum">  22:  </span>    info.dwFlags = 0;</pre>

    <pre class="alt"><span class="lnum">  23:  </span> </pre>

    <pre><span class="lnum">  24:  </span>    __try</pre>

    <pre class="alt"><span class="lnum">  25:  </span>    {</pre>

    <pre><span class="lnum">  26:  </span>        RaiseException( MS_VC_EXCEPTION, 0, <span class="kwrd">sizeof</span>(info)/<span class="kwrd">sizeof</span>(ULONG_PTR), (ULONG_PTR*)&amp;info );</pre>

    <pre class="alt"><span class="lnum">  27:  </span>    }</pre>

    <pre><span class="lnum">  28:  </span>    __except(EXCEPTION_EXECUTE_HANDLER)</pre>

    <pre class="alt"><span class="lnum">  29:  </span>    {</pre>

    <pre><span class="lnum">  30:  </span>    }</pre>

    <pre class="alt"><span class="lnum">  31:  </span> </pre>

    <pre><span class="lnum">  32:  </span>    Sleep( 1000 );</pre>

    <pre class="alt"><span class="lnum">  33:  </span>    <span class="kwrd">return</span> 0;</pre>

    <pre><span class="lnum">  34:  </span>}</pre>

    <pre class="alt"><span class="lnum">  35:  </span> </pre>

    <pre><span class="lnum">  36:  </span><span class="kwrd">int</span> _tmain(<span class="kwrd">int</span> argc, _TCHAR* argv[])</pre>

    <pre class="alt"><span class="lnum">  37:  </span>{</pre>

    <pre><span class="lnum">  38:  </span>    DWORD    dw;</pre>

    <pre class="alt"><span class="lnum">  39:  </span>    HANDLE T[3];</pre>

    <pre><span class="lnum">  40:  </span>    T[0] = CreateThread( NULL, 0, MyThread, (LPVOID)<span class="str">&quot;File1&quot;</span>, 0, &amp;dw );</pre>

    <pre class="alt"><span class="lnum">  41:  </span>    T[1] = CreateThread( NULL, 0, MyThread, (LPVOID)<span class="str">&quot;File2&quot;</span>, 0, &amp;dw );</pre>

    <pre><span class="lnum">  42:  </span>    T[2] = CreateThread( NULL, 0, MyThread, (LPVOID)<span class="str">&quot;File3&quot;</span>, 0, &amp;dw );</pre>

    <pre class="alt"><span class="lnum">  43:  </span> </pre>

    <pre><span class="lnum">  44:  </span>    WaitForMultipleObjects( 3, T, TRUE, INFINITE );</pre>

    <pre class="alt"><span class="lnum">  45:  </span> </pre>

    <pre><span class="lnum">  46:  </span>    CloseHandle( T[2] );</pre>

    <pre class="alt"><span class="lnum">  47:  </span>    CloseHandle( T[1] );</pre>

    <pre><span class="lnum">  48:  </span>    CloseHandle( T[0] );</pre>

    <pre class="alt"><span class="lnum">  49:  </span>    <span class="kwrd">return</span> 0;</pre>

    <pre><span class="lnum">  50:  </span>}</pre>
  </div>

  <p> </p>

  <p><a href="/blog/cpe/Lists/Billets/Attachments/4/T3_2_056595B3.png"><img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px" title="T3" border="0" alt="T3" src="/blog/cpe/Lists/Billets/Attachments/4/T3_thumb_056595B3.png" width="672" height="360" /></a></p>

  <p><a href="/blog/cpe/Lists/Billets/Attachments/4/T3_1_2_056595B3.png"><img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px" title="T3_1" border="0" alt="T3_1" src="/blog/cpe/Lists/Billets/Attachments/4/T3_1_thumb_056595B3.png" width="672" height="82" /></a></p>

  <p> </p>

  <p>Bon debugging</p>
</div></div>
<div><b>Pièces jointes:</b> <a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T1_1_2_17E62D87.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T1_1_2_17E62D87.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T1_1_thumb_17E62D87.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T1_1_thumb_17E62D87.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T1_2_17E62D87.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T1_2_17E62D87.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T1_thumb_17E62D87.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T1_thumb_17E62D87.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T2_1_2_17E62D87.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T2_1_2_17E62D87.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T2_1_thumb_17E62D87.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T2_1_thumb_17E62D87.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T2_2_17E62D87.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T2_2_17E62D87.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T2_thumb_17E62D87.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T2_thumb_17E62D87.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T3_1_2_056595B3.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T3_1_2_056595B3.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T3_1_thumb_056595B3.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T3_1_thumb_056595B3.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T3_2_056595B3.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T3_2_056595B3.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T3_thumb_056595B3.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/4/T3_thumb_056595B3.png</a><br /><a href=""></a></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>Debugging; C++; .Net; Threading</category>
      <pubDate>Fri, 04 May 2012 09:20:27 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=4</guid>
    </item>
    <item>
      <title>Presentation Windows Phone 7 pour DotNetHub</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=10</link>
      <description><![CDATA[<div><b>Publié:</b> 06/05/2011 12:37</div>
<div><b>Titre:</b> Presentation Windows Phone 7 pour DotNetHub</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*">Windows Phone 7</a></div>
<div><b>Corps:</b> <div class="ExternalClassC9F9D48742A44DC785A3D91D865D5657"><p>Les informations sur la présentation sur leur <a href="http://www.dotnethub.be/events/20/introduction-au-developpement-avec-windows-phone-7.aspx">site</a>.</p></div></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>Windows Phone 7</category>
      <pubDate>Fri, 04 May 2012 09:20:26 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=10</guid>
    </item>
    <item>
      <title>Channel 9 - Integrating Bing Maps into your Windows Phone 7.5 Applications</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=9</link>
      <description><![CDATA[<div><b>Publié:</b> 17/10/2011 12:42</div>
<div><b>Titre:</b> Channel 9 - Integrating Bing Maps into your Windows Phone 7.5 Applications</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*">Windows Phone 7</a></div>
<div><b>Corps:</b> <div class="ExternalClassE19CEA4A07AF44D49BD6B6FC84AAB706"><p>Mon MSDN Live Meeting du 11 Octobre est en ligne sur channel9.</p>  <p>Vous pouvez le suivre en ligne <a href="http://channel9.msdn.com/Blogs/adebruyn/Integrating-Bing-Maps-into-your-Windows-Phone-75-Applications">ici</a>, et télécharger le code source <a href="/blog/cpe/Documents/Source%20Code%20Integrating%20Bing%20Maps%20into%20your%20Windows%20Phone%207.5%20Applications.zip">ici</a>.</p>  <p> </p>  <p>My MSDN Live Meeting of October 11 is online at Channel9.</p>  <p>You can follow him online <a href="http://channel9.msdn.com/Blogs/adebruyn/Integrating-Bing-Maps-into-your-Windows-Phone-75-Applications">here</a> and download the source code <a href="/blog/cpe/Documents/Source%20Code%20Integrating%20Bing%20Maps%20into%20your%20Windows%20Phone%207.5%20Applications.zip">here</a>.</p></div></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>Windows Phone 7</category>
      <pubDate>Fri, 04 May 2012 09:20:27 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=9</guid>
    </item>
    <item>
      <title>Windows Phone 7.5 Academic Tour.</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=7</link>
      <description><![CDATA[<div><b>Publié:</b> 18/10/2011 16:33</div>
<div><b>Titre:</b> Windows Phone 7.5 Academic Tour.</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*">Windows Phone 7</a></div>
<div><b>Corps:</b> <div class="ExternalClass3735E5005D7744A393D653FACE2E83E3">   <p>L'académique tour a commencé. David Hernie vous en avait parlé sur son <a href="/blog/dhe/Lists/Billets/Post.aspx?ID=55">blog</a>. </p>    <p>Les slides sont disponible <a href="/blog/cpe/Documents/WP75%20Academic%20RoadShow.pptx">ici</a>. </p>    <p>Lors de la session, plusieurs démonstrations sont réalisées. Je vous invite à trouver les « post » permettant de refaire certaines de ces démonstrations. </p>    <ul>     <li><a href="/blog/cpe/Lists/Billets/Post.aspx?ID=5">Démonstration accéléromètre.</a></li>      <li><a href="/blog/cpe/Lists/Billets/Post.aspx?ID=6">Démonstration GPS</a>. </li>   </ul>    <p>Pour l'aspect pratique, vous avez besoin des outils de développement. Ceux-ci peuvent être téléchargés <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=27570">ici</a>. </p>    <p>Si vous voulez plus de lien concernant le développement Windows Phone, je vous conseille cet <a href="/blog/dhe/Lists/Billets/Post.aspx?ID=45">article de David</a>. </p>    <p> </p>    <p>The academic tour began. David Hernie already talked about on his <a href="/blog/dhe/Lists/Billets/Post.aspx?ID=55">blog</a>. </p>    <p>The slides are available <a href="/blog/cpe/Documents/WP75%20Academic%20RoadShow.pptx">here</a>. </p>    <p>During the session, several demonstrations are conducted. I invite you to find the &quot;post&quot; to redo some of these demonstrations. </p>    <ul>     <li><a href="/blog/cpe/Lists/Billets/Post.aspx?ID=5">Demonstration accelerometer</a>. </li>      <li><a href="/blog/cpe/Lists/Billets/Post.aspx?ID=6">Demonstration GPS</a>. </li>   </ul>    <p>For convenience, you need development tools. These can be downloaded <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=27570">here</a>. </p>    <p>If you want more links on the Windows Phone development, I recommend this <a href="/blog/dhe/Lists/Billets/Post.aspx?ID=45">article from David</a>.</p> </div></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>Windows Phone 7</category>
      <pubDate>Fri, 04 May 2012 09:20:27 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=7</guid>
    </item>
    <item>
      <title>Accelerometer – Windows Phone 7 – Step by step</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=5</link>
      <description><![CDATA[<div><b>Publié:</b> 19/10/2011 12:32</div>
<div><b>Titre:</b> Accelerometer – Windows Phone 7 – Step by step</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*">Windows Phone 7</a></div>
<div><b>Corps:</b> <div class="ExternalClassD5DFEDE7E0F449C5AD913B852E36D639"><p class="ExternalClass860CFE6268BF44FBA112F4C45BFB8AC5"><span style="font-family:times new roman;font-size:12pt">Dans le cadre des sessions sur Windows Phone 7.5, les démonstrations peuvent être reproduites en suivant les étapes décrites ci-dessous. </span></p>  <p class="ExternalClass860CFE6268BF44FBA112F4C45BFB8AC5"><span style="font-family:times new roman;font-size:12pt">Les outils sont téléchargeable gratuitement via le lien suivant : <a href="http://create.msdn.com">http://create.msdn.com</a>. </span></p>  <p class="ExternalClass860CFE6268BF44FBA112F4C45BFB8AC5"> </p>  <p class="ExternalClass860CFE6268BF44FBA112F4C45BFB8AC5"><span style="font-family:times new roman;font-size:12pt"><span style="background-color:white;color:#333333"><em>As part of the sessions on Windows Phone 7.5, the demonstrations may be reproduced by following the steps below. </em></span></span></p>  <p class="ExternalClass860CFE6268BF44FBA112F4C45BFB8AC5"><span style="font-family:times new roman;font-size:12pt"><em><span style="background-color:white;color:#333333">The tools are downloadable for free via the following link</span>:</em> <a href="http://create.msdn.com">http://create.msdn.com</a>. </span></p>  <p class="ExternalClass860CFE6268BF44FBA112F4C45BFB8AC5"> </p>  <p class="ExternalClass860CFE6268BF44FBA112F4C45BFB8AC5"><span style="font-family:times new roman;font-size:12pt"><u>Démonstration: utilisation de l'accéléromètre </u></span></p>  <p class="ExternalClass860CFE6268BF44FBA112F4C45BFB8AC5"><span style="font-family:times new roman;font-size:12pt"><em><u>Demonstration: using the accelerometer</u> </em></span></p>  <div class="ExternalClass860CFE6268BF44FBA112F4C45BFB8AC5">   <ul>     <li>Créez un nouveau projet « Silverlight for Windows Phone - Windows Phone Application ». </li>      <li><em>Create a new &quot;Silverlight for Windows Phone - Windows Phone Application&quot; project. </em></li>   </ul> </div>  <p><img alt="" src="/blog/cpe/Lists/Photos/102011_1006_Acceleromet1.png" /><span style="font-family:times new roman;font-size:12pt">      <br clear="all" /></span></p>  <ul>   <li>Sélectionnez la plateforme cible 7.1. </li>    <li><em>Select the target OS 7.1. </em></li> </ul>  <p><img alt="" src="/blog/cpe/Lists/Photos/102011_1006_Acceleromet2.png" /><span style="font-family:times new roman;font-size:12pt">      <br clear="all" /></span></p>  <ul>   <li>Dans la page principale, rajouter via la « Toolbox », un objet de type image. Associer via la propriété « source » une image. </li>    <li><em>In the main page, add through the &quot;Toolbox&quot;, an object of type image. Link, through the « source » property, an image. </em></li> </ul>  <p><img alt="" src="/blog/cpe/Lists/Photos/102011_1006_Acceleromet3.png" /><span style="font-family:times new roman;font-size:12pt">      <br clear="all" /></span></p>  <ul>   <li>Rajouter le code suivant dans le XAML de l'image. </li>    <li><em>Add the following code inside the Image in the XAML. </em></li> </ul>  <pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">&lt;</span><span style="color:#800000">Image</span> ………<span style="color:#0000ff">&gt;</span>  
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#0000ff">&lt;</span><span style="color:#800000">Image.Projection</span><span style="color:#0000ff">&gt;</span> 
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">         <span style="color:#0000ff">&lt;</span><span style="color:#800000">PlaneProjection</span> <span style="color:#ff0000">x</span>:<span style="color:#ff0000">Name</span>=<span style="color:#0000ff">&quot;Proj&quot;</span><span style="color:#0000ff">&gt;</span>  
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">         <span style="color:#0000ff">&lt;/</span><span style="color:#800000">PlaneProjection</span><span style="color:#0000ff">&gt;</span> 
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#0000ff">&lt;/</span><span style="color:#800000">Image.Projection</span><span style="color:#0000ff">&gt;</span> 
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">&lt;/</span><span style="color:#800000">Image</span><span style="color:#0000ff">&gt;</span></pre></pre>

<ul>
  <li>Dans le projet, ajoutez une référence vers « Microsoft.devices.Sensors ». </li>

  <li><em>Inside the project, add a reference to « Microsoft.devices.Sensors ». </em></li>

  <li>Dans le code, créez un objet de type « <a href="http://msdn.microsoft.com/en-us/library/microsoft.devices.sensors.accelerometer(v=vs.92).aspx">Accelerometer<span style="color:blue;text-decoration:underline"><em> </em></span></a>». </li>

  <li><em>Inside the code, create an object of type « <a href="http://msdn.microsoft.com/en-us/library/microsoft.devices.sensors.accelerometer(v=vs.92).aspx">Accelerometer </a>».</em></li>
</ul>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">Accelerometer acc = <span style="color:#0000ff">new</span> Accelerometer();</pre></pre>

<ul>
  <li>Dans le constructeur de la page, rajouter l'évènement « <a href="http://msdn.microsoft.com/en-us/library/microsoft.devices.sensors.accelerometer.readingchanged(v=VS.92).aspx">ReadingChanged </a>» et appelez la méthode « <a href="http://msdn.microsoft.com/en-us/library/microsoft.devices.sensors.accelerometer.start(v=VS.92).aspx">Start </a>» sur l'objet accéléromètre. </li>

  <li><em>In the constructor of the page, add the event &quot;<a href="http://msdn.microsoft.com/en-us/library/microsoft.devices.sensors.accelerometer.readingchanged(v=VS.92).aspx">ReadingChanged</a>&quot; and call the &quot;<a href="http://msdn.microsoft.com/en-us/library/microsoft.devices.sensors.accelerometer.start(v=VS.92).aspx">Start</a>&quot; method on the accelerometer object.</em></li>
</ul>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#008000">// Constructor </span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">public</span> MainPage() 
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{  
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    InitializeComponent();  
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    acc.ReadingChanged += <span style="color:#0000ff">new</span> EventHandler&lt;AccelerometerReadingEventArgs&gt;(acc_ReadingChanged);  
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    acc.Start(); 
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}
</pre></pre>

<ul>
  <li>Dans l'évènement &quot;<a href="http://msdn.microsoft.com/en-us/library/microsoft.devices.sensors.accelerometer.readingchanged(v=VS.92).aspx">ReadingChanged </a>&quot;, implémentez la projection sur l'image. </li>

  <li><em>In the event &quot;<a href="http://msdn.microsoft.com/en-us/library/microsoft.devices.sensors.accelerometer.readingchanged(v=VS.92).aspx">ReadingChanged</a>&quot;, implement the projection onto the image.</em></li>
</ul>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">void</span> acc_ReadingChanged(<span style="color:#0000ff">object</span> sender, AccelerometerReadingEventArgs e) 
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{  
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    Dispatcher.BeginInvoke(() =&gt;  
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        {  
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            Proj.RotationX = e.Z * 90;  
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            Proj.RotationZ = e.X * -90;  
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        }); 
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre>

<ul>
  <li>Compilez et testez dans l'émulateur. </li>

  <li><em>Compile and test inside the emulator. </em></li>
</ul>

<p><img alt="" src="/blog/cpe/Lists/Photos/102011_1006_Acceleromet4.png" /><img alt="" src="/blog/cpe/Lists/Photos/102011_1006_Acceleromet5.png" /></p></div></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>Windows Phone 7</category>
      <pubDate>Fri, 04 May 2012 09:20:27 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=5</guid>
    </item>
    <item>
      <title>GPS – Windows Phone 7 – Step by step</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=6</link>
      <description><![CDATA[<div><b>Publié:</b> 19/10/2011 16:17</div>
<div><b>Titre:</b> GPS – Windows Phone 7 – Step by step</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*">Windows Phone 7</a></div>
<div><b>Corps:</b> <div class="ExternalClassFE9C7DE8002C40A88A5A23A82B73FD05"><p class="ExternalClassFE74F2B471D24C8492F875F1C49B0EB6">Dans le cadre des sessions sur Windows Phone 7.5, les démonstrations peuvent être reproduites en suivant les étapes décrites ci-dessous. </p>  <p class="ExternalClassFE74F2B471D24C8492F875F1C49B0EB6">Les outils sont téléchargeable gratuitement via le lien suivant : <a href="http://create.msdn.com">http://create.msdn.com</a>. </p>  <p class="ExternalClassFE74F2B471D24C8492F875F1C49B0EB6"> </p>  <p class="ExternalClassFE74F2B471D24C8492F875F1C49B0EB6"><span style="background-color:white;color:#333333"><em>As part of the sessions on Windows Phone 7.5, the demonstrations may be reproduced by following the steps below. </em></span></p>  <p class="ExternalClassFE74F2B471D24C8492F875F1C49B0EB6"><em><span style="background-color:white;color:#333333">The tools are downloadable for free via the following link</span>:</em> <a href="http://create.msdn.com">http://create.msdn.com</a>. </p>  <p class="ExternalClassFE74F2B471D24C8492F875F1C49B0EB6"> </p>  <p class="ExternalClassFE74F2B471D24C8492F875F1C49B0EB6"><u>Démonstration: utilisation du GPS </u></p>  <p class="ExternalClassFE74F2B471D24C8492F875F1C49B0EB6"><em><u>Demonstration: using the GPS</u> </em></p>  <div class="ExternalClassFE74F2B471D24C8492F875F1C49B0EB6">   <ul>     <li>Créez un nouveau projet « Silverlight for Windows Phone - Windows Phone Application ». </li>      <li><em>Create a new &quot;Silverlight for Windows Phone - Windows Phone Application&quot; project. </em></li>   </ul> </div>  <p style="text-align:center" align="left"><img style="display:inline;float:left" alt="" align="left" src="/blog/cpe/Lists/Photos/102011_1306_GPSWindowsP1.png" />     <br clear="all" /></p>  <ul>   <li>Sélectionnez la plateforme cible 7.1. </li>    <li><em>Select the target OS 7.1. </em></li> </ul>  <p style="text-align:center"><img style="display:inline;float:left" alt="" align="left" src="/blog/cpe/Lists/Photos/102011_1306_GPSWindowsP2.png" />     <br clear="all" /></p>  <ul>   <li>Dans la page principale, rajouter via la « Toolbox », un objet de type « map ». Associer via la propriété « source » une image. </li>    <li><em>In the main page, add through the &quot;Toolbox&quot;, an object of type &quot;map&quot;. Link, through the « source » property, an image. </em></li> </ul>  <p style="text-align:center"><img style="display:inline;float:left" alt="" align="left" src="/blog/cpe/Lists/Photos/102011_1306_GPSWindowsP3.png" />     <br clear="all" /></p>  <ul>   <li>Rajouter la propriété « ZoomLevel » Sur l'objet map. </li>    <li><em>Add the &quot;ZoomLevel&quot; property to the map object. </em></li> </ul>  <pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">ZoomLevel=&quot;<span style="color:#8b0000">16</span>&quot;</pre></pre>

<ul>
  <li>Dans le code, créez un objet de type « <a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher(v=vs.92).aspx">GeoCoordinateWatcher</a> ». </li>

  <li><em>Inside the code, create an object of type « <a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher(v=vs.92).aspx">GeoCoordinateWatcher</a></em> <em>».</em></li>
</ul>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">GeoCoordinateWatcher geoWatcher = <span style="color:#0000ff">new</span> GeoCoordinateWatcher();</pre></pre>

<ul>
  <li>Dans le constructeur de la page, rajouter l'évènement «<a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.positionchanged(v=VS.92).aspx">PositionChanged</a>» et appelez la méthode « <a href="http://msdn.microsoft.com/en-us/library/ee808853(v=VS.92).aspx">Start </a>» sur l'objet <a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher(v=vs.92).aspx">GeoCoordinateWatcher</a>. </li>

  <li><em>In the constructor of the page, add the event &quot;<a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.positionchanged(v=VS.92).aspx">PositionChanged</a><em>&quot; and call the &quot;</em><a href="http://msdn.microsoft.com/en-us/library/ee808853(v=VS.92).aspx">Start</a>&quot; method on the </em><a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher(v=vs.92).aspx">GeoCoordinateWatcher</a> <em>object.</em></li>
</ul>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#008000">// Constructor</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">public</span> MainPage()
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     InitializeComponent();
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     geoWatcher.PositionChanged += <span style="color:#0000ff">new</span> EventHandler&lt;GeoPositionChangedEventArgs&lt;GeoCoordinate&gt;&gt;(geoWatcher_PositionChanged);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     geoWatcher.Start();
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}
</pre></pre>

<ul>
  <li>Dans l'évènement &quot;<a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.positionchanged(v=VS.92).aspx">PositionChanged</a>&quot;, implémentez la projection sur l'objet <a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher(v=vs.92).aspx">GeoCoordinateWatcher</a>. </li>

  <li><em>In the event &quot;<a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher.positionchanged(v=VS.92).aspx">PositionChanged</a>&quot;, implement the projection onto the <a href="http://msdn.microsoft.com/en-us/library/system.device.location.geocoordinatewatcher(v=vs.92).aspx">GeoCoordinateWatcher</a> object. </em></li>
</ul>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">void</span> geoWatcher_PositionChanged(<span style="color:#0000ff">object</span> sender, GeoPositionChangedEventArgs&lt;GeoCoordinate&gt; e)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     Dispatcher.BeginInvoke(() =&gt;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          map1.Center = e.Position.Location;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     });
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre>

<ul>
  <li>Compilez et testez dans l'émulateur. </li>

  <li><em>Compile and test inside the emulator. </em></li>
</ul>

<p style="text-align:center"><img style="display:inline;float:left" alt="" align="left" src="/blog/cpe/Lists/Photos/102011_1306_GPSWindowsP4.png" /><img style="display:inline;float:left" alt="" align="left" src="/blog/cpe/Lists/Photos/102011_1306_GPSWindowsP5.png" /><em> </em></p>

<br clear="all" />

<p> </p>

<p>Attention: La couverture GPS n'est pas garantie. Il est à la responsabilité du développeur d'en tenir compte dans son développement. De même, l'objet « Map » nécessite une connexion data. </p>

<p>Warning: The GPS coverage is not guaranteed. It is the responsibility of the developer to take this into account in its development. Similarly, the object &quot;Map&quot; requires a data connection.</p></div></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>Windows Phone 7</category>
      <pubDate>Fri, 04 May 2012 09:20:27 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=6</guid>
    </item>
    <item>
      <title>Formater du code source dans les Blogs</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=8</link>
      <description><![CDATA[<div><b>Publié:</b> 20/10/2011 16:39</div>
<div><b>Titre:</b> Formater du code source dans les Blogs</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=9&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=9&RootFolder=*">Tools</a></div>
<div><b>Corps:</b> <div class="ExternalClass3B99CD095EA74FE897ECD940B5E1FDBA"><p>En écrivant les derniers articles, je voulais formater le code source example.</p>  <p>Après quelques recherches, je suis “tombé” sur un “add-on” pour Windows Live Writer.</p>  <p>Content du service offert, je vous partage le lien : <a title="http://www.amergerzic.com/post/WLWSourceCodePlugin.aspx" href="http://www.amergerzic.com/post/WLWSourceCodePlugin.aspx">http://www.amergerzic.com/post/WLWSourceCodePlugin.aspx</a></p></div></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>Tools</category>
      <pubDate>Fri, 04 May 2012 09:20:27 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=8</guid>
    </item>
    <item>
      <title>Testez Windows Phone 7.5 depuis Android ou iOS</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=11</link>
      <description><![CDATA[<div><b>Publié:</b> 30/11/2011 08:33</div>
<div><b>Titre:</b> Testez Windows Phone 7.5 depuis Android ou iOS</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Corps:</b> <div class="ExternalClass53817532BCE94F0599B4FCC5CD231411"><p>Il suffit d’aller sur le lien <a href="http://aka.ms/wpdemo">http://aka.ms/wpdemo</a> via le navigateur internet de votre smartphone iOS ou Android. Une émulation de WP7.5 se met alors à tourner</p></div></div>
]]></description>
      <author>Christophe Peerens</author>
      <pubDate>Fri, 04 May 2012 09:20:26 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=11</guid>
    </item>
    <item>
      <title>Comment [éviter de] perdre du temps pour une bêtise.</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=12</link>
      <description><![CDATA[<div><b>Publié:</b> 06/03/2012 16:42</div>
<div><b>Titre:</b> Comment [éviter de] perdre du temps pour une bêtise.</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*">Windows Phone 7</a>; <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=7&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=7&RootFolder=*">Debugging</a>; <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=4&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=4&RootFolder=*">.Net</a>; <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=10&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=10&RootFolder=*">MVVM</a></div>
<div><b>Corps:</b> <div class="ExternalClass0762EC574D0D4CE18B43CC9C0E9C82CC"><p>Je viens de perdre du temps à cause d’une bêtise !</p>  <p>Visual Studio permet de changer le nom d’une variable très facilement. Cela se fait via clic droit sur la variable -&gt; refactor -&gt; rename.</p>  <p>Jusque-là, pas de soucis <img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="/blog/cpe/Lists/Billets/Attachments/12/wlEmoticon-smile_2_0C4D8AD7.png" /></p>  <p>Après je teste mon application, et mon UI ne se met pas à jour comme avant. Ayant rajouté du code, je commence à debugger… Pour en arriver à me rendre compte que « NotifyPropertyChanged » et « NotifyPropertyChanged » ne renvoient pas la bonne propriété.</p>  <p> </p>  <p>Example:</p>  <ul>   <li>Avant le “rename”</li> </ul>  <pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">private</span> <span style="color:#0000ff">string</span> _City;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> Citty
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">get</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          <span style="color:#0000ff">return</span> _City;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">set</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          <span style="color:#0000ff">if</span> (_City != <span style="color:#0000ff">value</span>)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               NotifyPropertyChanging(&quot;<span style="color:#8b0000">Citty</span>&quot;);
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               _City = <span style="color:#0000ff">value</span>;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               NotifyPropertyChanged(&quot;<span style="color:#8b0000">Citty</span>&quot;);
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre>

<ul>
  <li>Après le “rename”</li>
</ul>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">private</span> <span style="color:#0000ff">string</span> _City;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">public</span> <span style="color:#0000ff">string</span> City
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">get</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          <span style="color:#0000ff">return</span> _City;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">set</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          <span style="color:#0000ff">if</span> (_City != <span style="color:#0000ff">value</span>)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               NotifyPropertyChanging(&quot;<span style="color:#8b0000">Citty</span>&quot;);
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               _City = <span style="color:#0000ff">value</span>;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               NotifyPropertyChanged(&quot;<span style="color:#8b0000">Citty</span>&quot;);
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre>

<p>Le “rename” n’a pas changé le nom de la propriété dans les fonctions “NotifyPropertyChangXXX”!</p>

<p> </p>

<p>Une petite recherche pour trouver un code qui permet de faire le check automatique si la propriété existe m’a mené <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx">ici</a>.</p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">[Conditional(&quot;<span style="color:#8b0000">DEBUG</span>&quot;)]
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">[DebuggerStepThrough]
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">public</span> <span style="color:#0000ff">void</span> VerifyPropertyName(<span style="color:#0000ff">string</span> propertyName)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#008000">// Verify that the property name matches a real,</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#008000">// public, instance property on this object.</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">if</span> (TypeDescriptor.GetProperties(<span style="color:#0000ff">this</span>)[propertyName] == <span style="color:#0000ff">null</span>)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          <span style="color:#0000ff">string</span> msg = &quot;<span style="color:#8b0000">Invalid property name: </span>&quot; + propertyName;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          <span style="color:#0000ff">if</span> (<span style="color:#0000ff">this</span>.ThrowOnInvalidPropertyName)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               <span style="color:#0000ff">throw</span> <span style="color:#0000ff">new</span> Exception(msg);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          <span style="color:#0000ff">else</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               Debug.Fail(msg);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre>

<p> </p>

<p>Mais cela ne fonctionne pas sous Windows Phone 7 <img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="/blog/cpe/Lists/Billets/Attachments/12/wlEmoticon-sadsmile_2_0C4D8AD7.png" />. L’objet “TypeDescriptor” n’existant pas sous Windows Phone 7!</p>

<p>L’adaptation pour Windows Phone :</p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">[Conditional(&quot;<span style="color:#8b0000">DEBUG</span>&quot;)]
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">[DebuggerStepThrough]
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">public</span> <span style="color:#0000ff">void</span> VerifyPropertyName(<span style="color:#0000ff">string</span> propertyName)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     PropertyInfo pinfo = <span style="color:#0000ff">this</span>.GetType().GetProperty(propertyName);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">if</span> (pinfo == <span style="color:#0000ff">null</span>)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          System.Diagnostics.Debugger.Break();
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre>

<p> </p>

<p>Il suffit de vérifier si la propriété existe dans les fonctions « NotifyPropertyChanged » et « NotifyPropertyChanged ».</p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> NotifyPropertyChanged(<span style="color:#0000ff">string</span> propertyName)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     VerifyPropertyName(propertyName);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">if</span> (PropertyChanged != <span style="color:#0000ff">null</span>)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          PropertyChanged(<span style="color:#0000ff">this</span>, <span style="color:#0000ff">new</span> PropertyChangedEventArgs(propertyName));
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> NotifyPropertyChanging(<span style="color:#0000ff">string</span> propertyName)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     VerifyPropertyName(propertyName);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">if</span> (PropertyChanging != <span style="color:#0000ff">null</span>)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          PropertyChanging(<span style="color:#0000ff">this</span>, <span style="color:#0000ff">new</span> PropertyChangingEventArgs(propertyName));
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre></div></div>
<div><b>Pièces jointes:</b> <a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/12/wlEmoticon-sadsmile_2_0C4D8AD7.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/12/wlEmoticon-sadsmile_2_0C4D8AD7.png</a><br /><a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/12/wlEmoticon-smile_2_0C4D8AD7.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/12/wlEmoticon-smile_2_0C4D8AD7.png</a><br /><a href=""></a></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>Windows Phone 7; Debugging; .Net; MVVM</category>
      <pubDate>Fri, 04 May 2012 09:20:26 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=12</guid>
    </item>
    <item>
      <title>Windows Phone 7–SkyDrive</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=13</link>
      <description><![CDATA[<div><b>Publié:</b> 07/03/2012 10:37</div>
<div><b>Titre:</b> Windows Phone 7–SkyDrive</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=4&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=4&RootFolder=*">.Net</a>; <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*">Windows Phone 7</a></div>
<div><b>Corps:</b> <div class="ExternalClass3D1771836B1245658BAC4B270180A49A"><p>Changeant de Windows Phone, je me suis posé la question sur le backup/restore d’un téléphone à un autre. Malheureusement, pas de possibilité de sauvegarder/backuper les données de mes applications/jeux.</p>  <p>Sur ce constat, j’ai exploré les possibilités pour m’appuyer sur SkyDrive. En effet, mon téléphone est connecté, via mon Live ID, sur les services Live de Microsoft. Donc, pourquoi ne pas permettre de faire un export de mes données sur SkyDrive, afin de les importer ultérieurement…</p>  <p>Première étape : visualiser mes fichiers sur SkyDrive depuis mon PC. Ayant trouvé un tutorial sur « MonWindowsPhone.com », je ne vais pas m’étendre plus sur le sujet, et je vous conseille d’aller jeter un œil sur l’article <a href="http://www.monwindowsphone.com/tuto-tout-savoir-sur-skydrive-le-disque-dur-en-ligne-de-microsoft-t5124.html">d’Arnaud Deschamps de MonWindowsPhone</a>. Il explique comment accéder à SkyDrive depuis son PC sans passer via un browser, ainsi que des intégrations de SkyDrive dans les applications “standard” du Windows Phone.</p>  <p>Deuxième étape : télécharger les Tools et SDK. Via le lien suivant, le <a href="http://msdn.microsoft.com/en-us/live/default">SDK</a> est téléchargeable, et la <a href="http://msdn.microsoft.com/en-us/live/default">documentation</a> disponible. Une documentation plus spécifique est disponible <a href="http://msdn.microsoft.com/en-us/live/hh561314">ici</a>.</p>  <p>Troisième étape : expérimenter l’accès à SkyDrive depuis mon Windows Phone.</p>  <p>Avant d’interagir avec les services Live, il faut s’authentifier. L’objet LiveAuthClient effectue cette opération en affichant à l’utilisateur un écran demandant le nom d’utilisateur et le mot de passe.</p>  <p>Remarque : l’authentification est interactive ! Donc pas moyen de faire une connexion dans un « Background Agent ». Il faut que la partie graphique de l’application soit initialisée, donc pas d’authentification dans les fonctions « Application_Launching », …</p>  <p>Le premier paramètre de LiveAuthClient définit l’identification du client (« ClientID »). Vous pouvez en générer un en suivant ce lien suivant : <a href="https://manage.dev.live.com/">https://manage.dev.live.com/</a>. Dans mon code exemple, je mets la valeur &quot;1234567890123456&quot;. L’event LoginCompleted retourne à l’application le résultat de l’authentification.</p>  <p> </p>  <pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">LiveAuthClient lac = <span style="color:#0000ff">new</span> LiveAuthClient(&quot;<span style="color:#8b0000">1234567890123456</span>&quot;, &quot;<span style="color:#8b0000">http://oauth.live.com/desktop</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> button1_Click(<span style="color:#0000ff">object</span> sender, RoutedEventArgs e)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     lac.LoginCompleted +=<span style="color:#0000ff">new</span> EventHandler&lt;LoginCompletedEventArgs&gt;(lac_LoginCompleted);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     List&lt;String&gt; l = <span style="color:#0000ff">new</span> List&lt;<span style="color:#0000ff">string</span>&gt;() { &quot;<span style="color:#8b0000">wl.basic</span>&quot;, &quot;<span style="color:#8b0000">wl.photos</span>&quot;, &quot;<span style="color:#8b0000">wl.skydrive</span>&quot;, &quot;<span style="color:#8b0000">wl.offline_access</span>&quot;, &quot;<span style="color:#8b0000">wl.signin</span>&quot;, &quot;<span style="color:#8b0000">wl.skydrive_update</span>&quot;};
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     lac.LoginAsync(l);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">void</span> lac_LoginCompleted(<span style="color:#0000ff">object</span> sender, LoginCompletedEventArgs e)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre>

<p> </p>

<p>Après l’authentification, l’accès aux fichiers. On énumère les objets dans la racine « me/skydrive » du SkyDrive. Le suffixe « /files » permet de récupérer les éléments.</p>

<p> </p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> EnumRootFolder_Click(<span style="color:#0000ff">object</span> sender, RoutedEventArgs e)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     LiveConnectClient clientFolder = <span style="color:#0000ff">new</span> LiveConnectClient(lac.Session);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     clientFolder.GetCompleted += <span style="color:#0000ff">new</span> EventHandler&lt;LiveOperationCompletedEventArgs&gt;(clientFolder_GetCompleted);
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     clientFolder.GetAsync(&quot;<span style="color:#8b0000">me/skydrive/files</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre>

<p> </p>

<p>En retour les services live renvoient la liste des éléments sous forme d’un fichier JSON. Ci-dessous une partie du résultat. (Les “------------ “ remplacent mes identifiants uniques)</p>

<p> </p>

<table border="1" cellspacing="0" cellpadding="0"><tbody>
    <tr>
      <td valign="top" width="614">
        <p>{</p>

        <p>&quot;data&quot;: [</p>

        <p>{</p>

        <p>&quot;id&quot;: &quot;folder. ------------.------------&quot;, </p>

        <p>&quot;from&quot;: {</p>

        <p>&quot;name&quot;: &quot;Christophe Peerens&quot;, </p>

        <p>&quot;id&quot;: &quot;------------&quot;</p>

        <p>}, </p>

        <p>&quot;name&quot;: &quot;Les puces et le chocolas&quot;, </p>

        <p>&quot;description&quot;: &quot;&quot;, </p>

        <p>&quot;parent_id&quot;: &quot;folder. ------------&quot;, </p>

        <p>&quot;upload_location&quot;: &quot;https://apis.live.net/v5.0/folder. ------------.------------!116/files/&quot;, </p>

        <p>&quot;is_embeddable&quot;: true, </p>

        <p>&quot;count&quot;: 1, </p>

        <p>&quot;link&quot;: &quot;https://skydrive.live.com/redir.aspx?cid\u003d------------\u0026page\u003dview\u0026resid\u003d------------!116\u0026parid\u003d------------!136&quot;, </p>

        <p>&quot;type&quot;: &quot;album&quot;, </p>

        <p>&quot;shared_with&quot;: {</p>

        <p>&quot;access&quot;: &quot;People with a link&quot;</p>

        <p>}, </p>

        <p>&quot;created_time&quot;: &quot;2007-01-02T13:58:27+0000&quot;, </p>

        <p>&quot;updated_time&quot;: &quot;2011-04-02T07:27:55+0000&quot;</p>

        <p>}, {</p>

        <p>&quot;id&quot;: &quot;folder. ------------.------------!137&quot;, </p>

        <p>&quot;from&quot;: {</p>

        <p>&quot;name&quot;: &quot;Christophe Peerens&quot;, </p>

        <p>&quot;id&quot;: &quot;------------&quot;</p>

        <p>}, </p>

        <p>&quot;name&quot;: &quot;Public&quot;, </p>

        <p>&quot;description&quot;: null, </p>

        <p>&quot;parent_id&quot;: &quot;folder. ------------&quot;, </p>

        <p>&quot;upload_location&quot;: &quot;https://apis.live.net/v5.0/folder. ------------.------------!137/files/&quot;, </p>

        <p>&quot;is_embeddable&quot;: true, </p>

        <p>&quot;count&quot;: 1, </p>

        <p>&quot;link&quot;: &quot;https://skydrive.live.com/redir.aspx?cid\u003d------------\u0026page\u003dview\u0026resid\u003d------------!137\u0026parid\u003d------------!136&quot;, </p>

        <p>&quot;type&quot;: &quot;folder&quot;, </p>

        <p>&quot;shared_with&quot;: {</p>

        <p>&quot;access&quot;: &quot;Everyone (public)&quot;</p>

        <p>}, </p>

        <p>&quot;created_time&quot;: &quot;2009-01-25T13:21:27+0000&quot;, </p>

        <p>&quot;updated_time&quot;: &quot;2011-05-18T07:08:33+0000&quot;</p>

        <p>}, {</p>

        <p>…</p>

        <p>}, {</p>

        <p>…</p>

        <p>}, {</p>

        <p>…</p>

        <p>}, {</p>

        <p>…</p>

        <p>}</p>

        <p>]</p>

        <p>}</p>
      </td>
    </tr>
  </tbody></table>

<p> </p>

<p>Dans l’event handler, le paramètre e donne le fichier JSON en format RAW, mais aussi une interprétation sous forme de collection de celui-ci. Une petite gymnastique de casting, et les informations sont disponibles.</p>

<p> </p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">void</span> clientFolder_GetCompleted(<span style="color:#0000ff">object</span> sender, LiveOperationCompletedEventArgs e)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">if</span> (e.Result != <span style="color:#0000ff">null</span>)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          <span style="color:#0000ff">foreach</span> (var o <span style="color:#0000ff">in</span> e.Result)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               <span style="color:#0000ff">foreach</span> (var oo <span style="color:#0000ff">in</span> ((System.Collections.Generic.List&lt;<span style="color:#0000ff">object</span>&gt;)(o.Value)))
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    System.Collections.Generic.Dictionary&lt;<span style="color:#0000ff">string</span>, <span style="color:#0000ff">object</span>&gt; entry = (System.Collections.Generic.Dictionary&lt;<span style="color:#0000ff">string</span>, <span style="color:#0000ff">object</span>&gt;)oo;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    String id = (<span style="color:#0000ff">string</span>)entry[&quot;<span style="color:#8b0000">id</span>&quot;];
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    String name = (<span style="color:#0000ff">string</span>)entry[&quot;<span style="color:#8b0000">name</span>&quot;];
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    String type = (<span style="color:#0000ff">string</span>)entry[&quot;<span style="color:#8b0000">type</span>&quot;];
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre>

<p> </p>

<p>Ci-dessous le code complet qui permet de naviguer dans les répertoires SkyDrive.</p>

<p>XAML:</p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">&lt;</span><span style="color:#c71585">phone</span>:<span style="color:#800000">PhoneApplicationPage</span> 
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">x</span>:<span style="color:#ff0000">Class</span>=<span style="color:#0000ff">&quot;SkyDriveExplorer.MainPage&quot;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">xmlns</span>=<span style="color:#0000ff">&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">xmlns</span>:<span style="color:#ff0000">x</span>=<span style="color:#0000ff">&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">xmlns</span>:<span style="color:#ff0000">phone</span>=<span style="color:#0000ff">&quot;clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone&quot;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">xmlns</span>:<span style="color:#ff0000">shell</span>=<span style="color:#0000ff">&quot;clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone&quot;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">xmlns</span>:<span style="color:#ff0000">d</span>=<span style="color:#0000ff">&quot;http://schemas.microsoft.com/expression/blend/2008&quot;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">xmlns</span>:<span style="color:#ff0000">mc</span>=<span style="color:#0000ff">&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">mc</span>:<span style="color:#ff0000">Ignorable</span>=<span style="color:#0000ff">&quot;d&quot;</span> <span style="color:#ff0000">d</span>:<span style="color:#ff0000">DesignWidth</span>=<span style="color:#0000ff">&quot;480&quot;</span> <span style="color:#ff0000">d</span>:<span style="color:#ff0000">DesignHeight</span>=<span style="color:#0000ff">&quot;768&quot;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">FontFamily</span>=<span style="color:#0000ff">&quot;{StaticResource PhoneFontFamilyNormal}&quot;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">FontSize</span>=<span style="color:#0000ff">&quot;{StaticResource PhoneFontSizeNormal}&quot;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">Foreground</span>=<span style="color:#0000ff">&quot;{StaticResource PhoneForegroundBrush}&quot;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">SupportedOrientations</span>=<span style="color:#0000ff">&quot;Portrait&quot;</span> <span style="color:#ff0000">Orientation</span>=<span style="color:#0000ff">&quot;Portrait&quot;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#ff0000">shell</span>:<span style="color:#ff0000">SystemTray</span>.<span style="color:#ff0000">IsVisible</span>=<span style="color:#0000ff">&quot;True&quot;</span> <span style="color:#ff0000">Loaded</span>=<span style="color:#0000ff">&quot;PhoneApplicationPage_Loaded&quot;</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#0000ff">&lt;</span><span style="color:#800000">Grid</span> <span style="color:#ff0000">x</span>:<span style="color:#ff0000">Name</span>=<span style="color:#0000ff">&quot;LayoutRoot&quot;</span> <span style="color:#ff0000">Background</span>=<span style="color:#0000ff">&quot;Transparent&quot;</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">&lt;</span><span style="color:#800000">Grid</span> <span style="color:#ff0000">x</span>:<span style="color:#ff0000">Name</span>=<span style="color:#0000ff">&quot;ContentPanel&quot;</span> <span style="color:#ff0000">Grid</span>.<span style="color:#ff0000">Row</span>=<span style="color:#0000ff">&quot;1&quot;</span> <span style="color:#ff0000">Margin</span>=<span style="color:#0000ff">&quot;12,0,12,0&quot;</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">&lt;</span><span style="color:#800000">ListBox</span> <span style="color:#ff0000">ItemsSource</span>=<span style="color:#0000ff">&quot;{Binding}&quot;</span> <span style="color:#ff0000">Margin</span>=<span style="color:#0000ff">&quot;0,0,0,0&quot;</span> <span style="color:#ff0000">Name</span>=<span style="color:#0000ff">&quot;lstFolder&quot;</span> <span style="color:#ff0000">SelectionChanged</span>=<span style="color:#0000ff">&quot;lstFolder_SelectionChanged&quot;</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">&lt;</span><span style="color:#800000">ListBox.ItemTemplate</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    <span style="color:#0000ff">&lt;</span><span style="color:#800000">DataTemplate</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                        <span style="color:#0000ff">&lt;</span><span style="color:#800000">StackPanel</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                            <span style="color:#0000ff">&lt;</span><span style="color:#800000">TextBlock</span> <span style="color:#ff0000">Text</span>=<span style="color:#0000ff">&quot;{Binding Name}&quot;</span> <span style="color:#ff0000">TextWrapping</span>=<span style="color:#0000ff">&quot;Wrap&quot;</span> <span style="color:#ff0000">Margin</span>=<span style="color:#0000ff">&quot;0,0,0,0&quot;</span> <span style="color:#ff0000">FontWeight</span>=<span style="color:#0000ff">&quot;Bold&quot;</span><span style="color:#0000ff">/&gt;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                            <span style="color:#0000ff">&lt;</span><span style="color:#800000">TextBlock</span> <span style="color:#ff0000">Text</span>=<span style="color:#0000ff">&quot;{Binding Id}&quot;</span> <span style="color:#ff0000">TextWrapping</span>=<span style="color:#0000ff">&quot;Wrap&quot;</span> <span style="color:#ff0000">Margin</span>=<span style="color:#0000ff">&quot;20,0,0,0&quot;</span> <span style="color:#0000ff">/&gt;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                            <span style="color:#0000ff">&lt;</span><span style="color:#800000">TextBlock</span> <span style="color:#ff0000">Text</span>=<span style="color:#0000ff">&quot;{Binding Type}&quot;</span> <span style="color:#ff0000">TextWrapping</span>=<span style="color:#0000ff">&quot;Wrap&quot;</span> <span style="color:#ff0000">Margin</span>=<span style="color:#0000ff">&quot;20,0,0,0&quot;</span> <span style="color:#0000ff">/&gt;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                        <span style="color:#0000ff">&lt;/</span><span style="color:#800000">StackPanel</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    <span style="color:#0000ff">&lt;/</span><span style="color:#800000">DataTemplate</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">&lt;/</span><span style="color:#800000">ListBox.ItemTemplate</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">&lt;/</span><span style="color:#800000">ListBox</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">&lt;/</span><span style="color:#800000">Grid</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#0000ff">&lt;/</span><span style="color:#800000">Grid</span><span style="color:#0000ff">&gt;</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"> 
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">&lt;/</span><span style="color:#c71585">phone</span>:<span style="color:#800000">PhoneApplicationPage</span><span style="color:#0000ff">&gt;</span></pre></pre>

<p> </p>

<p>Code:</p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">using</span> System;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">using</span> System.Collections.Generic;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">using</span> System.Collections.ObjectModel;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">using</span> System.ComponentModel;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">using</span> System.Windows;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">using</span> System.Windows.Controls;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">using</span> Microsoft.Live;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">using</span> Microsoft.Phone.Controls;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">namespace</span> SkyDriveExplorer
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    <span style="color:#0000ff">public</span> partial <span style="color:#0000ff">class</span> MainPage : PhoneApplicationPage
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">public</span> <span style="color:#0000ff">class</span> SkyDriveListBoxItem : INotifyPropertyChanged, INotifyPropertyChanging
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">private</span> String _Id;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">public</span> String Id
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">get</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    <span style="color:#0000ff">return</span> _Id;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">set</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    NotifyPropertyChanging(&quot;<span style="color:#8b0000">Id</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    _Id = <span style="color:#0000ff">value</span>;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    NotifyPropertyChanged(&quot;<span style="color:#8b0000">Id</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">private</span> String _Name;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">public</span> String Name
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">get</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    <span style="color:#0000ff">return</span> _Name;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">set</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    NotifyPropertyChanging(&quot;<span style="color:#8b0000">Name</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    _Name = <span style="color:#0000ff">value</span>;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    NotifyPropertyChanged(&quot;<span style="color:#8b0000">Name</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">private</span> String _Type;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">public</span> String Type
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">get</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    <span style="color:#0000ff">return</span> _Type;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">set</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    NotifyPropertyChanging(&quot;<span style="color:#8b0000">Type</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    _Type = <span style="color:#0000ff">value</span>;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    NotifyPropertyChanged(&quot;<span style="color:#8b0000">Type</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            #region INotifyPropertyChanged Members
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">public</span> <span style="color:#0000ff">event</span> PropertyChangedEventHandler PropertyChanged;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> NotifyPropertyChanged(<span style="color:#0000ff">string</span> propertyName)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">if</span> (PropertyChanged != <span style="color:#0000ff">null</span>)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    PropertyChanged(<span style="color:#0000ff">this</span>, <span style="color:#0000ff">new</span> PropertyChangedEventArgs(propertyName));
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            #endregion
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            #region INotifyPropertyChanging Members
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">public</span> <span style="color:#0000ff">event</span> PropertyChangingEventHandler PropertyChanging;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> NotifyPropertyChanging(<span style="color:#0000ff">string</span> propertyName)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">if</span> (PropertyChanging != <span style="color:#0000ff">null</span>)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    PropertyChanging(<span style="color:#0000ff">this</span>, <span style="color:#0000ff">new</span> PropertyChangingEventArgs(propertyName));
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            #endregion
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">public</span> ObservableCollection&lt;SkyDriveListBoxItem&gt; folderitems = <span style="color:#0000ff">new</span> ObservableCollection&lt;SkyDriveListBoxItem&gt;();
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">public</span> MainPage()
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            InitializeComponent();
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            DataContext = folderitems;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        String strFolderName = &quot;<span style="color:#8b0000">me/skydrive</span>&quot;;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#008000">// replace de CID</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">static</span> LiveAuthClient lac = <span style="color:#0000ff">new</span> LiveAuthClient(&quot;<span style="color:#8b0000">0000000099999999</span>&quot;, &quot;<span style="color:#8b0000">http://oauth.live.com/desktop</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#0000ff">void</span> OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">base</span>.OnNavigatedTo(e);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> Login()
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            lac.LoginCompleted += <span style="color:#0000ff">new</span> EventHandler&lt;LoginCompletedEventArgs&gt;(lac_LoginCompleted);
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            List&lt;String&gt; l = <span style="color:#0000ff">new</span> List&lt;<span style="color:#0000ff">string</span>&gt;() { &quot;<span style="color:#8b0000">wl.basic</span>&quot;, &quot;<span style="color:#8b0000">wl.photos</span>&quot;, &quot;<span style="color:#8b0000">wl.skydrive</span>&quot;, &quot;<span style="color:#8b0000">wl.offline_access</span>&quot;, &quot;<span style="color:#8b0000">wl.signin</span>&quot;, &quot;<span style="color:#8b0000">wl.skydrive_update</span>&quot; };
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            lac.LoginAsync(l);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">void</span> lac_LoginCompleted(<span style="color:#0000ff">object</span> sender, LoginCompletedEventArgs e)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">if</span> (e.Status == LiveConnectSessionStatus.Connected)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                ScanFolder();
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">void</span> ScanFolder()
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            LiveConnectClient clientFolder = <span style="color:#0000ff">new</span> LiveConnectClient(lac.Session);
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            clientFolder.GetCompleted += <span style="color:#0000ff">new</span> EventHandler&lt;LiveOperationCompletedEventArgs&gt;(clientFolder_GetCompleted);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            clientFolder.GetAsync(strFolderName+&quot;<span style="color:#8b0000">/files</span>&quot;);
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">void</span> clientFolder_GetCompleted(<span style="color:#0000ff">object</span> sender, LiveOperationCompletedEventArgs e)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">if</span> (e.Result != <span style="color:#0000ff">null</span>)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                Dispatcher.BeginInvoke(() =&gt;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                        folderitems.Clear();
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                        <span style="color:#0000ff">foreach</span> (var o <span style="color:#0000ff">in</span> e.Result)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                        {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                            <span style="color:#0000ff">foreach</span> (var oo <span style="color:#0000ff">in</span> ((System.Collections.Generic.List&lt;<span style="color:#0000ff">object</span>&gt;)(o.Value)))
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                            {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                                System.Collections.Generic.Dictionary&lt;<span style="color:#0000ff">string</span>, <span style="color:#0000ff">object</span>&gt; entry = (System.Collections.Generic.Dictionary&lt;<span style="color:#0000ff">string</span>, <span style="color:#0000ff">object</span>&gt;)oo;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                                folderitems.Add( <span style="color:#0000ff">new</span> SkyDriveListBoxItem() { Id = (<span style="color:#0000ff">string</span>)entry[&quot;<span style="color:#8b0000">id</span>&quot;], Name = (<span style="color:#0000ff">string</span>)entry[&quot;<span style="color:#8b0000">name</span>&quot;], Type = (<span style="color:#0000ff">string</span>)entry[&quot;<span style="color:#8b0000">type</span>&quot;] } );
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                            }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                        }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    });
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> lstFolder_SelectionChanged(<span style="color:#0000ff">object</span> sender, SelectionChangedEventArgs e)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">if</span> (lstFolder.SelectedIndex == -1)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">return</span>;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">if</span> ((((SkyDriveListBoxItem)lstFolder.SelectedItem).Type == &quot;<span style="color:#8b0000">folder</span>&quot;) || (((SkyDriveListBoxItem)lstFolder.SelectedItem).Type == &quot;<span style="color:#8b0000">album</span>&quot;))
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                NavigationService.Navigate(<span style="color:#0000ff">new</span> Uri(&quot;<span style="color:#8b0000">/MainPage.xaml?folderid=</span>&quot; + ((SkyDriveListBoxItem)lstFolder.SelectedItem).Id, UriKind.RelativeOrAbsolute));
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            lstFolder.SelectedIndex = -1;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        <span style="color:#0000ff">private</span> <span style="color:#0000ff">void</span> PhoneApplicationPage_Loaded(<span style="color:#0000ff">object</span> sender, RoutedEventArgs e)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">if</span> (lac.Session == <span style="color:#0000ff">null</span>)
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                Login();
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            <span style="color:#0000ff">else</span>
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            {
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                String strParamFolderName = &quot;<span style="color:#8b0000"></span>&quot;;
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                <span style="color:#0000ff">if</span> (NavigationContext.QueryString.TryGetValue(&quot;<span style="color:#8b0000">folderid</span>&quot;, <span style="color:#0000ff">out</span> strParamFolderName))
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    strFolderName = strParamFolderName;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    ScanFolder();
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">            }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">        }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">    }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre></div></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>.Net; Windows Phone 7</category>
      <pubDate>Fri, 04 May 2012 09:20:26 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=13</guid>
    </item>
    <item>
      <title>Windows Phone : Tile</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=14</link>
      <description><![CDATA[<div><b>Publié:</b> 02/04/2012 10:35</div>
<div><b>Titre:</b> Windows Phone : Tile</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*">Windows Phone 7</a>; <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=4&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=4&RootFolder=*">.Net</a></div>
<div><b>Corps:</b> <div class="ExternalClass11D26FDA36EF475C9FA67A1E6CB6F5F8"><p>Les tiles (tuiles) utilisé dans le windows Phone sont composé the trois éléments :</p>  <ul>   <li>Une image</li>    <li>Un text</li>    <li>Un compteur</li> </ul>  <p>Référencer ces éléments est réalisé via l’objet « <a href="http://msdn.microsoft.com/en-us/library/microsoft.phone.shell.shelltile(v=vs.92).aspx">ShellTile</a> », via lequel l’on peut rajouter, modifier ou supprimer des « tiles ».</p>  <p>Dans certains cas, il est nécessaire de créer un « tile » contenant des informations dynamiques. Cela se fait en créant une image, de la sauvegarder dans « <a href="http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage(v=vs.95).aspx">l’IsolatedStorage</a> » et de la référencer.</p>  <p>Ci-dessous la procédure à suivre.</p>  <p>La première étape est de créé une image de 173 pixels sur 173 pixels (grandeur du « tile »).</p>  <p> </p>  <p>   <pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">var wb = <span style="color:#0000ff">new</span> WriteableBitmap(173, 173);</pre></pre>
</p>

<p> </p>

<p>Dans cette image, on va « composer » notre nouveau « tile » via un ensemble d’objets graphiques.</p>

<p>Une image de référence reprise des ressources de notre projet par exemple (dans l’exemple, j’utilise l’image du « tile » par défaut). A noter que la propriété « Opacity » me permet d’assombrir l’image afin que le texte ressort plus).</p>

<p> </p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">BitmapImage img = <span style="color:#0000ff">new</span> BitmapImage();
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">img.SetSource(Application.GetResourceStream(<span style="color:#0000ff">new</span> Uri(&quot;<span style="color:#8b0000">Background.png</span>&quot;, UriKind.Relative)).Stream);
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">var imgbkg = <span style="color:#0000ff">new</span> Image
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          Opacity = 0.7,
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          Height = 173,
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          Width = 173,
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          Stretch = Stretch.UniformToFill,
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          Source = img
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     };
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">wb.Render(imgbkg, <span style="color:#0000ff">new</span> TranslateTransform());</pre></pre>

<p> </p>

<p>Du texte.</p>

<p> </p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">var text = <span style="color:#0000ff">new</span> TextBlock
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     Text = &quot;<span style="color:#8b0000">Hello</span>&quot;,
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     Foreground = <span style="color:#0000ff">new</span> SolidColorBrush(Colors.White),
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     FontFamily = <span style="color:#0000ff">new</span> FontFamily(&quot;<span style="color:#8b0000">Segoe WP Black</span>&quot;),
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     FontSize = 30
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">};
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">wb.Render(text, <span style="color:#0000ff">new</span> TranslateTransform { X = 167 - text.ActualWidth, Y = 6 });</pre></pre>

<p> </p>

<p>Une forme géométrique.</p>

<p> </p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">var rect = <span style="color:#0000ff">new</span> Rectangle
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     Width = text.ActualWidth + 4,
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     Height = text.ActualHeight + 4,
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     Stroke = <span style="color:#0000ff">new</span> SolidColorBrush(Colors.Yellow),
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">};
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">wb.Render(rect, <span style="color:#0000ff">new</span> TranslateTransform { X = 165 - text.ActualWidth, Y = 4 });</pre></pre>

<p> </p>

<p>Après avoir “composer” notre image, on force celle-ci à se redessiner.</p>

<p> </p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">wb.Invalidate();</pre></pre>

<p> </p>

<p>Cette nouvelle image, on DOIT la sauvegarder dans notre <a href="http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage(v=vs.95).aspx">IsolatedStorage</a> dans un répertoire spécifique « isostore:/Shared/ShellContent/» (si on la met autre part, cela ne fonctionne pas).</p>

<p> </p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">using</span> (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">if</span> (!isf.DirectoryExists(&quot;<span style="color:#8b0000">Shared</span>&quot;))
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          isf.CreateDirectory(&quot;<span style="color:#8b0000">Shared</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">if</span> (!isf.DirectoryExists(&quot;<span style="color:#8b0000">Shared/ShellContent</span>&quot;))
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          isf.CreateDirectory(&quot;<span style="color:#8b0000">Shared/ShellContent</span>&quot;);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     <span style="color:#0000ff">using</span> (IsolatedStorageFileStream fs = isf.CreateFile(&quot;<span style="color:#8b0000">/Shared/ShellContent/customtile</span>&quot;))
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">          wb.SaveJpeg(fs, 173, 173, 0, 80);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">     }
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre>

<p> </p>

<p>Il ne nous reste plus qu’à modifier notre « tile » pour référencer notre image. Dans l’exemple, je modifie le « tile » principal.</p>

<p> </p>

<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">Uri isostoreURI = <span style="color:#0000ff">new</span> Uri(&quot;<span style="color:#8b0000">isostore:/Shared/ShellContent/customtile</span>&quot;, UriKind.Absolute);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">ShellTile.ActiveTiles.First().Update(<span style="color:#0000ff">new</span> StandardTileData() { BackgroundImage = isostoreURI, Count=0, Title=&quot;<span style="color:#8b0000"></span>&quot; });</pre></pre></div></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>Windows Phone 7; .Net</category>
      <pubDate>Fri, 04 May 2012 09:20:26 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=14</guid>
    </item>
    <item>
      <title>Windows Phone, Facebook, Twitter…</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=15</link>
      <description><![CDATA[<div><b>Publié:</b> 02/04/2012 10:48</div>
<div><b>Titre:</b> Windows Phone, Facebook, Twitter…</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*">Windows Phone 7</a></div>
<div><b>Corps:</b> <div class="ExternalClassC700A518AC67464586E488DA3BB8A904"><p>Partagé un lien sur Facebook, Twitter depuis une application se fait très facilement. L’objet “<a href="http://msdn.microsoft.com/en-us/library/microsoft.phone.tasks.sharelinktask(v=vs.92).aspx">ShareLinkTask</a>” s’occupant de tout <img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="/blog/cpe/Lists/Billets/Attachments/15/wlEmoticon-smile_2_545C437A.png" />.</p>  <pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px"><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">ShareLinkTask slt = <span style="color:#0000ff">new</span> ShareLinkTask()
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    Title =&quot;<span style="color:#8b0000">test</span>&quot;,
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    Message=&quot;<span style="color:#8b0000">test msg</span>&quot;,
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">                    LinkUri=<span style="color:#0000ff">new</span> Uri(&quot;<span style="color:#8b0000">http://www.neomytic.be</span>&quot;)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">               };
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">slt.Show();</pre></pre>

<p>Pour partager un statut, c’est aussi simple grâce à l’objet “<a href="http://msdn.microsoft.com/en-us/library/microsoft.phone.tasks.sharestatustask(v=vs.92).aspx">SharedStatusTask</a>”.</p></div></div>
<div><b>Pièces jointes:</b> <a href="http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/15/wlEmoticon-smile_2_545C437A.png">http://www.mytic.be/blog/cpe/Lists/Billets/Attachments/15/wlEmoticon-smile_2_545C437A.png</a><br /><a href=""></a></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>Windows Phone 7</category>
      <pubDate>Fri, 04 May 2012 09:20:26 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=15</guid>
    </item>
    <item>
      <title>Windows Phone : Tile (addendum)</title>
      <link>http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=16</link>
      <description><![CDATA[<div><b>Publié:</b> 19/04/2012 13:30</div>
<div><b>Titre:</b> Windows Phone : Tile (addendum)</div>
<div><b>Créé par:</b> Christophe Peerens</div>
<div><b>Catégorie:</b> <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=4&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=4&RootFolder=*">.Net</a>; <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=8&RootFolder=*">Windows Phone 7</a>; <a onclick="OpenPopUpPage('http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=6&RootFolder=*', RefreshPage); return false;" href="http://www.mytic.be/blog/cpe/_layouts/listform.aspx?PageType=4&ListId={90AD59CD-6C5D-4486-B5EA-F23CA4C00F91}&ID=6&RootFolder=*">Threading</a></div>
<div><b>Corps:</b> <div class="ExternalClass2AFE15E105694ECEACD4E3042423ACD1"><p>Suite à quelques messages me demandant comment mettre à jour le “tile” depuis un background agent, voici la procédure à suivre.</p>  <p>En effet, les fonctions utilisées, pour la création de l’image, doivent être appelées dans le contexte du thread UI. Un “BeginInvoke” de résoudre cette contrainte.</p>  <p>Il suffit de mettre le code de l’article précédant à l’endroit du commentaire dans le code qui suit :</p>  <pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"><span style="color:#0000ff">protected</span> <span style="color:#0000ff">override</span> <span style="color:#0000ff">void</span> OnInvoke(ScheduledTask task)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">{
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">   <span style="color:#0000ff">if</span> (task <span style="color:#0000ff">is</span> PeriodicTask)
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">   {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">      AutoResetEvent e = <span style="color:#0000ff">new</span> AutoResetEvent(<span style="color:#0000ff">false</span>);
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px"></pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">      Deployment.Current.Dispatcher.BeginInvoke(() =&gt;
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">      {
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">         <span style="color:#008000">// Le code pour mettre a jour le Tile</span>
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">         e.Set();
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">      });
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">      e.WaitOne();
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">   }
</pre><pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">   NotifyComplete();
</pre><pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas, 'Courier New', courier, monospace;font-size:12px">}</pre></pre></div></div>
]]></description>
      <author>Christophe Peerens</author>
      <category>.Net; Windows Phone 7; Threading</category>
      <pubDate>Fri, 04 May 2012 09:20:27 GMT</pubDate>
      <guid isPermaLink="true">http://www.mytic.be/blog/cpe/Lists/Billets/ViewPost.aspx?ID=16</guid>
    </item>
  </channel>
</rss>