<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alphablog.org</title>
	<atom:link href="http://www.alphablog.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alphablog.org</link>
	<description>Blog d&#039;Alphamax</description>
	<lastBuildDate>Sun, 06 May 2012 23:19:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Simple Plugin System based on Ninject and MVVM Light</title>
		<link>http://www.alphablog.org/2012/05/07/simple-plugin-system-based-on-ninject-and-mvvm-light-2/</link>
		<comments>http://www.alphablog.org/2012/05/07/simple-plugin-system-based-on-ninject-and-mvvm-light-2/#comments</comments>
		<pubDate>Sun, 06 May 2012 23:18:16 +0000</pubDate>
		<dc:creator>alphamax</dc:creator>
				<category><![CDATA[Tutoriaux C#]]></category>
		<category><![CDATA[Csharp]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.alphablog.org/?p=709</guid>
		<description><![CDATA[My goal was to develop a simple but useful plugin system for my future developments. I wanted to keep/to have: Blendability Ninject power and flexibility...]]></description>
			<content:encoded><![CDATA[<p>My goal was to develop a simple but useful plugin system for my future developments. I wanted to keep/to have:</p>
<ul>
<li>Blendability</li>
<li>Ninject power and flexibility</li>
<li>Smooth animations</li>
<li>Modularity (development &amp; code)</li>
<li>Fast “menu” system</li>
</ul>
<div>This sample rely on a solution available here : <a title="PluginSystem.zip" href="http://www.alphablog.org/wp-content/plugins/download-monitor/download.php?id=PluginSystem.zip" target="_blank">PluginSystem.zip</a></div>
<h2><strong><em><strong><em>Solution</em></strong></em></strong></h2>
<p><a href="http://www.alphablog.org/wp-content/uploads/11.png"><img class="alignnone size-full wp-image-710" title="1" src="http://www.alphablog.org/wp-content/uploads/11.png" alt="" width="525" height="440" /></a></p>
<p>The PluginSystem assembly contains the plugin base class, the view model base class and an animated content control.</p>
<p><span style="text-decoration: underline;">PluginBase class :</span></p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/mvvm/image2.png" alt="" /></p>
<p>This class force plugins to expose a user interface, an name (for menu printing in this case) and force overriding OnActivate and OnDeactivate methods.</p>
<p><span style="text-decoration: underline;">PluginViewModelBase class :</span></p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/mvvm/image3.png" alt="" /></p>
<p>This class is a simple layer over ViewModelBase defined in MVVM Light. The main difference is that it embeds the reference of the parent plugin. With this reference, the plugin can easily access to injected values for example.</p>
<p><span style="text-decoration: underline;">AnimatedContentControl class :</span></p>
<p>This usercontrol works like a commn ContentControl. There is one difference : if you change the content, it will animate it.</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/mvvm/image4.png" alt="" /></p>
<p>You can set AnimatedContent for the content, Delay, EasingFunction and Transition properties to customize the transition when you change the content.</p>
<h3>Main application side</h3>
<p>You can use the plugin system to get a dynamic menu:</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/mvvm/image5.png" alt="" /></p>
<ol>
<li>You can create a Ninject module for declaring plugin bindings.</li>
<li>Once done, we get all registered plugins by using Ninject Kernel</li>
<li>You set the list in your viewmodel</li>
<li>You bind the list to the view</li>
</ol>
<p>Last step is to bind the selected item’s user control to a content control (or an animated content control).</p>
<p>You can also use the plugin system to get static region system.</p>
<h3>Defining a new Plugin</h3>
<p>You need to create a new class library. Include some WPF libraries (System.Xaml, PresentationCore, PresentationFramework) and create a plugin definition file and a pluginVM file.</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/mvvm/image6.png" alt="" /></p>
<p>In this plugin file sample, you can set the “MainPart” property, create the view model and set it to the datacontext. Here is a sample:</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/mvvm/image7.png" alt="" /></p>
<h2>Blendability</h2>
<p>With this system you can keep “blendability” by using “Sample data” system from Blend. You will have your view model with design mode detection and capability to set custom data.</p>
<h2>Ninject power and flexibility</h2>
<p>Based on Ninject system, you keep all the power of Ninject. For example :</p>
<p>This module defines 3 plugins but also define sorting parameters based on “Name”</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/mvvm/image8.png" alt="" /></p>
<p>You can use this module for extracting only “FirstScreenable” plugins</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/mvvm/image9.png" alt="" /></p>
<p>(Plugin3 is a dependency for Plugin2 it must not be printed on the first screen)</p>
<p>On the other hand, you can rely on Ninject to inject something else than plugins.</p>
<h2>Smooth animations</h2>
<p>Thanks to the AnimatedContentControl, if you change the “AnimatedContent” property, you automatically start an animation. You can also see/try these animations inside Blend.</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/mvvm/image10.png" alt="" width="617" height="419" /></p>
<h2>Modularity (development &amp; code)</h2>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/mvvm/image11.png" alt="" /></p>
<p>As you can see, the main application is perfectly separated from plugins. Each team can work on a plugin without interact with other plugins.</p>
<h2><strong><em><strong><em>Why not using PRISM</em></strong></em></strong></h2>
<p>I have tried Prism during 20 minutes and I was not able to create a simple plugin system based on it. Moreover Prism4 documentation pdf file is more than 352 pages (too much to read for a simple modularity system). One of the best practice is KISS, keep it stupid simple! By the way, this simple plugin system took me less than 30 minutes to create !</p>
<h2>Associated files</h2>
<p>All sources are available for WPF here : <a title="PluginSystem.zip" href="http://www.alphablog.org/wp-content/plugins/download-monitor/download.php?id=PluginSystem.zip" target="_blank">PluginSystem.zip</a> Contact me if you need a port in Silverlight <img src='http://www.alphablog.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.alphablog.org/2012/05/07/simple-plugin-system-based-on-ninject-and-mvvm-light-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 5 and Tasks : strange behavior ! (Updated)</title>
		<link>http://www.alphablog.org/2012/04/11/silverlight-5-and-tasks-strange-behavior/</link>
		<comments>http://www.alphablog.org/2012/04/11/silverlight-5-and-tasks-strange-behavior/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 12:23:43 +0000</pubDate>
		<dc:creator>alphamax</dc:creator>
				<category><![CDATA[Tutoriaux techniques]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.alphablog.org/?p=677</guid>
		<description><![CDATA[This blog post aims to talk about a strange behavior of Silverlight when using TPL (Tasks parallel library) . Context &#160; You may need to integrate OData...]]></description>
			<content:encoded><![CDATA[<p>This blog post aims to talk about a strange behavior of Silverlight when using TPL (Tasks parallel library) .</p>
<h1>Context</h1>
<p>&nbsp;</p>
<p>You may need to integrate <strong>OData</strong> service in <strong>Silverlight</strong>. In this context, you could add your business code in the Silverlight part. It can result a sequence of asynchronous call in Silverlight (like Russian doll) :</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/tpl/image1.png" alt="" width="590" height="180" /></p>
<p><strong>When server raises an exception it must be propagated to the client</strong> (with or without message).</p>
<p>In my future example, I will try to create an address in AdventureWorks database, without filing mandatory fields, and asynchronously save it. The save MUST raise an exception. I will describe all methods used to do this.</p>
<h1>Acknowledgement</h1>
<h4>Version 1 <a href="http://www.alphablog.org/wp-content/uploads/OK.png"><img class="size-full wp-image-678 alignnone" title="OK" src="http://www.alphablog.org/wp-content/uploads/OK.png" alt="" width="22" height="22" /></a></h4>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/tpl/image2.png" alt="" /></p>
<p>The first version is fully functional and raises an exception in the callback. In a single call, we can&#8217;t see the difference but, in multiple and sequenced call, the process can be heavy.</p>
<p>Thanks to task parallel library, a new call system can be developed with Silverlight 5, based on Task.</p>
<h4>Version 2, with TPL – ContinueWith <a href="http://www.alphablog.org/wp-content/uploads/OK.png"><img title="OK" src="http://www.alphablog.org/wp-content/uploads/OK.png" alt="" width="22" height="22" /></a></h4>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/tpl/image3.png" alt="" width="607" height="252" /></p>
<p>The code below is also <strong>functional</strong>. We receive the exception and we can manage it.</p>
<h4>Version 3 – TPL Wait &amp; Result <a href="http://www.alphablog.org/wp-content/uploads/KO.png"><img class=" wp-image-679 alignnone" title="KO" src="http://www.alphablog.org/wp-content/uploads/KO.png" alt="" width="22" height="22" /></a></h4>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/tpl/image4.png" alt="" /></p>
<p>With or without the t.Wait(), t.Result must wait and block thread until result arrives. But this code is <strong>not functional</strong>. The test is a success without exception but it blocks when server raises an exception. I have done the same test in WPF (same server, same service, OData reference generated asynchronously) and <strong>WPF does not have this strange behavior</strong>.</p>
<h3>Version 4 – TPL Explicit exception <a href="http://www.alphablog.org/wp-content/uploads/OK.png"><img class="alignnone size-full wp-image-678" title="OK" src="http://www.alphablog.org/wp-content/uploads/OK.png" alt="" width="22" height="22" /></a></h3>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/tpl/image5.png" alt="" /></p>
<p>This version allow us to catch the exception on the Wait() call. This code is <strong>functional</strong>.</p>
<h1>Conclusion</h1>
<p>This peaces of code show us that a service exception is not caught/raised properly by Silverlight if you use Wait() or Result() without ContinueWith instruction…</p>
<p>Have you already experienced this strange behavior?</p>
<p>&nbsp;</p>
<p>PS : Here is the source code for my tests : <a title="SilverlightApplicationTPL.zip" href="http://www.alphablog.org/wp-content/plugins/download-monitor/download.php?id=SilverlightApplicationTPL.zip" target="_blank">SilverlightApplicationTPL.zip</a> (you may need AdventureWorks database and a local IIS)</p>
<p>&nbsp;</p>
<h1>Update</h1>
<p>One of my collegues ask me to check some points for the working and the non-working scenario :</p>
<p><strong>OData request :</strong> The OData request is perfectly send is both cases. Here is the fiddle traces :</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/Fiddler.png"><img class="alignnone size-full wp-image-696" title="Fiddler" src="http://www.alphablog.org/wp-content/uploads/Fiddler.png" alt="" width="1159" height="36" /></a></p>
<p><strong>In debug mode</strong>, it is clear that ContinueWith version will raise an exception &#8230;</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/Version2.png"><img class="alignnone size-full wp-image-697" title="Version2" src="http://www.alphablog.org/wp-content/uploads/Version2.png" alt="" width="816" height="288" /></a></p>
<p>&#8230;  and t.Result version has not any exception before calling t.Result and before program hangs :</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/Version3.png"><img class="alignnone size-full wp-image-699" title="Version3" src="http://www.alphablog.org/wp-content/uploads/Version3.png" alt="" width="796" height="285" /></a></p>
<p><strong>Output window</strong> : in both cases, we see that the version 2 perfectly raises exceptions :</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/Version2Output.png"><img class="alignnone size-full wp-image-701" title="Version2Output" src="http://www.alphablog.org/wp-content/uploads/Version2Output.png" alt="" width="924" height="82" /></a></p>
<p>But version 3 does not :</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/Version3Output.png"><img class="alignnone size-full wp-image-702" title="Version3Output" src="http://www.alphablog.org/wp-content/uploads/Version3Output.png" alt="" width="904" height="97" /></a></p>
<p>There is still no response <img src='http://www.alphablog.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.alphablog.org/2012/04/11/silverlight-5-and-tasks-strange-behavior/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why blend is for developers ?</title>
		<link>http://www.alphablog.org/2012/03/22/why-blend-is-for-developers/</link>
		<comments>http://www.alphablog.org/2012/03/22/why-blend-is-for-developers/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 21:38:30 +0000</pubDate>
		<dc:creator>alphamax</dc:creator>
				<category><![CDATA[Publications]]></category>
		<category><![CDATA[Tutoriaux techniques]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WindowsPhone7]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.alphablog.org/?p=610</guid>
		<description><![CDATA[During the TechDays 2012 conference, I have seen a course about “Blend for designers” from Michel Rousseau. It is now time to go on through...]]></description>
			<content:encoded><![CDATA[<p>During the TechDays 2012 conference, I have seen a course about “Blend for designers” from <a title="Micle Rousseau" href="http://www.michelrousseau.com/">Michel Rousseau</a>. It is now time to go on through this way:</p>
<ul>
<li>Blend is also for ergonomic specialist.</li>
<li>Blend is also for developers.</li>
</ul>
<p>How many times I have seen people saying :</p>
<p>“I am a developer so I develop the application and give it to the designer” : Without an ergonomic study before, you might create an application inside out, upside down and back-to-front…</p>
<p>“I am not a developer so I do not use Blend” : It is the biggest stupidity I have ever heard about Blend… I will prepare few samples that is usefull for developers inside Blend context.</p>
<p>What can be done in less than 15 seconds :</p>
<ul>
<li>Manage sample data and data sources</li>
<li>Create a template associated to a control</li>
<li>Edit a template</li>
<li>Create animation</li>
<li>Create states</li>
<li>Using external user controls</li>
<li>Edit shapes</li>
<li>UI design with usefull tools</li>
<li>Use and edit behaviors</li>
<li>Manage resources</li>
</ul>
<p>&nbsp;</p>
<h1>Manage sample data and data sources</h1>
<p>Panel for sample data management:</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image1.png" alt="" /></p>
<p>Simple click to add data from classes:</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image2.png" alt="" /></p>
<p>Edit data format for better result:</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image3.png" alt="" /></p>
<h1>Create a template associated to a control</h1>
<p>Accessible to right click over the control with contextual result:</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image4.png" alt="" /></p>
<p>You can create a “copy” of the existing template and going directly to edition or apply an existing one :</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image5.png" alt="" /></p>
<h1>Edit a template</h1>
<p>Edition of a template with instant result preview :</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image6.png" alt="" /></p>
<h1>Create animation</h1>
<p>Animation edition based on timeline, direct edition/key recording, direct result with play button:</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image7.png" alt="" /></p>
<h1>Create states</h1>
<p>Few clicks to create a group and populate it with states :</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image8.png" alt="" /></p>
<p>Easy to see transition type and directly see result without launching application :</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image9.png" alt="" /></p>
<h1>Using external user controls</h1>
<p>After build, capability to search for a custom user control, define in your project or in a referenced assembly :</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image10.png" alt="" /></p>
<h1>Edit shapes</h1>
<p>Capability to create a shape, edit it visualy, combining multiple shape (binary operation over multiple items), converting to paths items defined in the layout :</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image11.png" alt="" /></p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image12.png" alt="" /></p>
<p>&nbsp;</p>
<h1>UI design with usefull tools</h1>
<p>Display/Hide and Lock/Unlock object in object view to prevent unwanted edition</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image13.png" alt="" /></p>
<h1>Use and edit behaviors</h1>
<p>Once created in your project or referenced in an assembly, behavior can be created by drag and drop over the associated object.</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image14.png" alt="" /></p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image15.png" alt="" /></p>
<h1>Manage resources</h1>
<p>You can move resources for project re-factoring :</p>
<p><img style="display: inline;" src="http://www.alphablog.org/wp-content/plugins../../uploads/media/why-blend-is-also-for-developers-(1)/image16.png" alt="" /></p>
<p>&nbsp;</p>
<h1>Conclusion</h1>
<p>Here is few sample to boost productivity with blend without any graphic fancy stuff. It is just another helpfull tool but we MUST use it for all Xaml edition. I think it could be interisting for Html5 version of blend to propose same capabilities <img src='http://www.alphablog.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.alphablog.org/2012/03/22/why-blend-is-for-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Single web service for multiple devices (IPhone, Windows Phone, Silverlight, Windows 8)</title>
		<link>http://www.alphablog.org/2012/01/20/single-web-service-for-multiple-devices-iphone-windows-phone-silverlight-windows-8/</link>
		<comments>http://www.alphablog.org/2012/01/20/single-web-service-for-multiple-devices-iphone-windows-phone-silverlight-windows-8/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 17:04:09 +0000</pubDate>
		<dc:creator>alphamax</dc:creator>
				<category><![CDATA[Tutoriaux techniques]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Csharp]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WindowsPhone7]]></category>

		<guid isPermaLink="false">http://www.alphablog.org/?p=589</guid>
		<description><![CDATA[At Devoteam Luxembourg, our goal was to develop a cross platform application. We have developed a set of application based on a single &#8220;web services...]]></description>
			<content:encoded><![CDATA[<p>At Devoteam Luxembourg, our goal was to develop a cross platform application.</p>
<p>We have developed a set of application based on a single &#8220;web services server&#8221;.</p>
<ul>
<li>An IPhone, IPad, Android version with Sencha Touch</li>
<li>A Windows Phone 7 native version</li>
<li>A Silverlight version</li>
<li>A Windows 8 based on winRT version</li>
</ul>
<p>This article will only talk about consuming web services on this 4 versions.  We add some constraints like activating HTTPS for enhancing security, taking care of enhancing speed for mobile devices, etc &#8230; What is the conclusion of the adventure ?! <img src='http://www.alphablog.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="attachment_590" class="wp-caption alignnone" style="width: 467px"><a href="http://www.alphablog.org/wp-content/uploads/GlobalArchitecture.png"><img class="size-full wp-image-590" title="GlobalArchitecture" src="http://www.alphablog.org/wp-content/uploads/GlobalArchitecture.png" alt="Global architecture" width="457" height="287" /></a><p class="wp-caption-text">Global architecture</p></div>
<h1>Iphone, IPad and Android</h1>
<p>we had set up JSON for the first time for IPhone and it was easy in IPhone side. But WCF was a bit more lazy &#8230;</p>
<p>Here is a sample of service header :</p>
<pre class="brush:csharp">[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "SendRequest", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public string SendRequest(Stream multipartData)
{</pre>
<p>we had to parse the multipartData stream and transform the JSON string with the JavaScriptSerializer&#8230;</p>
<h1>Windows Phone</h1>
<p>WCF setup was more easy.</p>
<pre class="brush:csharp">[OperationContract]
public string SendRequest(string login, string password, int requestType, string startDate, string endDate, int startAM, int stopAM)
{</pre>
<p>but we had to develop an &#8220;automatic certificate installer&#8221; for windows phone, based on <a href="http://wp7certinstaller.codeplex.com/">http://wp7certinstaller.codeplex.com</a>. If the phone does not have the certificate, it will be redirected on a website. We can&#8217;t use not trusted webservices without installing the certificate. Same as silverlight and windows 8 behavior, we do not have access to the ServicePointManager :</p>
<pre>ServicePointManager.CertificatePolicy = delegate { return true; };</pre>
<h1>Silverlight</h1>
<p>The silverlight consume the same web service than windows phone. Otherwise, it was mandatory to install the client certificate.</p>
<h1>Windows 8</h1>
<p>Due to close timeline, we have give up installing https for Windows 8. We use Http binding over the windows phone web service. It only use an other endpoint on the Windows Phone.</p>
<h1>Summary</h1>
<p>The sheet below describe what we can do and with predefined configurations :</p>
<div id="attachment_592" class="wp-caption alignnone" style="width: 481px"><a href="http://www.alphablog.org/wp-content/uploads/Array.png"><img class="size-full wp-image-592" title="Array" src="http://www.alphablog.org/wp-content/uploads/Array.png" alt="" width="471" height="100" /></a><p class="wp-caption-text">Summary</p></div>
<p>For information here is the web.config :</p>
<pre class="brush:xml">&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;system.web&gt;
&lt;system.serviceModel&gt;
&lt;bindings&gt;
&lt;wsHttpBinding&gt;
&lt;binding name="IPhoneBinding"&gt;
&lt;security mode="Transport"&gt;
&lt;transport clientCredentialType="None" /&gt;
&lt;/security&gt;
&lt;/binding&gt;
&lt;/wsHttpBinding&gt;

&lt;basicHttpBinding&gt;
&lt;binding name="WP7Binding"&gt;
&lt;security mode="Transport"/&gt;
&lt;/binding&gt;
&lt;binding name="WP7BindingNoHttps"&gt;
&lt;/binding&gt;
&lt;/basicHttpBinding&gt;
&lt;/bindings&gt;

&lt;behaviors&gt;
&lt;endpointBehaviors&gt;
&lt;behavior name="WebBehavior"&gt;
&lt;webHttp /&gt;
&lt;/behavior&gt;
&lt;/endpointBehaviors&gt;

&lt;serviceBehaviors&gt;
&lt;behavior name="TimeOffServiceBehaviors"&gt;
&lt;serviceMetadata httpsGetEnabled="true" /&gt;
&lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
&lt;/behavior&gt;

&lt;behavior name="TimeOffApp.TimeOffServiceWP7Behavior"&gt;
&lt;serviceMetadata httpsGetEnabled="true" /&gt;
&lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
&lt;/behavior&gt;
&lt;/serviceBehaviors&gt;
&lt;/behaviors&gt;

&lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" /&gt;

&lt;services&gt;
&lt;service behaviorConfiguration="TimeOffServiceBehaviors" name="TimeOffApp.TimeOffService"&gt;
&lt;endpoint address="" behaviorConfiguration="WebBehavior" binding="wsHttpBinding" bindingConfiguration="IPhoneBinding"
name="IPhoneEP" contract="TimeOffApp.TimeOffService" /&gt;
&lt;/service&gt;
&lt;service behaviorConfiguration="TimeOffApp.TimeOffServiceWP7Behavior" name="TimeOffApp.TimeOffServiceWP7"&gt;
&lt;endpoint address="" binding="basicHttpBinding" bindingConfiguration="WP7Binding" contract="TimeOffApp.TimeOffServiceWP7" /&gt;
&lt;endpoint address="" binding="basicHttpBinding" bindingConfiguration="WP7BindingNoHttps" contract="TimeOffApp.TimeOffServiceWP7" /&gt;
&lt;/service&gt;
&lt;/services&gt;
&lt;/system.serviceModel&gt;
&lt;/system.web&gt;
&lt;/configuration&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.alphablog.org/2012/01/20/single-web-service-for-multiple-devices-iphone-windows-phone-silverlight-windows-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips and tricks : Silverlight autocompletebox with huge amount of data</title>
		<link>http://www.alphablog.org/2011/12/11/tips-and-tricks-silverlight-autocompletebox-with-huge-amount-of-data/</link>
		<comments>http://www.alphablog.org/2011/12/11/tips-and-tricks-silverlight-autocompletebox-with-huge-amount-of-data/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 16:22:32 +0000</pubDate>
		<dc:creator>alphamax</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutoriaux]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.alphablog.org/?p=567</guid>
		<description><![CDATA[This new post will explain the ability to use the autocomplete box with more than 10 000 items in the list. It will result an...]]></description>
			<content:encoded><![CDATA[<p>This new post will explain the ability to use the autocomplete box with more than 10 000 items in the list. It will result an unpleasant latency&#8230; It will freeze your user interface during seconds !</p>
<h1></h1>
<h1>The silverlight solution</h1>
<p>You just need to add the System.Windows.Control reference.</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/1.png"><img class="alignnone size-full wp-image-568" title="1" src="http://www.alphablog.org/wp-content/uploads/1.png" alt="" width="339" height="331" /></a></p>
<p>The main page Xaml is like described below :</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/2.png"><img class="alignnone size-full wp-image-569" title="2" src="http://www.alphablog.org/wp-content/uploads/2.png" alt="" width="574" height="165" /></a></p>
<h1></h1>
<h1>Generate items</h1>
<p>Here is the little code that generate 12 000 lines and put it to the itemsource :</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/3.png"><img class="alignnone size-full wp-image-570" title="3" src="http://www.alphablog.org/wp-content/uploads/3.png" alt="" width="555" height="301" /></a></p>
<p>You can run the sample at this time. There is a 10 sec latency (dependant to your computer power)&#8230;</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/4.png"><img class="alignnone size-full wp-image-571" title="4" src="http://www.alphablog.org/wp-content/uploads/4.png" alt="" width="319" height="590" /></a></p>
<h1></h1>
<h1>Solve the problem</h1>
<p>We will use blend to speed up development and show the simplest way to produce this solution.</p>
<p>At this time you need to edit the general template (Edit a copy, not create a blank one) :</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/5.png"><img class="alignnone size-full wp-image-572" title="5" src="http://www.alphablog.org/wp-content/uploads/5.png" alt="" width="520" height="495" /></a></p>
<p>&nbsp;</p>
<p>And edit the &#8220;ItemPanel&#8221; of your selector :</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/6.png"><img class="alignnone size-full wp-image-573" title="6" src="http://www.alphablog.org/wp-content/uploads/6.png" alt="" width="636" height="403" /></a></p>
<p>&nbsp;</p>
<p>You must replace the &#8220;StackPanel&#8221; with a VirtualizingStackPanel:</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/7-1.png"><img class="alignnone size-full wp-image-574" title="7-1" src="http://www.alphablog.org/wp-content/uploads/7-1.png" alt="" width="316" height="50" /></a> <strong>&#8211;&gt;</strong> <a href="http://www.alphablog.org/wp-content/uploads/7-2.png"><img class="alignnone size-full wp-image-575" title="7-2" src="http://www.alphablog.org/wp-content/uploads/7-2.png" alt="" width="318" height="52" /></a></p>
<p>At this point you mzy think you have finished but, if you run your solution, you will see it remains the latency.</p>
<h1></h1>
<h1>Final tips</h1>
<p>The tricky trick is to add a MaxHeight that force the system to generate a maximum of 250px of ItemTemplate</p>
<p><a href="http://www.alphablog.org/wp-content/uploads/8.png"><img class="alignnone size-full wp-image-576" title="8" src="http://www.alphablog.org/wp-content/uploads/8.png" alt="" width="526" height="66" /></a></p>
<p>&nbsp;</p>
<h1>Sources</h1>
<p>Sources are available <a href="http://www.alphablog.org/TiercePartie/DemoFiles/AutocompleteVirtualized.zip">here</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alphablog.org/2011/12/11/tips-and-tricks-silverlight-autocompletebox-with-huge-amount-of-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7 Coding Dojo</title>
		<link>http://www.alphablog.org/2011/10/22/windows-phone-coding-dojo/</link>
		<comments>http://www.alphablog.org/2011/10/22/windows-phone-coding-dojo/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 07:38:00 +0000</pubDate>
		<dc:creator>alphamax</dc:creator>
				<category><![CDATA[Tutoriaux C#]]></category>
		<category><![CDATA[Tutoriaux techniques]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Csharp]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Tutoriaux]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WindowsPhone7]]></category>

		<guid isPermaLink="false">http://www.alphablog.org/?p=538</guid>
		<description><![CDATA[Here is a video showing how to create a simple but useful Windows Phone 7 application. This application allow Devoteam Luxembourg&#8217;s consultant to add and...]]></description>
			<content:encoded><![CDATA[<p>Here is a video showing how to create a <strong>simple but useful Windows Phone 7 application</strong>. This application allow <a href="http://devoteam.lu/" target="_blank">Devoteam Luxembourg&#8217;s consultant</a> to add and follow their time off requests.</p>
<p>This application use web services based on Object Client for SharePoint. We will only see the Blend 4 part and the Visual Studio for windows phone development.</p>
<p>I only use <a title="MVVM Light" href="http://mvvmlight.codeplex.com/" target="_blank">MVVM Light</a> (as usual :p) as external framework. I have already done the link between the &#8220;enum application state&#8221; and the &#8220;data state mechanism&#8221; (<a title="Coding dojo Silverlight" href="/2011/08/07/coding-dojo-silverlight/">see previous coding dojo for more details</a>). I have set up MVVM Light with NuGet <img src='http://www.alphablog.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (<a title="NuGet, the director’s baton for Visual Studio" href="/2011/09/09/nuget-the-directors-baton/">see details on NuGet</a>)</p>
<p>The first video show <strong>how you can set up the project and create quick content</strong> (approx 1h). The second video show the <strong>capability of the application, on normal usage</strong>.</p>
<p><div id="silverlightControlHost"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="640" height="360"><param name="source" value="http://www.alphablog.org/TiercePartie/BankExpenseChart/VideoPlayer.xap"/><param name="background" value="white" /><param name="minRuntimeVersion" value="3.0.40723.0" /><param name="autoupgrade" value="true" /><param name="enableHtmlAccess" value="true" /><param name="initParams" value="cc=true,m=http://www.alphablog.org/TiercePartie/Video/TimeOffCodingDojo.wmv" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156" style="text-decoration: none;"><img src="http://storage.timheuer.com/sl4wp-ph.png" alt="Install Microsoft Silverlight" style="border-style: none; width:400px; height:200px"/></a></object><iframe style="visibility:hidden;height:0;width:0;border:0px" id="_sl_historyFrame"></iframe></div><br /><br />
<div id="silverlightControlHost"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="270" height="480"><param name="source" value="http://www.alphablog.org/TiercePartie/BankExpenseChart/VideoPlayer.xap"/><param name="background" value="white" /><param name="minRuntimeVersion" value="3.0.40723.0" /><param name="autoupgrade" value="true" /><param name="enableHtmlAccess" value="true" /><param name="initParams" value="cc=true,m=http://www.alphablog.org/TiercePartie/Video/TimeOffWP7.wmv" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156" style="text-decoration: none;"><img src="http://storage.timheuer.com/sl4wp-ph.png" alt="Install Microsoft Silverlight" style="border-style: none; width:400px; height:200px"/></a></object><iframe style="visibility:hidden;height:0;width:0;border:0px" id="_sl_historyFrame"></iframe></div><br /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alphablog.org/2011/10/22/windows-phone-coding-dojo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.alphablog.org/TiercePartie/Video/TimeOffCodingDojo.wmv" length="348777613" type="video/asf" />
<enclosure url="http://www.alphablog.org/TiercePartie/Video/TimeOffWP7.wmv" length="2373473" type="video/asf" />
		</item>
		<item>
		<title>Siverlight Architecture Feedback (Part 2/2)</title>
		<link>http://www.alphablog.org/2011/10/14/siverlight-architecture-feedback-part-22/</link>
		<comments>http://www.alphablog.org/2011/10/14/siverlight-architecture-feedback-part-22/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 21:05:13 +0000</pubDate>
		<dc:creator>alphamax</dc:creator>
				<category><![CDATA[Publications]]></category>
		<category><![CDATA[Csharp]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.alphablog.org/?p=524</guid>
		<description><![CDATA[This article follow the previous one : Part 1 &#160; We will now detail much more validation integration in the generated context. Here is a...]]></description>
			<content:encoded><![CDATA[<p>This article follow the previous one : <a title="Siverlight Architecture Feedback (Part 1/2)" href="/2011/10/10/siverlight-architecture-feedback-part-12/" target="_blank">Part 1</a></p>
<p>&nbsp;</p>
<p>We will now detail much more validation integration in the generated context.</p>
<div id="attachment_526" class="wp-caption alignnone" style="width: 584px"><a href="http://www.alphablog.org/wp-content/uploads/Diapositive5.png"><img class="size-full wp-image-526  " title="Validation" src="http://www.alphablog.org/wp-content/uploads/Diapositive5.png" alt="How validation is integrated" width="574" height="373" /></a><p class="wp-caption-text">How validation is integrated</p></div>
<p>Here is a schema that summarize the validation integration.</p>
<ul>
<li>The generated part (left side) is the MVVM DTO, processed from the edmx file. This file will be linked in the model in silverlight side. This part is absolutely not correlated with validation.</li>
<li>The other partial class (right side) is added by user and can embed multiple information (extra properties, methods, &#8230;) and, in this case, flag the class and say it can be validated.</li>
<li>The last part (below) is the validation definition. You can embed each rule in the constructor of the class.</li>
</ul>
<div>If you link in the Silverlight model package this three classes, you will benefit from validation on client side. This validation model is totally integrated by the Silverlight technology. Setting up the validation in the view by adding &#8220;ValidatesOnDataErrors=True&#8221;. With this modification, all validation problems will be raised to the user (on update binding). Bonus is to add &#8220;ValidatesOnExceptions=True&#8221;. You will now raise validations warning on system exception (like conversion problem, setting a string on a float property&#8230;)</div>
<div id="attachment_528" class="wp-caption alignnone" style="width: 595px"><a href="http://www.alphablog.org/wp-content/uploads/DiapositiveN.png"><img class="size-full wp-image-528    " title="Binding definition" src="http://www.alphablog.org/wp-content/uploads/DiapositiveN.png" alt="Binding sample" width="585" height="12" /></a><p class="wp-caption-text">Binding sample</p></div>
<p>The last step of this article is exposing what i am generally using in Silverlight/WPF programs. Some of them are from other sources.</p>
<div id="attachment_527" class="wp-caption alignnone" style="width: 245px"><a href="http://www.alphablog.org/wp-content/uploads/Diapositive6.png"><img class="size-full wp-image-527" title="Package view" src="http://www.alphablog.org/wp-content/uploads/Diapositive6.png" alt="Package helpers view" width="235" height="405" /></a><p class="wp-caption-text">Package helpers view</p></div>
<h2> Behaviors</h2>
<ul>
<li><span style="text-decoration: underline;">BindVisualStateBehavior </span>: Link an enum property of your VM and, on changes, invoke a &#8220;change state&#8221; in the view. The main goal is to define a Laoding/Loaded state, an Error/NoError state, an Application state and allow user to orchestrate your silverlight application only by changing an enum value.</li>
<li>BackToStateBehavior : On a specific action, set an enum to a specified binded property.</li>
<li><span style="text-decoration: underline;">KeyPressSelecterComboboxBehavior </span>: On a user letter key press , select combobox item starting by the item.</li>
<li><span style="text-decoration: underline;">NotNullCheckboxBehavior </span>: When someone set null to a checkbox, it will automatically be modified to false. Fighting against bad database format <img src='http://www.alphablog.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li><span style="text-decoration: underline;">RadioButtonToValueBehavior </span>: When a radio is checked, set the specified value to a linked property. Usefull to link radio button group to value.</li>
<li><span style="text-decoration: underline;">SecurityBehavior </span>: This behavior is linked to a list of &#8220;Role&#8221; and, if a specified role is not found in the list, it hides the associated object.</li>
<li><span style="text-decoration: underline;">UpdateBindingOnTextChangedBehavior </span>: On each key press, update the text binding.</li>
<li><span style="text-decoration: underline;">ValueToVisibilityBehavior </span>: Only show the associated object if a linked property is equal to a specified value.</li>
</ul>
<h2>Converters</h2>
<ul>
<li><span style="text-decoration: underline;">BirthDateConverter </span>: A simple converter to change a DateTime to a specified format.</li>
<li><span style="text-decoration: underline;">VisibilityConveter (&amp; Inverted version)</span> : Convert a boolean to visibility</li>
<li><span style="text-decoration: underline;">VisibilityFromDataConverter (&amp; Inverted version)</span> : Test if the data is null and transform the result to visibility.</li>
</ul>
<h2></h2>
]]></content:encoded>
			<wfw:commentRss>http://www.alphablog.org/2011/10/14/siverlight-architecture-feedback-part-22/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Siverlight Architecture Feedback (Part 1/2)</title>
		<link>http://www.alphablog.org/2011/10/10/siverlight-architecture-feedback-part-12/</link>
		<comments>http://www.alphablog.org/2011/10/10/siverlight-architecture-feedback-part-12/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 23:15:27 +0000</pubDate>
		<dc:creator>alphamax</dc:creator>
				<category><![CDATA[Publications]]></category>
		<category><![CDATA[Csharp]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.alphablog.org/?p=501</guid>
		<description><![CDATA[Thanks to Devoteam Luxembourg, i am actually setting up a Silverlight architecture but it was not my first practice&#8230; I have already setup Silverlight architectures over...]]></description>
			<content:encoded><![CDATA[<p>Thanks to Devoteam Luxembourg, i am actually setting up a Silverlight architecture but it was not my first practice&#8230; I have already setup Silverlight architectures over a service layer. In most cases, i found some great shortcuts, some tips about what can be done and what can&#8221;t be done. My brainstorm result will be explained in this paper.</p>
<h1></h1>
<h1>Uses cases</h1>
<p>Since few years, I am practicing Silverlight in a business context. In each cases clients ask us to develop a user interface with business logic and persistency. Most of time, clients wanted a CRUD application with a nice user interface.</p>
<p>&nbsp;</p>
<h1>Target</h1>
<p>Theses software had to manage complex data and, for each data type, must:</p>
<ul>
<li>Have a read only view,</li>
<li>Have a write view,</li>
<li>Manage complex properties/navigation properties by adding or removing sub items,</li>
<li>Have a corporate view and an innovative user experience,</li>
</ul>
<p>&nbsp;</p>
<p>I have proposed approximately the same architecture, even with my experience feedback… Silverlight over SOA was for me the solution by design for many requirements.</p>
<ul>
<li>Multi-User</li>
<li>Less deployment problems</li>
<li>Expose services/resources for others</li>
</ul>
<div id="attachment_502" class="wp-caption alignnone" style="width: 226px"><a href="http://www.alphablog.org/wp-content/uploads/Diapositive1.png"><img class="size-full wp-image-502" title="Global" src="http://www.alphablog.org/wp-content/uploads/Diapositive1.png" alt="Global architecture Silverlight" width="216" height="276" /></a><p class="wp-caption-text">Simplified architecture</p></div>
<p>&nbsp;</p>
<h1><span class="Apple-style-span" style="font-size: 20px;">Sample of my last project packages</span></h1>
<div id="attachment_505" class="wp-caption alignnone" style="width: 535px"><a href="http://www.alphablog.org/wp-content/uploads/Diapositive4.png"><img class="size-full wp-image-505 " title="Package diagram" src="http://www.alphablog.org/wp-content/uploads/Diapositive4.png" alt="" width="525" height="264" /></a><p class="wp-caption-text">Detailed package diagram</p></div>
<p>The (L) icon says that files are &#8220;add as link&#8221; under the project. In this case, changing it in the first and real reference says that you change it where the file is linked.</p>
<h1>Tools &amp; Technologies</h1>
<p>Through <a title="NuGet" href="http://nuget.codeplex.com/" target="_blank">NuGet</a>, I am using <a title="MVVM Light" href="http://mvvmlight.codeplex.com/" target="_blank">MVVM Light</a>, Entity Framework 4 and also T4 code generation from Microsoft with a <a title="T4 Editor" href="http://visualstudiogallery.msdn.microsoft.com/60297607-5fd4-4da4-97e1-3715e90c1a23" target="_blank">T4 editor</a>.</p>
<h1>In details</h1>
<p>&nbsp;</p>
<div id="attachment_503" class="wp-caption alignnone" style="width: 536px"><a href="http://www.alphablog.org/wp-content/uploads/Diapositive2.png"><img class="size-full wp-image-503 " title="From database to classes" src="http://www.alphablog.org/wp-content/uploads/Diapositive2.png" alt="From database to classes" width="526" height="274" /></a><p class="wp-caption-text">From database to classes</p></div>
<p>Based upon the database, I create an EDMX file that generate the persistency layer and the POCO files. This POCO files embed all the entity framework persistence layer. Also based upon the EDMX file, a T4 file can generate the DTO in MVVM Light format and the AutoMapper configuration.</p>
<p>The T4 generator is a fork of the Self Tracking Entity version. It generates one file per class for the DTO and one global file that define the AutoMapper’s configuration.</p>
<p>In this configuration, changing the data format or the data source allow developer to be more reactive. They have to adjust web services and views.</p>
<p>DTO choice allow developer to extend the generated pack by custom DTOs. For example in auto-completion features.</p>
<p><span class="Apple-style-span" style="font-size: 20px; font-weight: bold;">The generated MVVM DTO</span></p>
<p>This file will contain one MVVM property for each corresponding property in the given class (with RaisePropertyChange call for example).</p>
<h2>The generated AutoMapper configuration</h2>
<p>It will generate the configuration from POCO to DTO (full copy) and from DTO to POCO preventing copy of primary key, complex and navigation properties.</p>
<h2>The data transfer</h2>
<p>&nbsp;</p>
<div id="attachment_504" class="wp-caption alignnone" style="width: 538px"><a href="http://www.alphablog.org/wp-content/uploads/Diapositive3.png"><img class="size-full wp-image-504 " title="Data migration" src="http://www.alphablog.org/wp-content/uploads/Diapositive3.png" alt="Data migration through layers" width="528" height="389" /></a><p class="wp-caption-text">Data migration/conversion through layers</p></div>
<p>We will now describe how the data will evolve in the architecture.</p>
<p>The data is actually stored in the database. Through a LinQ request, the business layer will find the data and Entity Framework will fill a POCO. By default, the lazy loading is disabled. It will prevent loading the entire database with AutoMapper or serialization. User must say which data is needed. Once the POCO filled, AutoMapper can transfer data from it to a new DTO before sending it through WCF.</p>
<p>Silverlight will receive data and can directly bind it on views.</p>
<p>On the other way, Silverlight can modify the principal data and send it back to the server. Business layer will receive a DTO. If it already exists, load it and write over thanks to AutoMapper. If it doesn’t exist, it will add data to the persistency layer.</p>
<p>Helped with a static method, it is possible to “merge lists” for hierarchical entities. You can find the script below and discover the target of the function. This is inspired from the <a title="stackoverflow thread solution exposed here" href="http://stackoverflow.com/questions/1633320/reconciling-a-new-bindinglist-into-a-master-bindinglist-using-linq" target="_blank">stackoverflow thread solution exposed here</a>.</p>
<pre class="brush:csharp">public static void Reconcile(EntityCollection databaseList,
                                           ObservableCollection dtoList,
                                           Func keySelector,
                                           Func keySelectorDTO,
                                           Func databaseFinder) where T : class where TDTO : class
        {
            Dictionary databaseDict = databaseList.ToDictionary(key =&gt; keySelector(key));

            foreach (TDTO dtoObj in dtoList)
            {
                int key = keySelectorDTO(dtoObj);
                T databaseObj = null;

                if (databaseDict.TryGetValue(key, out databaseObj))
                {
                    databaseDict.Remove(key);
                }
                else
                {
                    T databaseObjFound = databaseFinder(key);
                    if (databaseObjFound != null)
                    {
                        databaseList.Add(databaseObjFound);
                    }
                }
            }

            foreach (T removed in databaseDict.Values)
            {
                databaseList.Remove(removed);
            }
        }</pre>
<p>&nbsp;</p>
<h2>Validation</h2>
<p>Validation can be setup by creating a partial class and adding the validation helped with FluentValidation. You can setup validation server side and add a link of the partial class client side. With this configuration, <strong>you can add client side only, server side only or both if you want</strong>.</p>
<p><a href="http://www.emidee.net/blog/index.php/post/2010/06/28/%5BPostSharp%5D-%5BFluentValidation%5D-Validation-de-classes-gr%C3%A2ce-%C3%A0-IDataErrorInfo" target="_blank">The validation details can be found here</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alphablog.org/2011/10/10/siverlight-architecture-feedback-part-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blend 5 and Visual Studio 11 feedback, the Windows 8 development future</title>
		<link>http://www.alphablog.org/2011/09/17/blend-5-and-visual-studio-11-feedback-the-windows-8-development-future/</link>
		<comments>http://www.alphablog.org/2011/09/17/blend-5-and-visual-studio-11-feedback-the-windows-8-development-future/#comments</comments>
		<pubDate>Sat, 17 Sep 2011 14:10:16 +0000</pubDate>
		<dc:creator>alphamax</dc:creator>
				<category><![CDATA[Tutoriaux C#]]></category>
		<category><![CDATA[Csharp]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Logiciels]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Windows 8]]></category>

		<guid isPermaLink="false">http://www.alphablog.org/?p=464</guid>
		<description><![CDATA[Here is a little feedback on Visual Studio 11 &#38; Blend 5&#8230; 1 &#8211; Visual Studio 11 Visual Studio 11 is provided in the Windows...]]></description>
			<content:encoded><![CDATA[<p>Here is a little feedback on Visual Studio 11 &amp; Blend 5&#8230;</p>
<h1><span style="text-decoration: underline;">1 &#8211; Visual Studio 11</span></h1>
<p>Visual Studio 11 is provided in the Windows 8 Developer Version. It is provided with some &#8220;Metro Application Style&#8221; templates. One first thing we can notice is that VS11 is very similar to VS10&#8230; Microsoft added usefull features detailed below. I am quite disapointed about Microsoft political point of view about Xaml Language and Html5/JavaScript&#8230;</p>
<h2>Fast file preview</h2>
<div id="attachment_466" class="wp-caption alignnone" style="width: 718px"><a href="http://www.alphablog.org/wp-content/uploads/img2.jpg"><img class="size-full wp-image-466" title="File preview in Visual Studio 11" src="http://www.alphablog.org/wp-content/uploads/img2.jpg" alt="File preview in Visual Studio 11" width="708" height="300" /></a><p class="wp-caption-text">File preview in Visual Studio 11</p></div>
<p>You may know that Visual Studio is multi-tab layered. But, when you &#8220;simple-click&#8221; on a file in the file treeview, a new tab stacked on the left will appear. It will provide you a quick preview of the file content.</p>
<h2>Quick search in Solution</h2>
<div id="attachment_467" class="wp-caption alignnone" style="width: 359px"><a href="http://www.alphablog.org/wp-content/uploads/img3.jpg"><img class="size-full wp-image-467" title="Visual Studio 11 research in project" src="http://www.alphablog.org/wp-content/uploads/img3.jpg" alt="Visual Studio 11 research in project" width="349" height="387" /></a><p class="wp-caption-text">Visual Studio 11 research in project</p></div>
<p>Visual studio embed now a search field just above the file treeview. You can now look for a file, a class, a method or a field in few seconds. It will enhance our productivity incredibly.</p>
<h2>Quick Search Command</h2>
<div id="attachment_468" class="wp-caption alignnone" style="width: 354px"><a href="http://www.alphablog.org/wp-content/uploads/img4.jpg"><img class="size-full wp-image-468" title="Visual Studio 11 research commands" src="http://www.alphablog.org/wp-content/uploads/img4.jpg" alt="Visual Studio 11 research commands" width="344" height="458" /></a><p class="wp-caption-text">Visual Studio 11 research commands</p></div>
<p>You can also search for a command through the search field in the Visual Studio Toolbar and access quickly for all available commands.</p>
<h2>Some &#8220;Metro Style Application&#8221; samples</h2>
<p><a href="http://www.alphablog.org/wp-content/uploads/img8.jpg"><img class="size-full wp-image-472" title="Metro Style 1" src="http://www.alphablog.org/wp-content/uploads/img8.jpg" alt="Metro Style 1" width="264" height="151" /></a><a href="http://www.alphablog.org/wp-content/uploads/img7.jpg"><img class="size-full wp-image-471" title="Metro Style 2" src="http://www.alphablog.org/wp-content/uploads/img7.jpg" alt="Metro Style 2" width="263" height="150" /></a></p>
<p><a href="http://www.alphablog.org/wp-content/uploads/img6.jpg"><img class=" alignnone" title="Metro Style 3" src="http://www.alphablog.org/wp-content/uploads/img6.jpg" alt="Metro Style 3" width="265" height="154" /></a><a href="http://www.alphablog.org/wp-content/uploads/img5.jpg"><img class="size-full wp-image-469 alignnone" title="Metro Style 4" src="http://www.alphablog.org/wp-content/uploads/img5.jpg" alt="Metro Style 4" width="267" height="154" /></a></p>
<p>Visual Studio provide us few templates and show us how &#8220;Metro Style Application&#8221; can be.</p>
<h1><span style="text-decoration: underline;">2 &#8211; Blend 5</span></h1>
<p>Blend 5 is provided for testing JavaScript/Html5 solution for Windows 8. I used to work with Blend 4 for Silverlight and lots of features that was available and allow me to produce a fast/clean solution is not available for Html5/JavaScript solution&#8230; For example, binding states to an enum property&#8230; But in the JavaScript/Html5, there is no state or even storyboard. Blend is a JavaScript/Html5 WYSIWYG editor in this specific case &#8230;</p>
<h2>Where are my tools ?</h2>
<div id="attachment_475" class="wp-caption alignnone" style="width: 60px"><a href="http://www.alphablog.org/wp-content/uploads/img11.jpg"><img class="size-full wp-image-475" title="Blend tools" src="http://www.alphablog.org/wp-content/uploads/img11.jpg" alt="Blend tools" width="50" height="244" /></a><p class="wp-caption-text">Blend tools</p></div>
<p>This is the only tools you have in the JavaScript/Html5 version of Blend <img src='http://www.alphablog.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<h2>Assets, generated parts &amp; Javascript</h2>
<div id="attachment_476" class="wp-caption alignnone" style="width: 402px"><a href="http://www.alphablog.org/wp-content/uploads/img12.jpg"><img class="size-full wp-image-476" title="Blend static and generated parts" src="http://www.alphablog.org/wp-content/uploads/img12.jpg" alt="Blend static and generated parts" width="392" height="549" /></a><p class="wp-caption-text">Blend static and generated parts</p></div>
<p>Here is a sample of a rating &#8220;control&#8221; in Blend 5. As you can see, the rating control will create a div and &#8220;generate elements inside&#8221; (elements with a lightning near the eye). You can access the div and do your stuff on the JavaScript side.</p>
<h2>Long long long CSS train &#8230;</h2>
<div id="attachment_477" class="wp-caption alignnone" style="width: 383px"><a href="http://www.alphablog.org/wp-content/uploads/img13.jpg"><img class="size-full wp-image-477" title="CSS big world" src="http://www.alphablog.org/wp-content/uploads/img13.jpg" alt="CSS big world" width="373" height="970" /></a><p class="wp-caption-text">CSS big world</p></div>
<p>Once unfolded, CSS properties are numerous&#8230;</p>
<h2>Plateform testing</h2>
<div id="attachment_478" class="wp-caption alignnone" style="width: 423px"><a href="http://www.alphablog.org/wp-content/uploads/img14.jpg"><img class="size-full wp-image-478" title="Blend platform testing" src="http://www.alphablog.org/wp-content/uploads/img14.jpg" alt="Blend platform testing" width="413" height="408" /></a><p class="wp-caption-text">Blend platform testing</p></div>
<p>Your application can be tester under multiple format. This is a good point of Blend 5. You can also activate an emulator for directly seeing the result. Here is the result in the emulator :</p>
<div id="attachment_479" class="wp-caption alignnone" style="width: 587px"><a href="http://www.alphablog.org/wp-content/uploads/img15.jpg"><img class="size-full wp-image-479" title="Blend emulator" src="http://www.alphablog.org/wp-content/uploads/img15.jpg" alt="Blend emulator" width="577" height="352" /></a><p class="wp-caption-text">Blend emulator</p></div>
<p>&nbsp;</p>
<h2>Files created in a new Html5/Javascript</h2>
<div id="attachment_474" class="wp-caption alignnone" style="width: 322px"><a href="http://www.alphablog.org/wp-content/uploads/img10.jpg"><img class="size-full wp-image-474" title="JavaScript project files" src="http://www.alphablog.org/wp-content/uploads/img10.jpg" alt="JavaScript project files" width="312" height="866" /></a><p class="wp-caption-text">JavaScript project files</p></div>
<p>Here is the project content created for an Html5/JavaScript project.</p>
<h2>Good features nevertheless &#8230;</h2>
<div id="attachment_480" class="wp-caption alignnone" style="width: 589px"><a href="http://www.alphablog.org/wp-content/uploads/img16.jpg"><img class="size-full wp-image-480" title="CSS identification" src="http://www.alphablog.org/wp-content/uploads/img16.jpg" alt="CSS identification" width="579" height="479" /></a><p class="wp-caption-text">CSS identification</p></div>
<p>Some good features are added inside Blend 5&#8230; You can fly over a CSS Style and see where it is applied.</p>
<p>&nbsp;</p>
<h1> Conclusion</h1>
<p>I am worry about Silverlight/WPF/Xaml-Based future for many reasons.</p>
<ol>
<li>I have seen lots of Silverlight developers that doesn&#8217;t know how to use Blend&#8230; (too many &#8230;)</li>
<li>Microsoft only talk about Html5 and JavaScript in their meetings&#8230;</li>
</ol>
<div>But, we have a <strong>big advantage</strong>. True Silverlight developers can create more shiny application in a shorter time than with Html5/JavaScript &#8230; <span style="text-decoration: underline;"><strong>And C# will always be smarter than JavaScript <img src='http://www.alphablog.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.alphablog.org/2011/09/17/blend-5-and-visual-studio-11-feedback-the-windows-8-development-future/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>NuGet, the director&#8217;s baton for Visual Studio</title>
		<link>http://www.alphablog.org/2011/09/09/nuget-the-directors-baton/</link>
		<comments>http://www.alphablog.org/2011/09/09/nuget-the-directors-baton/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 10:29:19 +0000</pubDate>
		<dc:creator>alphamax</dc:creator>
				<category><![CDATA[General advises]]></category>
		<category><![CDATA[Csharp]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Logiciels]]></category>
		<category><![CDATA[Tutoriaux]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WindowsPhone7]]></category>

		<guid isPermaLink="false">http://www.alphablog.org/?p=445</guid>
		<description><![CDATA[I&#8217;am actually a .Net developer but &#8220;developer&#8221; is a stretch of language&#8230; We are now integrators as well as developers ! Microsoft feels the difference many times ago...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.alphablog.org/wp-content/uploads/NuGetLogo.png"><img class="alignleft size-full wp-image-447" title="NuGetLogo" src="http://www.alphablog.org/wp-content/uploads/NuGetLogo.png" alt="" width="229" height="64" /></a>I&#8217;am actually a .Net developer but &#8220;developer&#8221; is a stretch of language&#8230; We are now integrators as well as developers !</p>
<p>Microsoft feels the difference many times ago and add a new step between integrators and developers. It&#8217;s called <span style="text-decoration: underline;">NuGet</span>.</p>
<p>I was creating a new Windows Phone application and, in my disturbed mind, i was wondering if i could create a universal &#8220;Windows Phone 7 development starter kit&#8221;. Well &#8230; After bringing me down to earth, i only installed NuGet.</p>
<p><span style="text-decoration: underline;"><strong>What is NuGet ?</strong></span></p>
<p>NuGet can be compared as Synaptic for an OS or MarketPlace for a device but it is for a development project. You can download a vsix file (add-in) from this page : <a href="http://nuget.org/">http://nuget.org/</a></p>
<p>After downloading and installing it, <strong>you own all 2845 framework at your fingertips</strong> ! (At this time)</p>
<p>Now you can create a blank Windows Phone 7 project and launch NuGet.</p>
<p>Through an efficient windows, you can find &#8220;frameworks&#8221; on the web.</p>
<div id="attachment_448" class="wp-caption alignnone" style="width: 609px"><a href="http://www.alphablog.org/wp-content/uploads/manage-nuget-packages-solution-dialog.png"><img class="size-full wp-image-448   " title="Nuget packet manager" src="http://www.alphablog.org/wp-content/uploads/manage-nuget-packages-solution-dialog.png" alt="" width="599" height="415" /></a><p class="wp-caption-text">NuGet and Framework selection</p></div>
<p>&nbsp;</p>
<p>When you add a new framework to your project, NuGet will install dependencies locally, in your project, add them to your project and do some helpful tasks like adding helpers and classes.</p>
<p>For example, with MVVMLight, it will :</p>
<ul>
<li>Download references for Windows Phone 7 project</li>
<li>Add it locally (not in Program Files or other &#8230;)</li>
<li>Add references to your project</li>
<li>Automatically add the ServiceLocator class and insert it&#8217;s reference the App.xaml file</li>
<li>Automatically add the MainViewModel !</li>
</ul>
<div>How many time did you save ? Many minutes !</div>
<div>It is exactly the same process for the Windows Phone 7 Toolkit. No need to download it, install it and reference it&#8230;</div>
<div>With this new &#8220;conception process&#8221;, you will be able to build an application more quickly and use this time gain to debug, drink a coffee or &#8230; write a paper <img src='http://www.alphablog.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
]]></content:encoded>
			<wfw:commentRss>http://www.alphablog.org/2011/09/09/nuget-the-directors-baton/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

