<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.southworks.net/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Damian Schenkelman</title>
	
	<link>http://blogs.southworks.net/dschenkelman</link>
	<description />
	<lastBuildDate>Mon, 03 Oct 2011 18:39:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.southworks.net/dschenkelman" /><feedburner:info uri="dschenkelman" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Microsoft Media Platform Video Editor (former RCE) 2.0 just released</title>
		<link>http://feeds.southworks.net/~r/dschenkelman/~3/D_aYvqdU5lQ/</link>
		<comments>http://blogs.southworks.net/dschenkelman/2011/10/03/microsoft-media-platform-video-editor-former-rce-2-0-just-released/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 16:40:12 +0000</pubDate>
		<dc:creator>Damian Schenkelman</dc:creator>
				<category><![CDATA[Adaptive Streaming]]></category>
		<category><![CDATA[CSM]]></category>
		<category><![CDATA[Composite Application Guidance for WPF & SL]]></category>
		<category><![CDATA[Composite Stream Manifest]]></category>
		<category><![CDATA[Emerging Technology]]></category>
		<category><![CDATA[Live Smooth Streaming]]></category>
		<category><![CDATA[Media]]></category>
		<category><![CDATA[Microsoft Media Platform]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Prism-v2.2]]></category>
		<category><![CDATA[RCE]]></category>
		<category><![CDATA[Rough Cut Editing]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Silverlight 5]]></category>
		<category><![CDATA[Smooth Streaming]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/dschenkelman/?p=348</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dschenkelman/2011/10/03/microsoft-media-platform-video-editor-former-rce-2-0-just-released/" class="more-link">read more<img src="http://blogs.southworks.net/dschenkelman/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>Today, the new version of the Microsoft Media Platform (MMP) Video Editor <a href="http://archive.msdn.microsoft.com/VideoEditor/Release/ProjectReleases.aspx?ReleaseId=5763">was released</a> to the public. The new release is based on Silverlight 5, and has a lot (really a lot!) of new features (fully listed below), such as a UI based on floating windows, and a new Sub-Clip tool which gives editors more control when creating clips.</p>
<p>You can play with the new version at <a href="http://videoeditor.cloudapp.net/">http://videoeditor.cloudapp.net/</a>.</p>
<p>The downloadable packages of the new release are:</p>
<ul>
<li><strong>MMP Video Editor 2.0 Source Code:</strong> Useful in case you want to know how the different features are implemented.</li>
<li><strong>MMP Video Editor 2.0 Binaries:</strong> If you don’t care about the source and just can’t wait to host it.</li>
<li><strong>MMP Video Editor 2.0 Documentation:</strong> Updated documentation, including the <strong>“New Features in the MMP Video Editor 2.0” </strong>that provides a brief overview of the brand new features.</li>
<li><strong>MMP Video Editor 2.0 Overlays &amp; Rubberbanding Plugin Sample:</strong> Two plug-ins for the &#8220;Microsoft Media Platform Player Framework (formerly SMF)&#8221; were created to manage overlays and rubber-banding in CSMs (see new features document). The sample includes the source code for the plug-ins and a sample player that showcases the plug-ins’ capabilities.</li>
</ul>
<h2><a href="http://blogs.southworks.net/dschenkelman/files/2011/10/image2.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2011/10/image_thumb2.png" border="0" alt="image" width="333" height="211" /></a></h2>
<h2>New Features</h2>
<p>The full list of new features included in this version are:</p>
<ul>
<li>Silverlight 5 based</li>
<li>Out-of-Browser capabilities</li>
<li>Floating Windows</li>
<li>Playback Model: CSM Based</li>
<li>Multiple Sequences</li>
<li>Sub-clip Tool
<ul>
<li>Asset Preview</li>
<li>Multiple Video Cameras selection</li>
<li>Multiple Audio Tracks selection</li>
<li>Metadata Support</li>
</ul>
</li>
<li>Multiple clips selection and locking</li>
<li>Enhanced Overlays Support</li>
<li>Markers and Ads Browser</li>
<li>Rubber banding and multiple audio tracks</li>
<li>Keyboard Layout Configuration</li>
<li>Jog wheel support</li>
</ul>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2011/10/image1.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2011/10/image_thumb1.png" border="0" alt="image" width="657" height="325" /></a></p>
<p>I recommend you to go over the new features document before you start editing clips, as there are a lot changes in most of the major features of the application.</p>
<p>If you have comments, questions, suggestions or any issue, please visit the <a href="http://archive.msdn.microsoft.com/VideoEditor">MMP Video Editor community site</a>.</p>
<p>We hope enjoy this new version and have a lot of fun editing!!!</p>
<img src="http://feeds.feedburner.com/~r/dschenkelman/~4/D_aYvqdU5lQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dschenkelman/2011/10/03/microsoft-media-platform-video-editor-former-rce-2-0-just-released/</feedburner:origLink></item>
		<item>
		<title>Needle Container: Fluency and Mapping Types</title>
		<link>http://feeds.southworks.net/~r/dschenkelman/~3/TQH8qJUCN1Q/</link>
		<comments>http://blogs.southworks.net/dschenkelman/2011/07/18/needle-container-fluency-and-mapping-types/#comments</comments>
		<pubDate>Tue, 19 Jul 2011 00:13:51 +0000</pubDate>
		<dc:creator>Damian Schenkelman</dc:creator>
				<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[Needle]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/dschenkelman/?p=340</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dschenkelman/2011/07/18/needle-container-fluency-and-mapping-types/" class="more-link">read more<img src="http://blogs.southworks.net/dschenkelman/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.southworks.net/dschenkelman/2011/02/18/needle-dependency-injection-container-alpha-0-1-version-released/">Back in February</a>, I blogged about <a href="http://needlecontainer.codeplex.com/">Needle</a>, a dependency injection container that I was developing. In that post, I listed some of the most relevant features Needle has, one of them being its Fluent API. I thought it would be a would idea to talk about Needle again, but this time sharing some code and ideas behind it.</p>
<h3>First things first, why do I want fluency?</h3>
<p>This is of course a matter of appreciation, but I personally relate fluency to both ease of use and readability. Interestingly enough one of them is important before writing the code, and the other one after doing so. The idea is that a fluent API will give you a small set of options when performing a particular operation, each of them will be presented at the correct moment, and that once the code has been written, you can explain it to your non-tech grandma.</p>
<h3>Our fluent scenario, mapping types</h3>
<p>A really common operation that needs to be performed when working with DI containers is mapping types, which involves configuring the container to determine the type you want to get when requesting another type. This is commonly used by mapping an interface to a concrete implementation.</p>
<p>Let’s say we have an <strong>IForceEnlightened</strong> interface, and a <strong>Jedi</strong> class which implements that interface. If we wanted to get a <strong>Jedi</strong> whenever we request an instance of <strong>IForceEnlightened </strong>from the container, we can write the following code:</p>
<pre class="brush: csharp;">INeedleContainer needleContainer = new NeedleContainer();
needleContainer
    .Map&lt;IForceEnlightened&gt;() // when we request an IForceEnlightened
    .To&lt;Jedi&gt;() // provide a Jedi
    .Commit(); // save the mapping</pre>
<p>One really important thing about the fluent API is that, in every step of the way, IntelliSense only shows us the relevant members:</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2011/07/image.png"><img style="border-bottom: 0px;border-left: 0px;padding-left: 0px;padding-right: 0px;border-top: 0px;border-right: 0px;padding-top: 0px" border="0" alt="image" src="http://blogs.southworks.net/dschenkelman/files/2011/07/image_thumb.png" width="440" height="253" /></a></p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2011/07/image1.png"><img style="border-bottom: 0px;border-left: 0px;padding-left: 0px;padding-right: 0px;border-top: 0px;border-right: 0px;padding-top: 0px" border="0" alt="image" src="http://blogs.southworks.net/dschenkelman/files/2011/07/image_thumb1.png" width="530" height="188" /></a></p>
<h3>Transactional Operations</h3>
<p>The Commit() method call might have caught your eye in the previous code sample. This call is necessary, because Needle uses a transactional operation model. When performing a configuration operation with Needle, a committable object is created, which you must commit back to the container for the operation to take place. </p>
<p>This can also be useful in situations where you need to perform a certain configuration in a component, but want to wait until that configuration takes place. In this cases, keeping a reference to the <strong>ICommitable</strong> object until you want the configuration to take place does the trick.</p>
<h3>Each thing by its own name</h3>
<p>Let’s say we have another scenario, in which we could need either a Jedi or a Sith when requesting a force enlightened subject. In this case, the following code would do the trick:</p>
<pre class="brush: csharp;">needleContainer
    .Map&lt;IForceEnlightened&gt;()
    .To&lt;Jedi&gt;()
    .WithId(&quot;Jedi&quot;)
    .Commit();

needleContainer
    .Map&lt;IForceEnlightened&gt;()
    .To&lt;Sith&gt;()
    .WithId(&quot;Sith&quot;)
    .Commit();
</pre>
<p><font face="Helvetica">After that the container will have both mappings, which can be injected into another component using, for example, <a href="http://needlecontainer.codeplex.com/wikipage?title=Constructor%20Injection&amp;referringTitle=Documentation">Constructor</a> or <a href="http://needlecontainer.codeplex.com/wikipage?title=Property%20Injection&amp;referringTitle=Documentation">Property</a> injection.</font></p>
<h3>Lifetime Management</h3>
<p>In case we want to get the same Jedi instance each time we request a force enlightened subject, we can change the default lifetime registration from Transient (a different instance each time we request an <strong>IForceEnlightened</strong> subject)&#160; to Singleton (returns the same instance every time).</p>
<pre class="brush: csharp;">needleContainer
    .Map&lt;IForceEnlightened&gt;()
    .To&lt;Jedi&gt;()
    .UsingLifetime(RegistrationLifetime.Singleton)
    .Commit();</pre>
<p>Singleton registrations are commonly used with services in most applications.</p>
<h3>Putting it all together</h3>
<p>Of course, we can both name and determine the scope of a registration. If we want fast and simple access to Master Yoda (and who doesn’t), we can name the mapping and set its lifetime to Singleton:</p>
<pre class="brush: csharp;">needleContainer
    .Map&lt;IForceEnlightened&gt;()
    .To&lt;Jedi&gt;()
    .WithId(&quot;Yoda&quot;)
    .UsingLifetime(RegistrationLifetime.Singleton)
    .Commit();</pre>
<h3>Wrapping Up</h3>
<p>I hope you found this post fun, and that you try out Needle and its fluent API sometime. You can download Needle from <a href="http://needlecontainer.codeplex.com/releases/view/60894">here</a> or through Nuget:</p>
<pre class="brush: csharp;">PM&gt; Install-Package NeedleContainer</pre>
<p><a rev="vote-for" href="http://dotnetshoutout.com/Needle-Container-Fluency-and-Mapping-Types-Damian-Schenkelman"><img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fblogs.southworks.net%2Fdschenkelman%2F2011%2F07%2F18%2Fneedle-container-fluency-and-mapping-types%2F" style="border:0px" /></a></p>
<img src="http://feeds.feedburner.com/~r/dschenkelman/~4/TQH8qJUCN1Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dschenkelman/2011/07/18/needle-container-fluency-and-mapping-types/</feedburner:origLink></item>
		<item>
		<title>Binding to View Model properties in Data Templates. The RootBinding Markup Extension</title>
		<link>http://feeds.southworks.net/~r/dschenkelman/~3/vWrV4DUs3eE/</link>
		<comments>http://blogs.southworks.net/dschenkelman/2011/06/26/binding-to-view-model-properties-in-data-templates-the-rootbinding-markup-extension/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 17:39:48 +0000</pubDate>
		<dc:creator>Damian Schenkelman</dc:creator>
				<category><![CDATA[Data Binding]]></category>
		<category><![CDATA[Emerging Technology]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Markup Extensions]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Silverlight 5]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/dschenkelman/?p=326</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dschenkelman/2011/06/26/binding-to-view-model-properties-in-data-templates-the-rootbinding-markup-extension/" class="more-link">read more<img src="http://blogs.southworks.net/dschenkelman/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>If you work with Silverlight and MVVM, you must have probably been forced to do some weird thing to bind to a property in your view model (say a Command) from a DataTemplate. Some of the common approaches I have seen and used myself are:</p>
<ul>
<li>Using some kind of binding helper as a View’s resource.</li>
<li>Having a View Model wrap the entity of each collection item, and add the command to the View Model.</li>
</ul>
<p>Although these are perfectly valid approaches, they require extra work compared to the good old {Binding} syntax we are all used to.</p>
<p>Now that Silverlight 5 Beta is out, we can take advantage of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.markup.markupextension(VS.96).aspx">XAML Markup Extensions</a> to help is in this kind of tasks, using a simpler and more intuitive approach.</p>
<p>I have created a <strong>RootBindingExtension</strong>, which can be used as follows:</p>
<pre class="brush: xml;">&lt;Grid x:Name=&quot;LayoutRoot&quot; Background=&quot;White&quot;&gt;
    &lt;ListBox ItemsSource=&quot;{Binding Names}&quot;&gt;
        &lt;ListBox.ItemTemplate&gt;
            &lt;DataTemplate&gt;
                &lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;
                    &lt;TextBlock Text=&quot;{Binding}&quot;/&gt;
                    &lt;Button Content=&quot;{current:RootBinding Path=ButtonContent}&quot; Command=&quot;{current:RootBinding Path=MessageBoxCommand}&quot;/&gt;
                &lt;/StackPanel&gt;
            &lt;/DataTemplate&gt;
        &lt;/ListBox.ItemTemplate&gt;
    &lt;/ListBox&gt;
&lt;/Grid&gt;</pre>
<p>The <strong>RootBindingExtension </strong>uses the <strong>Path</strong> property to create a Binding that binds to a property of that name in the View’s <strong>DataContext</strong>.</p>
<pre class="brush: csharp;">public class RootBindingExtension : IMarkupExtension&lt;Binding&gt;
{
    public string Path { get; set; }

    public Binding ProvideValue(IServiceProvider serviceProvider)
    {
        IRootObjectProvider rootProvider = (IRootObjectProvider) serviceProvider.GetService(typeof(IRootObjectProvider));

        var view = rootProvider.RootObject;
        var fe = view as FrameworkElement;

        if (fe == null)
        {
            throw new InvalidOperationException(&quot;Root element must have data context&quot;);
        }

        var binding = new Binding();
        binding.Path = new PropertyPath(this.Path);
        binding.Source = fe.DataContext;

        return binding;
    }
}</pre>
<p>You can download the RootBindingExtension and a sample that uses it from <a href="https://skydrive.live.com/#!/?cid=09f63fc7ac065e5e&amp;sc=documents&amp;nl=1&amp;uc=2&amp;id=9F63FC7AC065E5E%21215">here</a>.</p>
<p>Let me know if you have used it.</p>
<p><a rev="vote-for" href="http://dotnetshoutout.com/Binding-to-View-Model-properties-in-Data-Templates-The-RootBinding-Markup-Extension-Damian-Schenkelman"><img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fblogs.southworks.net%2Fdschenkelman%2F2011%2F06%2F26%2Fbinding-to-view-model-properties-in-data-templates-the-rootbinding-markup-extension%2F" style="border:0px" /></a></p>
<img src="http://feeds.feedburner.com/~r/dschenkelman/~4/vWrV4DUs3eE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dschenkelman/2011/06/26/binding-to-view-model-properties-in-data-templates-the-rootbinding-markup-extension/</feedburner:origLink></item>
		<item>
		<title>Microsoft Media Platform Video Editor SP2 Released</title>
		<link>http://feeds.southworks.net/~r/dschenkelman/~3/rvNoWYcQi18/</link>
		<comments>http://blogs.southworks.net/dschenkelman/2011/06/01/microsoft-media-platform-video-editor-sp2-released/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 12:56:08 +0000</pubDate>
		<dc:creator>Damian Schenkelman</dc:creator>
				<category><![CDATA[Adaptive Streaming]]></category>
		<category><![CDATA[CSM]]></category>
		<category><![CDATA[Composite Stream Manifest]]></category>
		<category><![CDATA[Live Smooth Streaming]]></category>
		<category><![CDATA[Media]]></category>
		<category><![CDATA[Microsoft Media Platform]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[RCE]]></category>
		<category><![CDATA[Rough Cut Editing]]></category>
		<category><![CDATA[SSME]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Silverlight 4]]></category>
		<category><![CDATA[Smooth Streaming]]></category>
		<category><![CDATA[Smooth Streaming Media Element]]></category>
		<category><![CDATA[Live Smoooth Streaming]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/dschenkelman/?p=317</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dschenkelman/2011/06/01/microsoft-media-platform-video-editor-sp2-released/" class="more-link">read more<img src="http://blogs.southworks.net/dschenkelman/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>On Monday, Microsoft released the <a href="http://archive.msdn.microsoft.com/VideoEditor/Release/ProjectReleases.aspx?ReleaseId=5312">Service Pack 2</a> version of the <a href="http://archive.msdn.microsoft.com/VideoEditor">Microsoft Media Platform Video Editor</a> (formerly known as RCE).</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2011/06/image.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2011/06/image_thumb.png" border="0" alt="image" width="576" height="273" /></a></p>
<p>This version includes all the <a href="http://blogs.southworks.net/ejadib/2011/01/14/silverlight-rough-cut-editor-sp1-released/">new features and bug fixes that were included in SP1</a>, an important fix for an issue that occurs when playing live smooth streaming videos and a minor fix in the <a href="http://blogs.southworks.net/ejadib/2010/05/27/composite-stream-manifest-csm-generator-rough-cut-editor-rce/">Composite Stream Manifest generator</a>.</p>
<p>Full descriptions of the issues are provided below in case you have run into them.</p>
<h2><strong>Issues Description</strong></h2>
<h5><strong>Live Smooth Streaming Videos without text tracks fails on playback</strong></h5>
<p>When playing a live smooth streaming video without any text tracks, a message is shown explaining that the video can&#8217;t be played.<br />
The log has the following related entry: <em>&#8220;Exception: Failed to parse manifest: Index was out of range. Must be non-negative and less than the size of the collection.&#8221;</em></p>
<h5><strong>First chunk duration are not generated sometimes</strong></h5>
<p>In some scenarios, the duration of the first chunk of the video and audio streams is not generated.</p>
<p>The error message when playing the generated CSM is the following: <em>&#8220;</em><em>Caught exception trying to parse main manifest: First audio chunk in clip 1 [start time = <strong>X</strong>, duration = <strong>Y</strong>] does not contain clip start position <strong>Z</strong>]<em>&#8220;, </em></em>where X, Y and Z are values that depend on your clips. For more information on common issues when generating and using CSMs, please check this<a href="http://blogs.southworks.net/ejadib/2010/02/05/common-mistakes-issues-when-creating-and-using-composite-stream-manifests-csm/"> blog post</a>.</p>
<p><em> </em></p>
<p>Hopefully, you will find this new release useful.</p>
<p>If you have comments, questions, suggestions or any issue, please visit the <a href="http://archive.msdn.microsoft.com/VideoEditor">MMP Video Editor community site</a>.</p>
<p><a rev="vote-for" href="http://dotnetshoutout.com/Microsoft-Media-Platform-Video-Editor-SP2-Released"><img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fblogs.southworks.net%2Fdschenkelman%2F2011%2F06%2F01%2Fmicrosoft-media-platform-video-editor-sp2-released%2F" style="border:0px" /></a></p>
<img src="http://feeds.feedburner.com/~r/dschenkelman/~4/rvNoWYcQi18" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dschenkelman/2011/06/01/microsoft-media-platform-video-editor-sp2-released/</feedburner:origLink></item>
		<item>
		<title>Needle Dependency Injection Container – Alpha 0.1 version released</title>
		<link>http://feeds.southworks.net/~r/dschenkelman/~3/vbMo5F7VU_Y/</link>
		<comments>http://blogs.southworks.net/dschenkelman/2011/02/18/needle-dependency-injection-container-alpha-0-1-version-released/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 23:06:50 +0000</pubDate>
		<dc:creator>Damian Schenkelman</dc:creator>
				<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[Needle]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/dschenkelman/?p=280</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dschenkelman/2011/02/18/needle-dependency-injection-container-alpha-0-1-version-released/" class="more-link">read more<img src="http://blogs.southworks.net/dschenkelman/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago I uploaded to <a href="http://nuget.org/Packages/Packages/Details/NeedleContainer-0-1">NuGet</a> (which was really easy BTW) the <a href="http://needlecontainer.codeplex.com/releases/view/60894">first alpha release</a> of the <a href="http://needlecontainer.codeplex.com/">Needle Container</a>.</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2011/02/image.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2011/02/image_thumb.png" border="0" alt="image" width="475" height="296" /></a></p>
<p>Needle is a lightweight dependency injection container. Initially the project came up as something to do on weekends and boring afternoons with practicing goals (TDD, reflection), but after that I started putting more work into it, by adding documentation in code, and basic features that are commonly found in other containers such as Autofac or Unity.</p>
<p>You can download the <strong>Nuget</strong> package using the following command, which will automatically include a reference to the container’s assembly.</p>
<p><textarea>PM&gt; Install-Package NeedleContainer</textarea></p>
<p>Some of the features that are part of this release are:</p>
<ul>
<li>Constructor Injection</li>
<li>Property Injection</li>
<li>Type mapping using lifetime scopes and Ids</li>
<li>Storing instances using various Ids</li>
<li>Asynchronous object resolution</li>
<li>Fluent API</li>
<li>Support to inject factories using Func&lt;T&gt;</li>
<li>Support to inject instances for all stored registrations using IEnumerable&lt;T&gt;</li>
</ul>
<p>After I come back from my holidays, I expect to be adding more functionality to it in my free time (collaborators are welcome, <a href="http://www.codeplex.com/site/users/view/dschenkelman">contact me through codeplex</a>), as well as doing a couple of posts on the most relevant features, for instance how the Fluent API works and how to perform asynchronous resolution.</p>
<p>If you try it out, let me know what you think of it. You can use the <a href="http://needlecontainer.codeplex.com/discussions">discussions boards</a> to do so.</p>
<p><a rev="vote-for" href="http://dotnetshoutout.com/Needle-Dependency-Injection-Container-Alpha-01-version-released"><img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fblogs.southworks.net%2Fdschenkelman%2F2011%2F02%2F18%2Fneedle-dependency-injection-container-alpha-0-1-version-released%2F" style="border:0px" /></a></p>
<img src="http://feeds.feedburner.com/~r/dschenkelman/~4/vbMo5F7VU_Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dschenkelman/2011/02/18/needle-dependency-injection-container-alpha-0-1-version-released/</feedburner:origLink></item>
		<item>
		<title>MMC 3.0 Sample Plug-In using MVP and Unity</title>
		<link>http://feeds.southworks.net/~r/dschenkelman/~3/QB1Qd1OJdu8/</link>
		<comments>http://blogs.southworks.net/dschenkelman/2011/01/13/mmc-3-0-sample-plug-in-using-mvp-and-unity/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 17:49:42 +0000</pubDate>
		<dc:creator>Damian Schenkelman</dc:creator>
				<category><![CDATA[Guidance]]></category>
		<category><![CDATA[MMC]]></category>
		<category><![CDATA[MVP Pattern]]></category>
		<category><![CDATA[Unity]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/dschenkelman/?p=257</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dschenkelman/2011/01/13/mmc-3-0-sample-plug-in-using-mvp-and-unity/" class="more-link">read more<img src="http://blogs.southworks.net/dschenkelman/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>The last couple of days I have been working on a MMC spike that leverage dependency injection and some kind of presentation pattern (in this case MVP), to search for ways to make MMC applications more testable. The scenario I chose for the spike was having a plug-in that could connect/disconnect network adapters through a service that used WMI objects. The sample is very fresh, and there is still work to do to decouple things a bit more (for example, moving strings for WMI objets to config files).</p>
<p>To work with MMC, you need the <strong>Microsoft.ManagementConsole.dll</strong> assembly, which comes as part of the Windows SDK 6.1 for Windows Server 2008. This is important because versions 7.0 and 7.1 do not include this assembly. Additionally,&nbsp; <em>&#8220;MMC is one of the very few extensibility point in the OS that will not support .NET 4. MMC &#8221; </em>(from <a href="http://connect.microsoft.com/VisualStudio/feedback/details/474039/can-not-use-net-4-0-to-create-mmc-snapin">this thread</a>), which is why MEF went out the door and in came Unity.</p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/aa394217%28VS.85%29.aspx">MMC documentation</a>, explains the basics on how to get started, so if you have never coded an MMC plug-in, I recommend you to start there. To summarize things, you are required to inherit from a couple of classes, override some methods, and put some attributes in place to get the ball rolling.&nbsp; The <a href="http://msdn.microsoft.com/en-us/library/aa394217%28VS.85%29.aspx">Hello World Sample</a> goes over this.</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2011/01/image.png"><img style="border-right-width: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px;padding-top: 0px" border="0" alt="image" src="http://blogs.southworks.net/dschenkelman/files/2011/01/image_thumb.png" width="570" height="344"></a></p>
<h3>Implementation Details</h3>
<p>One of the decisions I had to take was there to make the calls so Unity would resolve and inject the necessary objects. This can be challenging, specially because we have no control over when our Views are instantiated. As you can see in the following code, MMC makes us set a ViewType for a particular description, but gives to control over how the view itself is created.</p>
<pre class="brush: csharp;">public ConnectionsSnapIn()
{
    ...
    var lvd = new MmcListViewDescription(MmcListViewOptions.ExcludeScopeNodes);
    lvd.DisplayName = "Options";
    lvd.ViewType = typeof(ConnectionListView);
    ...
}
</pre>
<p>How does the View get a reference to the presenter? I decided to use the <a href="http://msdn.microsoft.com/en-us/library/microsoft.managementconsole.snapinbase.tag%28VS.85%29.aspx">Tag</a> property of the <a href="http://msdn.microsoft.com/en-us/library/microsoft.managementconsole.snapin_members%28VS.85%29.aspx">SnapIn</a> class to store the container. The View can then access the Tag property, make the necessary cast and resolve the presenter.</p>
<pre class="brush: csharp;">public ConnectionsSnapIn()
{
    ConfigureContainer();
    this.Tag = container;
    ...
}
</pre>
<p>After that, Unity is in the game, so we can resort to constructor injection and normal object resolution. Below is some code from the constructors of the View and Presenter classes.</p>
<p>
<pre class="brush: csharp;">public class ConnectionListView : MmcListView, IConnectionListView
{

    private readonly IConnectionListPresenter presenter;

    public ConnectionListView()
    {

        var container = this.SnapIn.Tag as IUnityContainer;

        if (container != null)
        {
            this.presenter = container.Resolve&lt;IConnectionListPresenter&gt;();
            this.presenter.View = this;
        }

    }
    ...
}
</pre>
<pre class="brush: csharp;">public class ConnectionListPresenter : IConnectionListPresenter
{

    private readonly IConnectionsService connectionsService;

    public ConnectionListPresenter(IConnectionsService connectionsService)
    {
        this.connectionsService = connectionsService;
    }

    ...
}
</pre>
<h3>Alternative Approaches</h3>
<p>Another possible approach I though of could be using a WinForm View&nbsp; instead of a List View, but having it as a placeholder for the real views we want to show depending on the Node that is clicked. This approach leaves the instantiation of the placeholder form to MMC, but would give us control for the instantiation of the other views. This is just an idea, and I might get deeper into this without getting the expected results.</p>
<h3>Getting the Code and Plug-in</h3>
<p>You can download the source code from <a href="http://cid-09f63fc7ac065e5e.office.live.com/self.aspx/p%5E0p%20Samples/ConnectionsPlug-in%20Source.zip">here</a>, and the plug-in (built assembly) from <a href="http://cid-09f63fc7ac065e5e.office.live.com/self.aspx/p%5E0p%20Samples/Connections%20MMC%20Plug-in.zip">here</a>. To install the plug-in, open the Windows SDK console, <strong>cd</strong> to the directory where the assemblies are, and run <strong>InstallUtil.exe MMCSpike.dll </strong>(as shown below)<strong>.</strong></p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2011/01/image1.png"><img style="border-right-width: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px;padding-top: 0px" border="0" alt="image" src="http://blogs.southworks.net/dschenkelman/files/2011/01/image_thumb1.png" width="552" height="312"></a></p>
<p>That&#8217;s all for this post. If I get any deeper with the sample or find other interesting approaches I&#8217;ll let you know.</p>
<p><a href="http://dotnetshoutout.com/MMC-30-Sample-Plug-In-using-MVP-and-Unity-Damian-Schenkelman" rev="vote-for"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fblogs.southworks.net%2Fdschenkelman%2F2011%2F01%2F13%2Fmmc-3-0-sample-plug-in-using-mvp-and-unity%2F"></a></p>
<img src="http://feeds.feedburner.com/~r/dschenkelman/~4/QB1Qd1OJdu8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dschenkelman/2011/01/13/mmc-3-0-sample-plug-in-using-mvp-and-unity/</feedburner:origLink></item>
		<item>
		<title>How to: Load Prism modules packaged in a separate XAP file in an OOB application</title>
		<link>http://feeds.southworks.net/~r/dschenkelman/~3/qllxhcDbLWE/</link>
		<comments>http://blogs.southworks.net/dschenkelman/2011/01/10/how-to-load-prism-modules-packaged-in-a-separate-xap-file-in-an-oob-application/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 14:32:15 +0000</pubDate>
		<dc:creator>Damian Schenkelman</dc:creator>
				<category><![CDATA[Composite Application Guidance for WPF & SL]]></category>
		<category><![CDATA[Guidance]]></category>
		<category><![CDATA[Patterns & Practices]]></category>
		<category><![CDATA[Prism-v4]]></category>
		<category><![CDATA[Remote Module Loading]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Silverlight 4]]></category>
		<category><![CDATA[p&p]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/dschenkelman/2011/01/10/how-to-load-prism-modules-packaged-in-a-separate-xap-file-in-an-oob-application/</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dschenkelman/2011/01/10/how-to-load-prism-modules-packaged-in-a-separate-xap-file-in-an-oob-application/" class="more-link">read more<img src="http://blogs.southworks.net/dschenkelman/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>I have seen many questions, both in the Codeplex  (<a href="http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=208004">here</a>) and StackOverflow forums (<a href="http://stackoverflow.com/questions/2875121/will-prism-ondemand-module-loading-work-in-an-oob-scenerio">here</a>), asking how to load modules that were packaged for remote module loading in a Silverlight out of browser application.</p>
<p>I created this sample a couple of months ago, and I thought might be useful for others. <a href="http://cid-09f63fc7ac065e5e.office.live.com/self.aspx/p%5E0p%20Samples/OOBCachingSample.zip">Here</a> you can download the sample I put together using the Modularity QS from Prism 4. You can also download the necessary files separately (<a href="http://cid-09f63fc7ac065e5e.office.live.com/self.aspx/p%5E0p%20Samples/OOBModuleManager.cs">OOBModuleManager.cs</a> and <a href="http://cid-09f63fc7ac065e5e.office.live.com/self.aspx/p%5E0p%20Samples/CachingXapModuleTypeLoader.cs">CachingXapModuleTypeLoader.cs</a>)</p>
<p>The following are the highlights and steps to follow to run the sample:</p>
<ol>
<li>Open the solution is under <strong>PrismV4\Quickstarts\Modularity\Silverlight\ModularityWithUnity</strong>.</li>
<li>Make sure the Web Site project is set as startup project.</li>
<li>Open the <strong>CachingXapModuleTypeLoader</strong> and <strong>OOBModuleManager </strong>to see how they work. Also check out how the <strong>OOBModuleManager</strong> is registered in the Bootstrapper&#8217;s <strong>ConfigureContainer</strong> method.</li>
<li>Run the application. Load all 6 modules.</li>
<li>Install the application (add to Desktop and Start Menu).</li>
<li>Close web browser and OOB window.</li>
<li>Check in Systray that <a href="http://localhost:portX">http://localhost:portX</a> is not running. If it is, stop the site.</li>
<li>Open OOB App from desktop.</li>
<li>Load modules, they should load correctly.</li>
</ol>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2011/01/image001.jpg"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2011/01/image001_thumb.jpg" border="0" alt="image001" width="562" height="325" /></a></p>
<table border="2" cellspacing="0" cellpadding="2" width="1129">
<tbody>
<tr>
<td width="1125" valign="top"><strong>Note</strong>: Modules B, D, E &amp; F are loaded remotely, in background, not from main xap or however the Prism docs are explaining it (if you open Iso Storage you’ll find the .xap files there).</td>
</tr>
</tbody>
</table>
<p>I hope this is useful for you in case you are required to implement this scenario.</p>
<p><P></P> <a rev="vote-for" href="http://dotnetshoutout.com/How-to-Load-Prism-modules-packaged-in-a-separate-XAP-file-in-an-OOB-application-Damian-Schenkelman"><img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fblogs.southworks.net%2Fdschenkelman%2F2011%2F01%2F10%2Fhow-to-load-prism-modules-packaged-in-a-separate-xap-file-in-an-oob-application%2F" style="border:0px" /></a></p>
<img src="http://feeds.feedburner.com/~r/dschenkelman/~4/qllxhcDbLWE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dschenkelman/2011/01/10/how-to-load-prism-modules-packaged-in-a-separate-xap-file-in-an-oob-application/</feedburner:origLink></item>
		<item>
		<title>Prism Training Kit 4.0 Released</title>
		<link>http://feeds.southworks.net/~r/dschenkelman/~3/LU52xHPOYkg/</link>
		<comments>http://blogs.southworks.net/dschenkelman/2010/11/20/prism-training-kit-4-0-released/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 03:10:47 +0000</pubDate>
		<dc:creator>Damian Schenkelman</dc:creator>
				<category><![CDATA[Composite Application Guidance for WPF & SL]]></category>
		<category><![CDATA[MEF]]></category>
		<category><![CDATA[Patterns & Practices]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[PrismTK]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Silverlight 4]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[p&p]]></category>
		<category><![CDATA[Prism-v4]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/dschenkelman/?p=237</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dschenkelman/2010/11/20/prism-training-kit-4-0-released/" class="more-link">read more<img src="http://blogs.southworks.net/dschenkelman/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>This past week with <a href="http://blogs.southworks.net/dpoza/">Diego</a>, <a href="http://blogs.southworks.net/ejadib/">Ezequiel</a>, <a href="http://blogs.southworks.net/gmaliandi/">Guido</a> and <a href="http://blogs.southworks.net/matiasb/">Matias</a> we worked on updating <a href="http://prismtk.codeplex.com/releases/view/55821">Prism training kit</a> to <a href="http://msdn.microsoft.com/en-us/library/gg406140.aspx">Prism 4.0</a>. Following the trend from the Prism team guys, we updated the version number to Prism Training Kit 4.0. Download the latest version from <a href="http://prismtk.codeplex.com/releases/view/56048">here</a>.</p>
<p>﻿<a href="http://blogs.southworks.net/dschenkelman/files/2010/11/prismtk.png"><img class="alignnone size-medium wp-image-239" src="http://blogs.southworks.net/dschenkelman/files/2010/11/prismtk-300x125.png" alt="" width="300" height="125" /></a></p>
<p>I really recommend downloading this release, as we put a lot of effort in getting out there what we believed would be the most useful content. You can get a set of detailed updates and features in <a href="http://blogs.southworks.net/gmaliandi/2010/11/prism-training-kit-4-0-is-out/">Guido&#8217;s blog</a>, but to summarize the main changes are:</p>
<ol>
<li>Updated Modularity, Bootstrapper, Dependency Injection, Communication and UI Composition labs to Prism 4.0.</li>
<li>Created new labs for MEF and Navigation.</li>
<li>Fixed bugs from first version of the Training Kit.</li>
</ol>
<p><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/11/MEF-LAB1-690x601_thumb.png" border="0" alt="MEF-LAB1-690x601" width="457" height="399" /></p>
<p>The reason we <em>&#8220;left out&#8221;</em> the MVVM training is that Karl Shifflett has released the <a href="http://karlshifflett.wordpress.com/2010/11/07/in-the-box-ndash-mvvm-training/">&#8220;In the box&#8221; training</a> which does a great job covering MVVM scenarios.</p>
<p>If you have any feedback about the PrismTK, you can use the site&#8217;s <a href="http://prismtk.codeplex.com/discussions">discussion list</a>, <a href="http://prismtk.codeplex.com/workitem/list/basic">issue tracker</a> or this blog.</p>
<p>We hope that you find it really useful.</p>
<img src="http://feeds.feedburner.com/~r/dschenkelman/~4/LU52xHPOYkg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dschenkelman/2010/11/20/prism-training-kit-4-0-released/</feedburner:origLink></item>
		<item>
		<title>Dynamically updating an application’s functionality using IronPython</title>
		<link>http://feeds.southworks.net/~r/dschenkelman/~3/tk-GYsLQwsE/</link>
		<comments>http://blogs.southworks.net/dschenkelman/2010/10/24/dynamically-updating-an-applications-functionality-using-ironpython/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 23:00:15 +0000</pubDate>
		<dc:creator>Damian Schenkelman</dc:creator>
				<category><![CDATA[Guidance]]></category>
		<category><![CDATA[IronPython]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/dschenkelman/?p=227</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dschenkelman/2010/10/24/dynamically-updating-an-applications-functionality-using-ironpython/" class="more-link">read more<img src="http://blogs.southworks.net/dschenkelman/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>About a month ago I <a href="http://blogs.southworks.net/dschenkelman/2010/09/21/using-mvvm-to-bring-ironpython-and-wpf-together/">blogged about an e-mail sender program</a> that used the MVVM pattern to integrate business logic written in Iron Python with presentation logic written in C#. In this post I will show another great benefit of using this approach. The source code related to this post can be downloaded from <a href="http://cid-09f63fc7ac065e5e.office.live.com/self.aspx/p%5E0p%20Samples/FSWatcherEmailClient.zip">here</a>.</p>
<p>The old e-mail client only allowed users to send e-mails using a Hotmail or a Gmail account. Let’s say we our application to support new e-mail providers without having to restart it. When discussing this with <a href="http://blogs.southworks.net/msalias/">Martin Salias</a>, he suggested me to use a <a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx">FileSystemWatcher</a>, which is the approach I decided to take.</p>
<p>The first thing we need to do is create a FileSystemWatcher instance in the ViewModel’s constructor and have it listen to changes in the directory where the Python modules are obtained from. As we only want to get updates when a python module is updated, we specify that filter as well: <span style="font-family: Trebuchet MS"> </span></p>
<pre><span style="color: blue">private void </span>InitializeFileSystemWatcher()
{
    <span style="color: blue">this</span>.fsWatcher = <span style="color: blue">new </span><span style="color: #2b91af">FileSystemWatcher</span>(PythonModulesPath, <span style="color: #a31515">"*.py"</span>);
    <span style="color: blue">this</span>.fsWatcher.EnableRaisingEvents = <span style="color: blue">true</span>;
    <span style="color: blue">this</span>.fsWatcher.Changed += FileSystemChanged;
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><span style="font-family: Trebuchet MS">Now we need to re-load the modules being used by our application once a change in the path specified occurs and update the UI accordingly:</span></p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<pre><span style="color: blue">private void </span>FileSystemChanged(<span style="color: blue">object </span>sender, <span style="color: #2b91af">FileSystemEventArgs </span>e)
{
    <span style="color: blue">this</span>.LoadPythonModules();

    <span style="color: green">//update all bound properties
    </span><span style="color: blue">this</span>.RaisePropertyChanged(<span style="color: blue">string</span>.Empty);
}</pre>
<p>To check how this is working follow these steps:</p>
<ol>
<li>Open the solution provided in the .zip file and run it.</li>
<li>Expand the Combobox control to verify that only Gmail and Hotmail are supported.<a href="http://blogs.southworks.net/dschenkelman/files/2010/10/image6.png"><img style="border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/10/image_thumb5.png" border="0" alt="image" width="339" height="227" /></a></li>
<li>Find the <strong>New</strong> <strong>Modules </strong>folder inside the .zip file and copy the <strong>emailDispatcher.py</strong> module to the <strong>WPFClient\bin\Debug\Python Code </strong>directory. Replace the existing file.<a href="http://blogs.southworks.net/dschenkelman/files/2010/10/image7.png"><img style="border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/10/image_thumb6.png" border="0" alt="image" width="331" height="373" /></a></li>
<li>Expand the Combobox control to verify that Yahoo has been added as a provider.<a href="http://blogs.southworks.net/dschenkelman/files/2010/10/image8.png"><img style="border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/10/image_thumb7.png" border="0" alt="image" width="334" height="226" /></a></li>
<li>(Optional) If you have a yahoo account send an e-mail to test that it works correctly.</li>
</ol>
<p>Although this sample is quiet simple, I think it is a great way to illustrate the flexibility of having this kind of application.</p>
<img src="http://feeds.feedburner.com/~r/dschenkelman/~4/tk-GYsLQwsE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dschenkelman/2010/10/24/dynamically-updating-an-applications-functionality-using-ironpython/</feedburner:origLink></item>
		<item>
		<title>Using NDepend to find ways to improve an existing code base</title>
		<link>http://feeds.southworks.net/~r/dschenkelman/~3/xsFV_5zlpdI/</link>
		<comments>http://blogs.southworks.net/dschenkelman/2010/10/22/using-ndepend-to-find-ways-to-improve-an-existing-code-base/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 04:26:53 +0000</pubDate>
		<dc:creator>Damian Schenkelman</dc:creator>
				<category><![CDATA[NDepend]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/dschenkelman/?p=197</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dschenkelman/2010/10/22/using-ndepend-to-find-ways-to-improve-an-existing-code-base/" class="more-link">read more<img src="http://blogs.southworks.net/dschenkelman/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>The last couple of weeks, while working on a couple of personal projects/samples, I have had the chance to start exploring <a href="http://www.ndepend.com">NDepend</a>’s features. In this blog post, I would like to share some of the features that I believe can prove very useful when developing software using Visual Studio. I will provide an overview, using the <a href="http://blogs.southworks.net/dschenkelman/2010/10/08/wpf-guitar-hero-using-mvvm-y-mvp/">WPF Guitar Hero</a> application as the sample solution, of a couple of the features I found most interesting.</p>
<h2>Dependency Matrix</h2>
<p><a href="http://www.ndepend.com/Doc_Matrix.aspx">NDepend’s Dependency Matrix</a> is a really useful asset, which can be used to quickly determine the complexity of a particular application/library. Unlike a graph, which simply shows the connections between the different components, the matrix displays how dependent a component is on others in a simple way.</p>
<p>To view the Dependency Matrix, after enabling NDepend for the solution, one must simply point to the <strong>NDepend</strong> menu and click <strong>Dependency Matrix</strong>.</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2010/10/image1.png"><img style="border-width: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/10/image_thumb.png" border="0" alt="image" width="401" height="397" /></a></p>
<p>As the figure above depicts, the matrix shows (in this case) how many dependencies there are between an assembly (column) and each of the other ones (rows). Additionally, it does not only show dependencies to assemblies from within the solution, but to .Net Framework assemblies as well. In this case the unit of measure being displayed is members, but it can also show methods, fields, etc.</p>
<p>From the matrix, there are different ways to dig deeper into each of the dependencies. One I find particularly useful (for low amounts) is using a graph.</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2010/10/depgraph1.png"><img style="border-width: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/10/depgraph_thumb1.png" border="0" alt="depgraph" width="696" height="200" /></a></p>
<p>If the amount is large, you can also zoom in to the particular assembly pair and get a look at the dependencies one by one.</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2010/10/zoomdepmat.png"><img style="border-width: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/10/zoomdepmat_thumb.png" border="0" alt="zoomdepmat" width="685" height="249" /></a></p>
<h2>CQL (Code Query Language)</h2>
<p>Another great NDepend feature (my favorite so far) is its support for the <a href="http://www.ndepend.com/Features.aspx#CQL">Code Query Language</a>. Let’s say that for API clean-up purposes I want to find all methods that can be made private, you might use something like the following:</p>
<pre><span style="background: white;color: blue">SELECT METHODS WHERE </span><span style="background: white;color: #000064">CouldBePrivate </span></pre>
<p>Which outputs these results:</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2010/10/image2.png"><img style="border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/10/image_thumb1.png" border="0" alt="image" width="306" height="215" /></a></p>
<p>As you can see there are many methods from assemblies related to Unit Tests. We don’t care about those so we can get rid of them by adding some extra filters to the query:</p>
<p><span style="background: white;color: blue">SELECT METHODS FROM ASSEMBLIES </span><span style="background: white;color: #a31515">&#8220;AlgoHero.Files&#8221;</span><span style="background: white;color: black">,</span><span style="background: white;color: #a31515">&#8220;AlgoHero.Game&#8221;</span><span style="background: white;color: black">,</span><span style="background: white;color: #a31515">&#8220;AlgoHero.Interface&#8221;</span><span style="background: white;color: black">,</span><span style="background: white;color: #a31515">&#8220;AlgoHero.MusicEntities&#8221; </span><span style="background: white;color: black">,</span><span style="background: white;color: #a31515">&#8220;AlgoHero.Screens&#8221;</span><span style="background: white;color: blue">WHERE </span><span style="background: white;color: #000064">CouldBePrivate </span><span style="background: white;color: blue">AND </span><span style="background: white;color: black">! </span><span style="background: white;color: #000064">IsConstructor </span></p>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<p>We get the desired output which does not include any method from test assemblies. The fact that this query returned 12 results means that some methods have a higher level of exposure than required.</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2010/10/image3.png"><img style="border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/10/image_thumb2.png" border="0" alt="image" width="336" height="212" /></a></p>
<p>We can access the method directly from the query’s results and update its accessibility.</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2010/10/image4.png"><img style="border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/10/image_thumb3.png" border="0" alt="image" width="323" height="203" /></a></p>
<p>The best thing about this, is that this query can be added as a CQL rule so every time the solution is built the query will verify this condition:</p>
<p><a href="http://blogs.southworks.net/dschenkelman/files/2010/10/image5.png"><img style="border: 0px" src="http://blogs.southworks.net/dschenkelman/files/2010/10/image_thumb4.png" border="0" alt="image" width="770" height="326" /></a></p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>I believe this level of customization, which can be achieved through some really simple syntax can provide great value to maintain large code bases across development teams with many developers compliant with a set of rules.</p>
<p>You can download the <a href="http://www.ndepend.com/NDependDownload.aspx">NDepend trial</a> (which does <a href="http://www.ndepend.com/Editions.aspx">have less features</a> than the Pro version) to give it a try. I know I&#8217;ll keep using it.</p>
<img src="http://feeds.feedburner.com/~r/dschenkelman/~4/xsFV_5zlpdI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dschenkelman/2010/10/22/using-ndepend-to-find-ways-to-improve-an-existing-code-base/</feedburner:origLink></item>
	</channel>
</rss>

