<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>A DotNet Raider</title>
        <link>http://blogs.ugidotnet.org/martinobordin/Default.aspx</link>
        <description>My adventures in the .NET world!</description>
        <language>it</language>
        <copyright>Martino Bordin</copyright>
        <generator>Subtext Version 2.1.0.3</generator>
        <image>
            <title>A DotNet Raider</title>
            <url>http://blogs.ugidotnet.org/images/RSS2Image.gif</url>
            <link>http://blogs.ugidotnet.org/martinobordin/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Visualizzare il Viewmodel di KnockoutJS</title>
            <category>ASP.NET</category>
            <category>JQuery &amp; JScript</category>
            <link>http://blogs.ugidotnet.org/martinobordin/archive/2013/04/17/visualizzare-il-viewmodel-di-knockoutjs.aspx</link>
            <description>&lt;p&gt;Ultimamente mi sto dilettando su un progetto che utilizza ASP.NET MVC in accoppiata con &lt;a href="http://knockoutjs.com"&gt;KnockoutJs&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Si tratta di un'applicazione Single-Page che, tramite AJAX, va a costruire &lt;u&gt;dinamicamente&lt;/u&gt; il ViewModel Knockout e che quindi, a seconda della navigazione compiuta dall'utente tramite richieste multiple e asincrone, può diventare "grande" a piacere e difficilmente debuggabile.&lt;/p&gt;
&lt;p&gt;Mi è quindi tornato utile questo snippet, che permette di visualizzare lo stato attuale del ViewModel, mostrando tutte le proprietà presenti e i relativi valori, in formato json: &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="background-color:white;"&gt;
&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;
&lt;p&gt;&amp;lt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;div&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" face="Consolas" size="2"&gt;&lt;font color="#ff0000" face="Consolas" size="2"&gt;&lt;font color="#ff0000" face="Consolas" size="2"&gt;style&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;="&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" face="Consolas" size="2"&gt;&lt;font color="#ff0000" face="Consolas" size="2"&gt;&lt;font color="#ff0000" face="Consolas" size="2"&gt;border&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;: 2px dashed red"&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;   &lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;h1&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;KnockoutJS ViewModel Viewer:&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;h1&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;div&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" face="Consolas" size="2"&gt;&lt;font color="#ff0000" face="Consolas" size="2"&gt;&lt;font color="#ff0000" face="Consolas" size="2"&gt;data-bind&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;="text: ko.toJSON($root)"&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;div&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&amp;lt;/&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;&lt;font color="#800000" face="Consolas" size="2"&gt;div&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;/font&gt; &lt;/font&gt; &lt;/font&gt;&lt;/div&gt;
&lt;p&gt;Questo un esempio di quanto verrà stampato a video:&lt;/p&gt;
&lt;p&gt; &lt;img width="1166" height="140" alt="" src="/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/knockout.png" /&gt;&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/martinobordin/aggbug/101510.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Martino Bordin</dc:creator>
            <guid>http://blogs.ugidotnet.org/martinobordin/archive/2013/04/17/visualizzare-il-viewmodel-di-knockoutjs.aspx</guid>
            <pubDate>Wed, 17 Apr 2013 08:20:36 GMT</pubDate>
            <wfw:comment>http://blogs.ugidotnet.org/martinobordin/comments/101510.aspx</wfw:comment>
            <comments>http://blogs.ugidotnet.org/martinobordin/archive/2013/04/17/visualizzare-il-viewmodel-di-knockoutjs.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/martinobordin/comments/commentRss/101510.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/martinobordin/services/trackbacks/101510.aspx</trackback:ping>
        </item>
        <item>
            <title>Code Coverage e Test Settings</title>
            <category>VISUAL STUDIO</category>
            <link>http://blogs.ugidotnet.org/martinobordin/archive/2012/11/06/code-coverage-e-test-settings.aspx</link>
            <description>&lt;p&gt;Il &lt;a href="http://en.wikipedia.org/wiki/Code_coverage"&gt;code coverage&lt;/a&gt; è un'indice importante per avere un'idea della percentuale di codice coperto da unit-test.&lt;/p&gt;
&lt;p&gt;Se utilizzate il framework di unit-test Microsoft (&lt;em&gt;MSTest&lt;/em&gt;), Visual Studio è in grado di calcolare tale indice automaticamente (maggiori dettagli &lt;a href="http://msdn.microsoft.com/en-us/library/dd504821.aspx"&gt;qui&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Tempo fa avevo instrumentato questo tool su un mio progetto ed oggi, dopo aver fatto refactoring ed aggiunto alcune funzionalità, volevo visualizzare i dati di code coverage.&lt;/p&gt;
&lt;p&gt;Lanciando il tool, ottenevo tuttavia questo messaggio:&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;"&lt;strong&gt;Cannot find any coverage data (.coverage or .coveragexml) files. Check test run details for possible errors.&lt;/strong&gt;"&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; Dopo un pò di verifiche ho scoperto l'inghippo: per qualche motivo il file di impostazioni dei test corrente era "&lt;strong&gt;Trace and Test Impact&lt;/strong&gt;" e non "&lt;strong&gt;Local&lt;/strong&gt;".&lt;/p&gt;
&lt;p&gt;&lt;img width="604" height="229" alt="" src="/images/blogs_ugidotnet_org/martinobordin/TestSettings.png" /&gt;&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/martinobordin/aggbug/101310.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Martino Bordin</dc:creator>
            <guid>http://blogs.ugidotnet.org/martinobordin/archive/2012/11/06/code-coverage-e-test-settings.aspx</guid>
            <pubDate>Tue, 06 Nov 2012 15:55:54 GMT</pubDate>
            <wfw:comment>http://blogs.ugidotnet.org/martinobordin/comments/101310.aspx</wfw:comment>
            <comments>http://blogs.ugidotnet.org/martinobordin/archive/2012/11/06/code-coverage-e-test-settings.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/martinobordin/comments/commentRss/101310.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/martinobordin/services/trackbacks/101310.aspx</trackback:ping>
        </item>
        <item>
            <title>Manipolazione di file zip con il framework 4.5</title>
            <category>VISUAL STUDIO</category>
            <category>MISC</category>
            <link>http://blogs.ugidotnet.org/martinobordin/archive/2012/08/23/manipolazione-di-file-zip-con-il-framework-4.5.aspx</link>
            <description>&lt;p&gt;Dalla versione 4.5 del .NET framework è finalmente supportata out-of-the-box la manipolazione di file zip senza l'utilizzo di librerie di terze parti.&lt;/p&gt;
&lt;p&gt;Sono ora disponibili infatti 2 assembly System.IO.Compression e System.IO.Compression.FileSystem che permettono, ad esempio, di enumerare i file presenti in uno zip, estrarli, creare nuovi file zip, etc.&lt;/p&gt;
&lt;p&gt;Ad esempio, ecco come si ottiene l'elenco dei file contenuti in uno zip:&lt;/p&gt;
&lt;p&gt;  &lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; zipFilePath = &lt;span style="color: rgb(163, 21, 21);"&gt;@"C:\temp\files.zip"&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
    &lt;span style="color: blue;"&gt;using&lt;/span&gt; (FileStream zipFileToOpen = &lt;span style="color: blue;"&gt;new&lt;/span&gt; FileStream(zipFilePath, FileMode.Open)){&lt;br /&gt;
    &lt;span style="color: blue;"&gt;using&lt;/span&gt; (ZipArchive archive = &lt;span style="color: blue;"&gt;new&lt;/span&gt; ZipArchive(zipFileToOpen, ZipArchiveMode.Read)) {&lt;br /&gt;
&lt;br /&gt;
        &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue;"&gt;var&lt;/span&gt; zipArchiveEntry &lt;span style="color: blue;"&gt;in&lt;/span&gt; archive.Entries) {&lt;br /&gt;
            Console.WriteLine(&lt;span style="color: rgb(163, 21, 21);"&gt;"File name: {0}"&lt;/span&gt;, zipArchiveEntry.FullName);}&lt;br /&gt;
    }}&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;E come si estraggono in una directory:&lt;/p&gt;
&lt;p&gt;&lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; zipFilePath = &lt;span style="color: rgb(163, 21, 21);"&gt;@"C:\temp\files.zip"&lt;/span&gt;;&lt;br /&gt;
    &lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; dirToExtract = &lt;span style="color: rgb(163, 21, 21);"&gt;@"C:\temp\"&lt;/span&gt;;&lt;br /&gt;
&lt;br /&gt;
    &lt;span style="color: blue;"&gt;using&lt;/span&gt; (FileStream zipFileToOpen = &lt;span style="color: blue;"&gt;new&lt;/span&gt; FileStream(zipFilePath, FileMode.Open)) {&lt;br /&gt;
    &lt;span style="color: blue;"&gt;using&lt;/span&gt; (ZipArchive archive = &lt;span style="color: blue;"&gt;new&lt;/span&gt; ZipArchive(zipFileToOpen, ZipArchiveMode.Update))&lt;br /&gt;
        archive.ExtractToDirectory(dirToExtract);}}&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;Vi lascio quindi i riferimenti di MSDN:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.io.compression.ziparchive(v=vs.110)"&gt;ZipArchive Class&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/3z72378a(v=vs.110)"&gt;System.IO.Compression&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/martinobordin/aggbug/101170.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Martino Bordin</dc:creator>
            <guid>http://blogs.ugidotnet.org/martinobordin/archive/2012/08/23/manipolazione-di-file-zip-con-il-framework-4.5.aspx</guid>
            <pubDate>Thu, 23 Aug 2012 08:38:09 GMT</pubDate>
            <wfw:comment>http://blogs.ugidotnet.org/martinobordin/comments/101170.aspx</wfw:comment>
            <comments>http://blogs.ugidotnet.org/martinobordin/archive/2012/08/23/manipolazione-di-file-zip-con-il-framework-4.5.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/martinobordin/comments/commentRss/101170.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/martinobordin/services/trackbacks/101170.aspx</trackback:ping>
        </item>
        <item>
            <title>(Dis)Attivare elementi con JQuery</title>
            <category>JQuery &amp; JScript</category>
            <link>http://blogs.ugidotnet.org/martinobordin/archive/2012/08/22/disattivare-elementi-con-jquery.aspx</link>
            <description>&lt;p&gt;Una delle cose che più mi piacciono di JQuery è la facilità con la quale è possibile estendere le sue funzionalità.&lt;/p&gt;
&lt;p&gt;Ecco infatti come è possibile implementare le funzioni per attivare e disattivare gli elementi del DOM:&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;font color="#339966"&gt;// Set an element as enabled, if supported&lt;/font&gt;&lt;br /&gt;
$.fn.enable= &lt;font color="#0000ff"&gt;function&lt;/font&gt; () {&lt;br /&gt;
    return &lt;font color="#0000ff"&gt;this&lt;/font&gt;.each(&lt;font color="#0000ff"&gt;function&lt;/font&gt; () {&lt;br /&gt;
        if (&lt;font color="#0000ff"&gt;typeof&lt;/font&gt; &lt;font color="#0000ff"&gt;this&lt;/font&gt;.disabled != &lt;font color="#800000"&gt;"undefined"&lt;/font&gt;) {&lt;br /&gt;
            &lt;font color="#0000ff"&gt;this&lt;/font&gt;.disabled = &lt;font color="#0000ff"&gt;false&lt;/font&gt;;&lt;br /&gt;
        }&lt;br /&gt;
    });&lt;br /&gt;
};&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;font color="#339966"&gt;// Set an element as disabled, if supported&lt;/font&gt;&lt;br /&gt;
$.fn.disable = &lt;font color="#0000ff"&gt;function&lt;/font&gt; () {&lt;br /&gt;
    return &lt;font color="#0000ff"&gt;this&lt;/font&gt;.each(&lt;font color="#0000ff"&gt;function&lt;/font&gt; () {&lt;br /&gt;
        if (&lt;font color="#0000ff"&gt;typeof&lt;/font&gt; &lt;font color="#0000ff"&gt;this&lt;/font&gt;.disabled != &lt;font color="#800000"&gt;"undefined"&lt;/font&gt;) {&lt;br /&gt;
            &lt;font color="#0000ff"&gt;this&lt;/font&gt;.disabled = &lt;font color="#0000ff"&gt;true&lt;/font&gt;;&lt;br /&gt;
        }&lt;br /&gt;
    });&lt;br /&gt;
};&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;In questo modo è possibile (dis)abilitare qualsiasi elemento con i soliti selettori JQuery:&lt;/p&gt;
&lt;p&gt;$(&lt;font color="#800000"&gt;"*"&lt;/font&gt;).enable();&lt;/p&gt;
&lt;p&gt;$(&lt;font color="#800000"&gt;".editor"&lt;/font&gt;).disable();&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/martinobordin/aggbug/101169.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Martino Bordin</dc:creator>
            <guid>http://blogs.ugidotnet.org/martinobordin/archive/2012/08/22/disattivare-elementi-con-jquery.aspx</guid>
            <pubDate>Wed, 22 Aug 2012 09:08:15 GMT</pubDate>
            <wfw:comment>http://blogs.ugidotnet.org/martinobordin/comments/101169.aspx</wfw:comment>
            <comments>http://blogs.ugidotnet.org/martinobordin/archive/2012/08/22/disattivare-elementi-con-jquery.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/martinobordin/comments/commentRss/101169.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/martinobordin/services/trackbacks/101169.aspx</trackback:ping>
        </item>
        <item>
            <title>Utilizzare l&amp;rsquo;interfaccia Metro su un&amp;rsquo;applicazione WPF</title>
            <category>WPF</category>
            <link>http://blogs.ugidotnet.org/martinobordin/archive/2012/06/11/utilizzare-lrsquointerfaccia-metro-su-unrsquoapplicazione-wpf.aspx</link>
            <description>&lt;p&gt;Se negli ultimi anni non avete vissuto su Marte, avrete sicuramente sentito parlare dell’interfaccia Metro (per i marziani, ecco un &lt;a href="http://it.wikipedia.org/wiki/Metro_(interfaccia_grafica)"&gt;link&lt;/a&gt; che vi spiega velocemente cos’è &lt;img alt="" src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt; ).&lt;/p&gt;
&lt;p&gt;Nel caso stiate sviluppando applicazioni per Windows Phone o Windows 8 (le famose Metro App), avrete già tutti i controlli disponibili che seguono questo stile, senza dover adottare alcun accorgimento particolare..&lt;/p&gt;
&lt;p&gt;E nel caso di applicazioni WPF?&lt;/p&gt;
&lt;p&gt;Bhè, esiste il toolkit di &lt;a href="http://goo.gl/o2YBh"&gt;Mahapps&lt;/a&gt;, che ci omaggia di una serie di controlli, stili, behaviors e attached properties che fanno proprio al caso nostro!&lt;/p&gt;
&lt;p&gt;Come potete vedere il risultato è notevole, e senza particolari stravolgimenti del nostro Xaml:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://mahapps.com/MahApps.Metro/images/animatedtabcontrol.gif" /&gt;&lt;/p&gt;
&lt;p&gt;Metro is everywhere! &lt;img class="wlEmoticon wlEmoticon-smile" style="" alt="Sorriso" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/Interfaccia-Metro-su-unapplicazione-WPF_DD9E/wlEmoticon-smile_2.png" /&gt;&lt;/p&gt;
&lt;p&gt;P.S: Anche per il web sono disponibile progetti interessanti (es &lt;a href="http://naghsheh.info/Pivot/Pivot.htm"&gt;link1&lt;/a&gt; , &lt;a href="http://www.drewgreenwell.com/projects/metrojs"&gt;link2&lt;/a&gt;)&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/martinobordin/aggbug/101049.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Martino Bordin</dc:creator>
            <guid>http://blogs.ugidotnet.org/martinobordin/archive/2012/06/11/utilizzare-lrsquointerfaccia-metro-su-unrsquoapplicazione-wpf.aspx</guid>
            <pubDate>Mon, 11 Jun 2012 14:00:55 GMT</pubDate>
            <wfw:comment>http://blogs.ugidotnet.org/martinobordin/comments/101049.aspx</wfw:comment>
            <comments>http://blogs.ugidotnet.org/martinobordin/archive/2012/06/11/utilizzare-lrsquointerfaccia-metro-su-unrsquoapplicazione-wpf.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/martinobordin/comments/commentRss/101049.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/martinobordin/services/trackbacks/101049.aspx</trackback:ping>
        </item>
        <item>
            <title>Merge di DLL in un&amp;rsquo;applicazione WPF</title>
            <category>WPF</category>
            <category>VISUAL STUDIO</category>
            <link>http://blogs.ugidotnet.org/martinobordin/archive/2012/04/05/merge-di-dll-in-unrsquoapplicazione-wpf.aspx</link>
            <description>&lt;p&gt;Recentemente ho dovuto creare un’applicazione WPF che fosse facilmente distribuibile (leggi: distribuire solo l’exe). &lt;/p&gt;  &lt;p&gt;Purtroppo il tool &lt;a href="http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx"&gt;ILMerge&lt;/a&gt; non funziona per applicazioni WPF, a causa di problemi con le risorse contenute in esse (esistono comunque tool funzionanti di terze parti, a pagamento).&lt;/p&gt;  &lt;p&gt;Seguendo questo &lt;a href="http://www.digitallycreated.net/Blog/61/combining-multiple-assemblies-into-a-single-exe-for-a-wpf-application"&gt;post&lt;/a&gt;, ho creato un esempio che qui illustro e che potete scaricare &lt;a href="https://skydrive.live.com/redir.aspx?cid=bea2d3dac634f29c&amp;amp;resid=BEA2D3DAC634F29C!126&amp;amp;parid=BEA2D3DAC634F29C!123"&gt;qui&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;L’applicazione visualizza semplicemente il fullname di due classi presenti in 2 assembly referenziati:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/65ebb30729a7_A52D/image_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/65ebb30729a7_A52D/image_thumb.png" width="466" height="415" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Per prima cosa è necessario modificare il file di progetto dell’applicazione WPF aggiungendo, dopo “Microsoft.CSharp.targets” , il seguente snippet:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:643c8b88-cddb-4c8e-b2d2-46039cb157f2" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Target&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#ff0000"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;"&lt;span style="color:#0000ff"&gt;AfterResolveReferences&lt;/span&gt;"&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;ItemGroup&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;      &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;EmbeddedResource&lt;/span&gt;&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#ff0000"&gt;Include&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;"&lt;span style="color:#0000ff"&gt;@(ReferenceCopyLocalPaths)&lt;/span&gt;"&lt;span style="color:#0000ff"&gt; &lt;/span&gt;&lt;span style="color:#ff0000"&gt;Condition&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=&lt;/span&gt;"&lt;span style="color:#0000ff"&gt;'%(ReferenceCopyLocalPaths.Extension)' == '.dll'&lt;/span&gt;"&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;LogicalName&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;LogicalName&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;      &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;EmbeddedResource&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;ItemGroup&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Target&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Semplicemente, andiamo ad indicare di inserire tutti i file referenziati con estensione “.dll” come “emdedded resource” nell’exe principale. In questo modo eviteremo di eseguire a mano l’inclusione dell’ultima versione delle librerie compilate.&lt;/p&gt;  &lt;p&gt;Nelle proprietà del progetto, impostiamo il seguente comando da eseguire durante la fase di post-build: “del $(TargetDir)*.dll” per cancellare tutte le librerie presenti nella “bin”, che non ci serviranno più...&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/65ebb30729a7_A52D/image_4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/65ebb30729a7_A52D/image_thumb_1.png" width="573" height="640" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Impostiamo quindi come oggetto di avvio la classe Bootstrapper (potete ovviamente cambiare il nome):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/65ebb30729a7_A52D/image_6.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/65ebb30729a7_A52D/image_thumb_2.png" width="640" height="621" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Questa, infine, è come definita la classe BootStrapper:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:de3e93d6-ea90-44ef-a3d9-bc504671100b" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;BootStrapper&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt; &lt;li&gt;    [&lt;span style="color:#2b91af"&gt;STAThread&lt;/span&gt;]&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] args)&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#2b91af"&gt;AppDomain&lt;/span&gt;.CurrentDomain.AssemblyResolve += OnResolveAssembly;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#2b91af"&gt;App&lt;/span&gt;.Main();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    }&lt;/li&gt; &lt;li&gt; &lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Assembly&lt;/span&gt; OnResolveAssembly(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;ResolveEventArgs&lt;/span&gt; args)&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; executingAssembly = &lt;span style="color:#2b91af"&gt;Assembly&lt;/span&gt;.GetExecutingAssembly();&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; assemblyName = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;AssemblyName&lt;/span&gt;(args.Name);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt; &lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; path = &lt;span style="color:#0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#a31515"&gt;"{&lt;/span&gt;&lt;span style="color:#3cb371"&gt;0}&lt;/span&gt;&lt;span style="color:#a31515"&gt;.dll"&lt;/span&gt;, assemblyName.Name);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (assemblyName.CultureInfo.Equals(&lt;span style="color:#2b91af"&gt;CultureInfo&lt;/span&gt;.InvariantCulture) == &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            path = &lt;span style="color:#0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#a31515"&gt;@"{&lt;/span&gt;&lt;span style="color:#3cb371"&gt;0}\&lt;/span&gt;&lt;span style="color:#a31515"&gt;\cf4 {1}"&lt;/span&gt;, assemblyName.CultureInfo, path);&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt; &lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; stream = executingAssembly.GetManifestResourceStream(path))&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (stream == &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            {&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            }&lt;/li&gt; &lt;li&gt; &lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; assemblyRawBytes = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#0000ff"&gt;byte&lt;/span&gt;[stream.Length];&lt;/li&gt; &lt;li&gt;            stream.Read(assemblyRawBytes, 0, assemblyRawBytes.Length);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Assembly&lt;/span&gt;.Load(assemblyRawBytes);&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    }&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Sostanzialmente ci agganciamo all’evento AssemblyResolve dell’AppDomain corrente, che viene sollevato ogni volta che la risoluzione di un’assembly fallisce, e ritorniamo l’assembly che abbia in canna nelle embedded resources.&lt;/p&gt;  &lt;p&gt;Ecco infatti come si presenta il nostro exe “aprendolo” con &lt;a href="http://wiki.sharpdevelop.net/ILSpy.ashx"&gt;ILSpy&lt;/a&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/65ebb30729a7_A52D/image_8.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/65ebb30729a7_A52D/image_thumb_3.png" width="252" height="640" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;E’ anche più semplice di usare la riga di comando di ILMerge ! &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="A bocca aperta" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/65ebb30729a7_A52D/wlEmoticon-openmouthedsmile_2.png" /&gt;&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/martinobordin/aggbug/100921.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Martino Bordin</dc:creator>
            <guid>http://blogs.ugidotnet.org/martinobordin/archive/2012/04/05/merge-di-dll-in-unrsquoapplicazione-wpf.aspx</guid>
            <pubDate>Thu, 05 Apr 2012 12:07:51 GMT</pubDate>
            <wfw:comment>http://blogs.ugidotnet.org/martinobordin/comments/100921.aspx</wfw:comment>
            <comments>http://blogs.ugidotnet.org/martinobordin/archive/2012/04/05/merge-di-dll-in-unrsquoapplicazione-wpf.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/martinobordin/comments/commentRss/100921.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/martinobordin/services/trackbacks/100921.aspx</trackback:ping>
        </item>
        <item>
            <title>Listbox WPF: disabilitata ma non troppo!</title>
            <category>WPF</category>
            <category>Blend</category>
            <link>http://blogs.ugidotnet.org/martinobordin/archive/2012/04/03/listbox-wpf-disabilitata-ma-non-troppo.aspx</link>
            <description>&lt;p&gt;Recentemente ho dovuto realizzare una sorta di wizard in WPF, ovvero una classica window con un’intestazione, una listbox a sinistra che visualizza gli step (evidenziando lo step corrente) e un contentpresenter in cui verrà caricato il contenuto dinamicamente. Niente di complicato.&lt;/p&gt;
&lt;p&gt;La cosa “particolare” è il fatto che la listbox con l’elenco degli step è read-only, ovvero  deve solo presentare i dati e l’utente  non deve poter selezionare qual’è lo step corrente..altrimenti che procedura guidata è? &lt;img alt="" src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" /&gt;.&lt;/p&gt;
&lt;p&gt;Ovviamente è possibile disabilitare la listbox , ma in questo  modo lo stile applicato rende il tutto poco usabile e gradevole (un grigio che mina la leggibilità del controllo )..e di certo non mi andava di rifare il template del controllo per questa sciocchezza.&lt;/p&gt;
&lt;p&gt;Ho risolto semplicemente creando uno style per l’ItemContainer e impostando a &lt;strong&gt;false&lt;/strong&gt; la proprietà &lt;strong&gt;Focusable&lt;/strong&gt;:&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3e9ef0f4-53ec-4f8b-8f3f-324a8a745db0" style="margin: 0px; padding: 0px; float: none; display: inline;"&gt;
&lt;div style="border: 1px solid rgb(0, 0, 128); color: rgb(0, 0, 0); font-family: &amp;quot;Courier New&amp;quot;, Courier, Monospace; font-size: 10pt;"&gt;
&lt;div style="background: rgb(221, 221, 221); overflow: auto;"&gt;
&lt;ol style="background: rgb(255, 255, 255); margin: 0px 0px 0px 2.5em; padding: 0px 0px 0px 5px; white-space: nowrap;" start="1"&gt;
    &lt;li&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ListBox.ItemContainerStyle&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;                &lt;span style="color: rgb(163, 21, 21);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Style&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; TargetType&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="{&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;x&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Type&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; ListBoxItem}&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;"&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;                    &lt;span style="color: rgb(163, 21, 21);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Setter&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; Property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Focusable"&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; Value&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="False"/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;                    &lt;span style="color: rgb(163, 21, 21);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Style.Triggers&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;                        &lt;span style="color: rgb(163, 21, 21);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Trigger&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; Property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="IsSelected"&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; Value&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="True"&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;                            &lt;span style="color: rgb(163, 21, 21);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Setter&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; Property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="FontWeight"&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; Value&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Bold" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;                        &lt;span style="color: rgb(163, 21, 21);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Trigger&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;                    &lt;span style="color: rgb(163, 21, 21);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Style.Triggers&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;                &lt;span style="color: rgb(163, 21, 21);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Style&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;            &lt;span style="color: rgb(163, 21, 21);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ListBox.ItemContainerStyle&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thanks WPF!&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/martinobordin/aggbug/100915.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Martino Bordin</dc:creator>
            <guid>http://blogs.ugidotnet.org/martinobordin/archive/2012/04/03/listbox-wpf-disabilitata-ma-non-troppo.aspx</guid>
            <pubDate>Tue, 03 Apr 2012 11:55:30 GMT</pubDate>
            <wfw:comment>http://blogs.ugidotnet.org/martinobordin/comments/100915.aspx</wfw:comment>
            <comments>http://blogs.ugidotnet.org/martinobordin/archive/2012/04/03/listbox-wpf-disabilitata-ma-non-troppo.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/martinobordin/comments/commentRss/100915.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/martinobordin/services/trackbacks/100915.aspx</trackback:ping>
        </item>
        <item>
            <title>Automapper : creare Dto da proxy Nhibernate</title>
            <category>WPF</category>
            <category>SILVERLIGHT</category>
            <category>O/RM</category>
            <link>http://blogs.ugidotnet.org/martinobordin/archive/2012/02/29/automapper-creare-dto-da-proxy-nhibernate.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/283456f95145_81DC/automapper_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px; padding-top: 0px" title="automapper" border="0" alt="automapper" align="right" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/283456f95145_81DC/automapper_thumb.png" width="260" height="44" /&gt;&lt;/a&gt;Se utilizzate &lt;a href="https://github.com/AutoMapper/AutoMapper"&gt;AutoMapper&lt;/a&gt; per creare &lt;a href="http://en.wikipedia.org/wiki/Data_Transfer_Object"&gt;Dto&lt;/a&gt; da oggetti letti con &lt;a href="http://nhforge.org/Default.aspx"&gt;Nhibernate&lt;/a&gt; e &lt;a href="http://en.wikipedia.org/wiki/Lazy_loading"&gt;lazy-loading&lt;/a&gt; attivo, è possibile che otteniate un’eccezione di tipo &lt;strong&gt;ObjectDisposedException&lt;/strong&gt;, in quanto Automapper accede a proprietà “Lazy”, ma la sessione è già stata chiusa e distrutta.&lt;/p&gt;  &lt;p&gt;Per risolverlo, basta implementare un &lt;a href="https://github.com/AutoMapper/AutoMapper/wiki/Custom-value-resolvers"&gt;Custom Resolver&lt;/a&gt;, che tornerà n&lt;em&gt;ull&lt;/em&gt; qualora il tipo della proprietà che sto provando a mappare sia un proxy non inizializzato.&lt;/p&gt;  &lt;p&gt;Ecco quindi il codice:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a00656a8-65a4-4d40-b29a-2ecf46ddf3e6" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;NhProxyResolver&lt;/span&gt; : ValueResolver&amp;lt;&lt;span style="color:#0000ff"&gt;object&lt;/span&gt;, &lt;span style="color:#0000ff"&gt;object&lt;/span&gt;&amp;gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff"&gt;object&lt;/span&gt; ResolveCore(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; source)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    {&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; NHibernateUtil.IsInitialized(source) ? source : &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    }&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;ed un esempio della configurazione di AutoMapper:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4d2a3829-ecc1-4830-80e2-d3571fbdb8a2" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol start="1" style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;Mapper.CreateMap&amp;lt;User, UserDto&amp;gt;()&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    .ForMember(x =&amp;gt; x.Orders, opt =&amp;gt; opt.ResolveUsing&amp;lt;NhProxyResolver&amp;gt;().FromMember(z =&amp;gt; z.Orders));&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/martinobordin/aggbug/100686.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Martino Bordin</dc:creator>
            <guid>http://blogs.ugidotnet.org/martinobordin/archive/2012/02/29/automapper-creare-dto-da-proxy-nhibernate.aspx</guid>
            <pubDate>Tue, 28 Feb 2012 23:00:00 GMT</pubDate>
            <wfw:comment>http://blogs.ugidotnet.org/martinobordin/comments/100686.aspx</wfw:comment>
            <comments>http://blogs.ugidotnet.org/martinobordin/archive/2012/02/29/automapper-creare-dto-da-proxy-nhibernate.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/martinobordin/comments/commentRss/100686.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/martinobordin/services/trackbacks/100686.aspx</trackback:ping>
        </item>
        <item>
            <title>Transazioni attive su SQL Server</title>
            <category>SQL Server</category>
            <link>http://blogs.ugidotnet.org/martinobordin/archive/2012/02/28/transazioni-attive-su-sql-server.aspx</link>
            <description>&lt;p&gt;Recentemente  mi è tornato utile avere l’elenco delle transazioni attive con il relativo statemente T-SQL.&lt;/p&gt;  &lt;p&gt;Ecco la query che ho utilizzato:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#000000"&gt;SELECT s_tst.[session_id],       &lt;br /&gt;   s_es.[login_name] AS [Login Name],        &lt;br /&gt;   DB_NAME (s_tdt.database_id) AS [Database],        &lt;br /&gt;   s_tdt.[database_transaction_begin_time] AS [Begin Time],        &lt;br /&gt;   s_tdt.[database_transaction_log_record_count] AS [Log Records],        &lt;br /&gt;   s_tdt.[database_transaction_log_bytes_used] AS [Log Bytes],        &lt;br /&gt;   s_tdt.[database_transaction_log_bytes_reserved] AS [Log Rsvd],        &lt;br /&gt;   s_est.[text] AS [Last T-SQL Text],        &lt;br /&gt;   s_eqp.[query_plan] AS [Last Plan]        &lt;br /&gt;FROM sys.dm_tran_database_transactions s_tdt        &lt;br /&gt;   JOIN sys.dm_tran_session_transactions s_tst        &lt;br /&gt;      ON s_tst.[transaction_id] = s_tdt.[transaction_id]        &lt;br /&gt;   JOIN sys.[dm_exec_sessions] s_es        &lt;br /&gt;      ON s_es.[session_id] = s_tst.[session_id]        &lt;br /&gt;   JOIN sys.dm_exec_connections s_ec        &lt;br /&gt;      ON s_ec.[session_id] = s_tst.[session_id]        &lt;br /&gt;   LEFT OUTER JOIN sys.dm_exec_requests s_er        &lt;br /&gt;      ON s_er.[session_id] = s_tst.[session_id]        &lt;br /&gt;   CROSS APPLY sys.dm_exec_sql_text (s_ec.[most_recent_sql_handle]) AS s_est        &lt;br /&gt;   OUTER APPLY sys.dm_exec_query_plan (s_er.[plan_handle]) AS s_eqp        &lt;br /&gt;ORDER BY [Begin Time] ASC;&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Utile nel caso di transazioni bloccate\bloccanti!&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/martinobordin/aggbug/100808.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Martino Bordin</dc:creator>
            <guid>http://blogs.ugidotnet.org/martinobordin/archive/2012/02/28/transazioni-attive-su-sql-server.aspx</guid>
            <pubDate>Tue, 28 Feb 2012 11:48:26 GMT</pubDate>
            <wfw:comment>http://blogs.ugidotnet.org/martinobordin/comments/100808.aspx</wfw:comment>
            <comments>http://blogs.ugidotnet.org/martinobordin/archive/2012/02/28/transazioni-attive-su-sql-server.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/martinobordin/comments/commentRss/100808.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/martinobordin/services/trackbacks/100808.aspx</trackback:ping>
        </item>
        <item>
            <title>Gestione di namespace e cartelle in Visual Studio</title>
            <category>VISUAL STUDIO</category>
            <link>http://blogs.ugidotnet.org/martinobordin/archive/2011/12/20/gestione-di-namespace-e-cartelle-in-visual-studio.aspx</link>
            <description>&lt;p&gt;Come tutti sapete all’interno di Visual Studio (pannello “Solution Explorer”) è possibile creare cartelle in cui andremo inserire le nostre classi.&lt;/p&gt;  &lt;p&gt;Per impostazione predefinita, la struttura di queste cartelle andrà a definire quello che viene chiamato &lt;a href="http://msdn.microsoft.com/en-us/library/dfb3cx8s.aspx"&gt;Fully qualified name&lt;/a&gt; (FQN), ovvero il nome che identifica in modo univoco la nostra classe: &lt;strong&gt;Namespace.NomeClasse&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Pertanto, se la nostra solution è organizzata in questo modo&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/018169661a17_A43D/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/018169661a17_A43D/image_thumb_1.png" width="214" height="195" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;il FQN di customer sarà &lt;strong&gt;Sample.Domain.Customer.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Mano a mano che il progetto cresce potremmo trovarci in situazioni in cui la cartelle contengono raggruppamenti logici di file che tuttavia non vogliamo entrino in gioco nella costruzione del FQN.&lt;/p&gt;  &lt;p&gt;Per esempio, se nella cartella Domain creiamo una sottocartella Customer&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/018169661a17_A43D/image_10.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/018169661a17_A43D/image_thumb_4.png" width="214" height="195" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; Resharper ci segnala che il namespace della classe non è coerente  con la posizione del file:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/018169661a17_A43D/image_6.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/018169661a17_A43D/image_thumb_2.png" width="644" height="347" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Per risolvere il “problema” (ovviamente il progetto compila lo stesso, ma è una segnalazione utile per mantenere lo standard qualitativo del codice) basta impostare a &lt;strong&gt;False &lt;/strong&gt;la voce “&lt;strong&gt;Namespace Provider”&lt;/strong&gt; tra le proprietà della cartella.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/018169661a17_A43D/image_12.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/martinobordin/Windows-Live-Writer/018169661a17_A43D/image_thumb_5.png" width="244" height="152" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/martinobordin/aggbug/100640.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Martino Bordin</dc:creator>
            <guid>http://blogs.ugidotnet.org/martinobordin/archive/2011/12/20/gestione-di-namespace-e-cartelle-in-visual-studio.aspx</guid>
            <pubDate>Tue, 20 Dec 2011 11:34:59 GMT</pubDate>
            <wfw:comment>http://blogs.ugidotnet.org/martinobordin/comments/100640.aspx</wfw:comment>
            <comments>http://blogs.ugidotnet.org/martinobordin/archive/2011/12/20/gestione-di-namespace-e-cartelle-in-visual-studio.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/martinobordin/comments/commentRss/100640.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/martinobordin/services/trackbacks/100640.aspx</trackback:ping>
        </item>
    </channel>
</rss>