<?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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Mariano Converti's Blog</title>
	
	<link>http://blogs.southworks.net/mconverti</link>
	<description>Sharing some thoughts...</description>
	<pubDate>Mon, 08 Feb 2010 03:08:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.southworks.net/mconverti" /><feedburner:info uri="mconverti" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>SQL Server 2008 R2 Update for Developers Training Kit Released!</title>
		<link>http://feeds.southworks.net/~r/mconverti/~3/jr2uL9HTXdc/</link>
		<comments>http://blogs.southworks.net/mconverti/2010/02/08/sql-server-2008-r2-update-for-developers-training-kit-released/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 03:07:00 +0000</pubDate>
		<dc:creator>mconverti</dc:creator>
		
		<category><![CDATA[DPE]]></category>

		<category><![CDATA[SQL Server 2008 R2]]></category>

		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/mconverti/?p=158</guid>
		<description><![CDATA[
As Roger announced in his blog, the first release of the SQL Server 2008 R2 Update for Developers Training Kit is available for free download from the Microsoft Download center at:

http://go.microsoft.com/?linkid=9710868 

The SQL Server 2008 R2 Update for Developers Training Kit is ideal for developers who want to understand how to take advantage of the [...]]]></description>
			<content:encoded><![CDATA[<p><img style="margin: 0px" border="0" alt="Microsoft SQL Server 2008 R2" src="http://blogs.southworks.net/mconverti/files/2010/02/sqlserver2008r2logo-thumb.png" width="240" height="44" /></p>
<p>As Roger announced in his <a href="http://blogs.msdn.com/rdoherty/archive/2010/02/03/announcing-the-sql-server-2008-r2-update-for-developers-training-kit.aspx">blog</a>, the first release of the <strong>SQL Server 2008 R2 Update for Developers Training Kit</strong> is available for free download from the Microsoft Download center at:</p>
<ul>
<li><a title="http://go.microsoft.com/?linkid=9710868" href="http://go.microsoft.com/?linkid=9710868">http://go.microsoft.com/?linkid=9710868</a> </li>
</ul>
<p>The SQL Server 2008 R2 Update for Developers Training Kit is ideal for developers who want to understand how to take advantage of the key improvements introduced in <strong>Microsoft SQL Server 2008</strong> and <strong>Microsoft SQL Server 2008 R2</strong> in their applications, as well as for developers who are new to SQL Server.</p>
<p>Stay tuned because new releases of this training kit are going to be published every two weeks approximately containing new labs, demos, presentations and videos related to SQL Server 2008 R2 features.</p>
<h3>Training Kit Content</h3>
<p>This release contains all the original content from the <a href="http://go.microsoft.com/?linkid=9665942">SQL Server 2008 Developer Training Kit</a> (but targeting <strong>Microsoft SQL Server 2008 R2</strong>) and also the following new one:</p>
<ul>
<li><strong>How to build your first web application with SQL Server and ASP.NET</strong>: This hands-on lab shows how to connect to SQL Server and perform Create, Read, Update and Delete (CRUD) operations on SQL Server 2008 from an ASP.NET Web application. It also shows you how to work with images stored in SQL Server in a web application. This lab is ideal for developers who are new to building web applications with SQL Server and ASP.NET. </li>
<li><strong>Data-tier Applications in SQL Server 2008 R2 and Visual Studio 2010</strong>: This hands-on lab shows how to perform the basic steps in creating, developing, deploying, managing and upgrading a Data-tier Application (DAC) using the new features in Microsoft SQL Server 2008 R2 and Microsoft Visual Studio 2010. It also shows some of the new IDE tools and enhancements included in Microsoft Visual Studio 2010 to work with Database projects. </li>
<li><strong>Introduction To StreamInsight and Complex Event Processing</strong>: Microsoft SQL Server StreamInsight is Microsoft&#8217;s new Complex Event Processing technology to help businesses derive better insights by correlating event streams from multiple sources with near-zero latency. This hands-on lab shows how to leverage the new StreamInsight framework released as part of Microsoft SQL Server 2008 R2 while developing a StreamInsight sample application. It also explains the basics about Complex Event Processing. </li>
<li><strong>Using the New Features of Reporting Services 2008 R2</strong>: This hands-on lab introduces the new features included in Microsoft SQL Server 2008 R2 Reporting Services like the Map Wizard to display geospatial data, the lookup functions in report expressions so that data from multiple datasets can be shown in a single data region and the capability to export report data to an Atom data feed. It also shows the new features in Report Builder 3.0. </li>
<li><strong>PowerPivot in SQL Server 2008 R2</strong>: This hands-on lab introduces to the Microsoft SQL Server PowerPivot for Excel 2010 add-in and shows how to load data into it and how to create PowerPivot pivot tables. It also introduces DAX expressions for multidimensional calculations against PowerPivot data and explains how to publish PowerPivot workbooks to Microsoft SQL Server PowerPivot for SharePoint 2010. </li>
<li><strong>7 Introductory Videos</strong>: these videos introduce and review the new features and enhancements in Microsoft SQL Server 2008 and Microsoft SQL Server 2008 R2.
<ul>
<li>SQL Server 2008 R2 Update for Developers Overview Part I - SQL Server 2008 Review </li>
<li>SQL Server 2008 R2 Update for Developers Overview Part II - Introducing SQL Server 2008 R2 </li>
<li>Introducing SQL Server 2008 R2 StreamInsight </li>
<li>Demo: Real Time Analytics with SQL Server 2008 R2 StreamInsight </li>
<li>Introducing SQL Server 2008 R2 Application and Multi-Server Management </li>
<li>Introducing SQL Server 2008 R2 Reporting Services </li>
<li>Introducing PowerPivot for Excel 2010 and SharePoint 2010 </li>
</ul>
</li>
</ul>
<p><a href="http://blogs.southworks.net/mconverti/files/2010/02/sqlserver2008r2tk.png"><img style="float: none;margin-left: auto;margin-right: auto" border="0" alt="SQL Server 2008 R2 Update for Developers Training Kit" src="http://blogs.southworks.net/mconverti/files/2010/02/sqlserver2008r2tk-thumb.png" width="586" height="480" /></a></p>
<h3>Resources</h3>
<ul>
<li><a href="http://www.microsoft.com/sqlserver/2008/en/us/R2Downloads.aspx">Microsoft SQL Server 2008 R2 November CTP</a> </li>
<li><a href="http://msftdbprodsamples.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24854">AdventureWorks 2008 R2 Sample Databases</a> </li>
<li><a href="http://www.microsoft.com/visualstudio/try/default.mspx">Microsoft Visual Studio 2010 Ultimate 2010 Beta 2</a> </li>
<li><a href="http://www.powerpivot.com/download.aspx">Microsoft SQL Server PowerPivot for Excel</a> </li>
<li><a href="http://www.microsoft.com/office/2010/">Microsoft Office 2010 Excel Beta</a> </li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=77c30c6c-47fc-416d-88e7-8122534b3f37">Microsoft SharePoint Server 2010 Beta</a> </li>
</ul>
<p>Enjoy</p>
<p>Mariano</p>
<img src="http://feeds.feedburner.com/~r/mconverti/~4/jr2uL9HTXdc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/mconverti/2010/02/08/sql-server-2008-r2-update-for-developers-training-kit-released/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/mconverti/2010/02/08/sql-server-2008-r2-update-for-developers-training-kit-released/</feedburner:origLink></item>
		<item>
		<title>Optional Checkable Tree View Control for .NET Compact Framework 3.5</title>
		<link>http://feeds.southworks.net/~r/mconverti/~3/LWR9BQ_ye_M/</link>
		<comments>http://blogs.southworks.net/mconverti/2009/06/22/optional-checkable-tree-view-control-for-net-compact-framework-35/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 09:02:59 +0000</pubDate>
		<dc:creator>mconverti</dc:creator>
		
		<category><![CDATA[.NET Compact Framework]]></category>

		<category><![CDATA[Windows Mobile]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/mconverti/?p=126</guid>
		<description><![CDATA[
During this month I was working with my teammates Julian Dominguez and Diego Perez on a project that targeted Window Mobile 6.0 and the .NET Compact Framework 3.5. The main objective of this project was to create a module for an existing mobile application to let users perform different surveys and allowing them to navigate [...]]]></description>
			<content:encoded><![CDATA[<div style="height: 202px">
<p><a href="http://blogs.southworks.net/mconverti/files/2009/06/mobilecompactframework10.png"><img style="margin-left: 0px;margin-right: 0px" src="http://blogs.southworks.net/mconverti/files/2009/06/mobilecompactframework-thumb10.png" border="0" alt="Windows Mobile" width="138" height="191" align="left" /></a>During this month I was working with my teammates <a href="http://blogs.southworks.net/jdominguez/">Julian Dominguez</a> and <a href="http://blogs.southworks.net/dperez">Diego Perez</a> on a project that targeted <strong>Window Mobile 6.0</strong> and the <strong>.NET Compact Framework 3.5</strong>. The main objective of this project was to create a module for an existing mobile application to let users perform different surveys and allowing them to navigate and filter through the questions and answers (between other things).</p>
</div>
<p>Among all the requirements for this project, there was one that asked for a view to show a hierarchical list of the questions / answers of the survey grouped by their types. The special thing about this view was that only some items of the hierarchical list should be checkable. Julian and I tried to use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview(VS.80).aspx">TreeView</a> control included in the .NET Compact Framework, but this control does not allow you to choose which items are checkable and which are not. So we decided to extend the default TreeView and create an optional checkable TreeView control. These were the results:</p>
<p><a href="http://blogs.southworks.net/mconverti/files/2009/06/treeviewcontrols1.png"><img src="http://blogs.southworks.net/mconverti/files/2009/06/treeviewcontrols-thumb1.png" border="0" alt="Tree View Controls" width="555" height="377" /></a> </p>
<p>As you can see, in the default <strong>TreeView</strong> control (on the left) all the nodes has check boxes even the ones that are expandable. In the <strong>OptionalCheckableTreeView</strong> control (on the right) the expandable nodes are not checkable.</p>
<h3>Implementation Details</h3>
<p>Instead of setting the <a href="http://msdn.microsoft.com/library/system.windows.forms.treeview.checkboxes(VS.80).aspx"><span style="color: #669966">CheckBoxes</span></a> property of the TreeView to true, we are using images to display the check boxes (either in checked or unchecked state) and the minus and plus icons to expand the tree.</p>
<p>To accomplish this we had to add support for the <strong>NodeMouseClick</strong> event, which is not available in the .NET Compact Framework. This event allows us to check / uncheck / expand / collapse the clicked node and also change the image index. We followed the guidance provided in the following articles in <a href="http://msdn.microsoft.com/"><span style="color: #669966">MSDN</span></a>, with a few modifications:</p>
<ul>
<li><a href="http://msdn.microsoft.com/library/ms229683.aspx"><span style="color: #669966">How to: Use a Helper Class for Platform Invokes</span></a></li>
<li><a href="http://msdn.microsoft.com/library/ms229658.aspx"><span style="color: #669966">How to: Use a Class for Hooking Windows Procedures</span></a></li>
<li><a href="http://msdn.microsoft.com/library/ms229669.aspx"><span style="color: #669966">How to: Subclass a TreeView by Using Native Callbacks</span></a></li>
</ul>
<h3>Download</h3>
<p>Download the C# source code from <a href="http://blogs.southworks.net/mconverti/files/2009/06/optionalcheckabletreeview.zip">here</a>. The ZIP file contains the following:</p>
<ul>
<li><strong>OptionalCheckableTreeView.sln</strong>: Contains the source code for the <strong>OptionalCheckableTreeView</strong> control.</li>
<li><strong>OptionalCheckableTreeView.Sample.sln</strong>: Contains a sample application that uses the <strong>OptionalCheckableTreeView</strong> control.</li>
</ul>
<table border="1" cellspacing="0" cellpadding="2" width="520">
<tbody>
<tr>
<td width="520" valign="middle"><strong>Note</strong>: This code is provided “AS IS” with no warranties, and confers no rights.</td>
</tr>
</tbody>
</table>
<p>Feedback is always appreciated!</p>
<p>Mariano</p>
<div id="71e18c0a-c49d-4656-9e52-6788702ab44f" class="wlWriterEditableSmartContent" style="padding-bottom: 0px;margin: 0px;padding-left: 0px;padding-right: 0px;float: none;padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/Windows+Mobile+6.0">Windows Mobile 6.0</a>,<a rel="tag" href="http://technorati.com/tags/.NET+Compact+Framework+3.5">.NET Compact Framework 3.5</a>,<a rel="tag" href="http://technorati.com/tags/TreeView">TreeView</a></div>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.southworks.net%2fmconverti%2f2009%2f06%2f22%2foptional-checkable-tree-view-control-for-net-compact-framework-35%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.southworks.net%2fmconverti%2f2009%2f06%2f22%2foptional-checkable-tree-view-control-for-net-compact-framework-35%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<img src="http://feeds.feedburner.com/~r/mconverti/~4/LWR9BQ_ye_M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/mconverti/2009/06/22/optional-checkable-tree-view-control-for-net-compact-framework-35/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/mconverti/2009/06/22/optional-checkable-tree-view-control-for-net-compact-framework-35/</feedburner:origLink></item>
		<item>
		<title>How To: Integrate a Prism v2 application with the Silverlight 3 Navigation Framework</title>
		<link>http://feeds.southworks.net/~r/mconverti/~3/w-3EMOF20DM/</link>
		<comments>http://blogs.southworks.net/mconverti/2009/04/12/how-to-integrate-a-prism-v2-application-with-the-silverlight-3-navigation-framework/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 23:15:07 +0000</pubDate>
		<dc:creator>mconverti</dc:creator>
		
		<category><![CDATA[Composite WPF &amp; SL]]></category>

		<category><![CDATA[Navigation Framework]]></category>

		<category><![CDATA[Prism v2]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[Silverlight 3]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/mconverti/?p=120</guid>
		<description><![CDATA[The Silverlight 3 Beta release introduces a lot of new features and enhancements into the framework. One of them is Navigation, which allows us to easily implement navigation between UserControls / Pages, interact with the Browser History journal and define Uri mapping to map complex Uris with more friendly ones. To learn more about the [...]]]></description>
			<content:encoded><![CDATA[<p>The Silverlight 3 Beta release introduces a lot of new features and enhancements into the framework. One of them is <strong>Navigation</strong>, which allows us to easily implement navigation between UserControls / Pages, interact with the Browser History journal and define Uri mapping to map complex Uris with more friendly ones. To learn more about the Navigation Framework you can check the <a href="http://silverlight.net/learn/learnvideo.aspx?video=187319" target="_blank">Navigation Framework video</a> by <a href="http://timheuer.com/blog/">Tim Heuer</a>.</p>
<p>The purpose of this post is to provide an overview of the things that should be taken into account to use the Silverlight 3 Navigation Framework in a Prism v2 application, as well as the limitations / issues that you could come up with during the integration. I used the <a href="http://msdn.microsoft.com/en-us/library/dd490828.aspx">Remote Modularity QuickStart</a> (shipped with the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=fa07e1ce-ca3f-4b9b-a21b-e3fa10d013dd" target="_blank">Composite Application Guidance for WPF and Silverlight - February 2009</a>) as the base application and modified it to provide navigation among modules. As you can see in the image bellow, the original QS (in the left) shows all the modules at once and the updated one (in the right) provides navigation links to see each module page separately.</p>
<p><a href="http://blogs.southworks.net/mconverti/files/2009/04/remotemodularityqs.png"><img src="http://blogs.southworks.net/mconverti/files/2009/04/remotemodularityqs-thumb.png" border="0" alt="Remote Modularity QS using Navigation Framework" width="600" height="368" /></a></p>
<h3>System Requirements</h3>
<p>To be able to open the source code that accompanies this post and follow its guidance, you will need the following:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/vs2008/products/cc268305.aspx">Visual Studio 2008 SP1</a> or <a href="http://www.microsoft.com/express/vwd/">Visual Web Developer Express 2008 SP1</a></li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=11dc7151-dbd6-4e39-878f-5081863cbb5d">Microsoft® Silverlight™ 3 Tools Beta 1 for Visual Studio 2008 SP1</a></li>
</ul>
<table border="1" cellspacing="0" cellpadding="2" width="550">
<tbody>
<tr>
<td width="548" valign="top"><strong>Note</strong>: Once you install the Silverlight 3 Beta Tools for Visual Studio, your development environment will be a Silverlight 3 Beta environment.  Visual Studio 2008 SP1 does not support multi-targeting for Silverlight applications so you will be unable to develop Silverlight 2 applications once these tools are installed.</td>
</tr>
</tbody>
</table>
<h3>Steps</h3>
<p>The following are the general steps that I performed to add navigation functionality to the <strong>Remote Modularity QuickStart</strong>, but they could also be reused in other Prism v2 applications:</p>
<ol>
<li>Add a reference to the <strong>System.Windows.Controls.Navigation</strong> assembly in the Shell project. This assembly contains the <strong>Frame</strong> and <strong>Page</strong> controls needed to navigate and the classes that allow the mapping of the Uris.</li>
<li>Add a <strong>Frame</strong> control to the Shell of the Silverlight application. The <strong>Frame </strong>control is the container for pages. It allows you to navigate to a Uri and exposes a bunch of useful events related to navigation.
<pre><span style="color: blue">&lt;</span><span style="color: #a31515">UserControl </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Class</span><span style="color: blue">=&#8221;RemoteModuleLoading.Shell&#8221;
   </span><span style="color: red"> …</span><span style="color: blue">
    </span><strong><span style="color: red">xmlns</span><span style="color: blue">:</span><span style="color: red">navigation</span></strong><span style="color: blue"><strong>=&#8221;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation&#8221;</strong></span><span style="color: blue">&gt;
    …</span><span style="color: blue">
    &lt;</span><span style="color: #a31515">StackPanel</span><span style="color: blue">&gt;
        </span><span style="color: blue">&lt;</span><span style="color: #a31515">ItemsControl </span><strong><span style="color: red">cal</span><span style="color: blue">:</span><span style="color: red">RegionManager.RegionName</span><span style="color: blue">=&#8221;LinkRegion&#8221;</span></strong><span style="color: blue">&gt;
            &lt;</span><span style="color: #a31515">ItemsControl.ItemsPanel</span><span style="color: blue">&gt;
                &lt;</span><span style="color: #a31515">ItemsPanelTemplate</span><span style="color: blue">&gt;
                    &lt;</span><span style="color: #a31515">StackPanel </span><span style="color: red">Orientation</span><span style="color: blue">=&#8221;Horizontal&#8221;/&gt;
                &lt;/</span><span style="color: #a31515">ItemsPanelTemplate</span><span style="color: blue">&gt;
            &lt;/</span><span style="color: #a31515">ItemsControl.ItemsPanel</span><span style="color: blue">&gt;
            &lt;</span><span style="color: #a31515">ItemsControl.Items</span><span style="color: blue">&gt;
                &lt;</span><span style="color: #a31515">HyperlinkButton </span><span style="color: red">Content</span><span style="color: blue">=&#8221;Home&#8221; </span><span style="color: red">Tag</span><span style="color: blue">=&#8221;Home&#8221;
                     </span><span style="color: red">cmd</span><span style="color: blue">:</span><span style="color: red">Click.Command</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">Binding </span><span style="color: red">NavigateCommand</span><span style="color: blue">}&#8221;
                     </span><span style="color: red">cmd</span><span style="color: blue">:</span><span style="color: red">Click.CommandParameter</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">Binding </span><span style="color: red">RelativeSource</span><span style="color: blue">={</span><span style="color: #a31515">RelativeSource </span><span style="color: red">Self</span><span style="color: blue">}, </span><span style="color: red">Path</span><span style="color: blue">=Tag}&#8221; /&gt;
            &lt;/</span><span style="color: #a31515">ItemsControl.Items</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">ItemsControl</span><span style="color: blue">&gt;
        </span><span style="color: blue"><strong>&lt;</strong></span><strong><span style="color: #a31515">navigation</span><span style="color: blue">:</span><span style="color: #a31515">Frame </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&#8221;MainFrame&#8221; </span><span style="color: red">Source</span></strong><span style="color: blue"><strong>=&#8221;Home&#8221; /&gt;
</strong>    &lt;/</span><span style="color: #a31515">StackPanel</span><span style="color: blue">&gt;
    …</span><span style="color: blue">
&lt;/</span><span style="color: #a31515">UserControl</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></li>
<li>Add a <strong>UriMapper</strong> to the Application Resources in the <strong>App.xaml</strong> file.
<pre><span style="color: blue">&lt;</span><span style="color: #a31515">Application</span><span style="color: blue">
             </span><span style="color: red">…</span><span style="color: blue">
             </span><strong><span style="color: red">xmlns</span><span style="color: blue">:</span><span style="color: red">navcore</span><span style="color: blue">=&#8221;clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation&#8221;</span></strong><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Application.Resources</span><span style="color: blue">&gt;</span><span style="color: blue">
        <strong>&lt;</strong></span><strong><span style="color: #a31515">navcore</span><span style="color: blue">:</span><span style="color: #a31515">UriMapper </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Key</span></strong><strong><span style="color: blue">=&#8221;uriMapper&#8221;&gt;
            &lt;</span><span style="color: #a31515">navcore</span><span style="color: blue">:</span><span style="color: #a31515">UriMapping </span><span style="color: red">Uri</span><span style="color: blue">=&#8221;Home&#8221; </span><span style="color: red">MappedUri</span></strong><strong><span style="color: blue">=&#8221;/Views/Home.xaml&#8221; /&gt;
        &lt;/</span><span style="color: #a31515">navcore</span><span style="color: blue">:</span><span style="color: #a31515">UriMapper</span></strong><span style="color: blue"><strong>&gt;
</strong>    &lt;/</span><span style="color: #a31515">Application.Resources</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Application</span><span style="color: blue">&gt;</span></pre>
</li>
<li>Add UriMappings inside the <strong>Initialize</strong> method of the <strong>Module</strong> class of each module. The <strong>UriMapping</strong> class allows us to display a more user friendly Url in the browser. Defining this mapping inside each module avoids having them hard-coded inside the Shell project.
<pre><span style="color: blue">public void </span>Initialize()
{
    <strong>AddModuleUriMappings();</strong>

    <span style="color: blue">this</span>.regionManager.Regions[<span style="color: #a31515">"LinkRegion"</span>].Add(<span style="color: blue">new </span><span style="color: #2b91af">ModuleZLink</span>());
}

<span style="color: blue">private static void </span>AddModuleUriMappings()
{
    <strong><span style="color: #2b91af">UriMapper </span>mapper = (<span style="color: #2b91af">UriMapper</span>)<span style="color: #2b91af">Application</span>.Current.Resources[<span style="color: #a31515">"uriMapper"</span>];
    mapper.UriMappings.Add(<span style="color: blue">new </span><span style="color: #2b91af">UriMapping</span>()
                        {
                            Uri = <span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(<span style="color: #a31515">&#8220;ModuleZ&#8221;</span>, <span style="color: #2b91af">UriKind</span>.Relative),
                            MappedUri = <span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(<span style="color: #a31515">&#8220;/ModuleZ;component/DefaultViewZ.xaml&#8221;</span>,
                                                <span style="color: #2b91af">UriKind</span>.Relative)
                        });
</strong>}</pre>
<p><a href="http://11011.net/software/vspaste"></a></li>
<li>For each module, add an <strong>UserControl</strong> containing an <strong>HyperlinkButton</strong> which points to the Uri previously mapped. This <strong>UserControl</strong> is added to the <strong>LinkRegion</strong> of the Shell when the module is initialized.
<pre><span style="color: blue">&lt;</span><span style="color: #a31515">UserControl </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Class</span><span style="color: blue">=&#8221;ModuleZ.ModuleZLink&#8221;
    </span><span style="color: red">xmlns</span><span style="color: blue">=&#8221;http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
    </span><span style="color: red">xmlns</span><span style="color: blue">:</span><span style="color: red">x</span><span style="color: blue">=&#8221;http://schemas.microsoft.com/winfx/2006/xaml&#8221;
    </span><span style="color: red">xmlns</span><span style="color: blue">:</span><span style="color: red">cal</span><span style="color: blue">=&#8221;clr-namespace:Microsoft.Practices.Composite.Presentation.Commands;assembly=Microsoft.Practices.Composite.Presentation&#8221;&gt;

    &lt;</span><span style="color: #a31515">HyperlinkButton </span><span style="color: red">Content</span><span style="color: blue">=&#8221;Module Z&#8221; </span><span style="color: red"><strong>Tag</strong></span><span style="color: blue"><strong>=&#8221;ModuleZ&#8221;</strong>
                     </span><span style="color: red">cal</span><span style="color: blue">:</span><span style="color: red">Click.Command</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">Binding </span><span style="color: red">NavigateCommand</span><span style="color: blue">}&#8221;
                     </span><span style="color: red">cal</span><span style="color: blue">:</span><span style="color: red">Click.CommandParameter</span><span style="color: blue">=&#8221;{</span><span style="color: #a31515">Binding </span><span style="color: red">RelativeSource</span><span style="color: blue">={</span><span style="color: #a31515">RelativeSource </span><span style="color: red">Self</span><span style="color: blue">}, </span><span style="color: red">Path</span><span style="color: blue">=Tag}&#8221; /&gt;

&lt;/</span><span style="color: #a31515">UserControl</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<table border="1" cellspacing="0" cellpadding="2" width="500">
<tbody>
<tr>
<td width="498" valign="top"><strong>Note</strong>: The value of the <strong>Tag</strong> property of the <strong>HyperlinkButton</strong> control is the Uri that will be used for navigate. Also notice that I’ve bound the <strong>Click</strong> event of the control to a <strong>NavigateCommand</strong>. </p>
<p>For more information related to commands, see <a href="http://msdn.microsoft.com/en-us/library/dd458928.aspx">Commands</a> article in Prism v2 documentation.</td>
</tr>
</tbody>
</table>
</li>
<li>Create a global <a href="http://msdn.microsoft.com/en-us/library/dd458862.aspx">CompositeCommand</a> to handle the navigation within the frame. In this way, all the links previously added will use the frame control defined in the Shell to perform the navigation when they are clicked.
<pre><span style="color: blue">public </span>Shell(<span style="color: #2b91af">IUnityContainer </span>container, <strong><span style="color: #2b91af">CommandProxy </span>command</strong>)
{
    InitializeComponent();

    <span style="color: blue">this</span>.container = container;
    <strong>command.NavigateCommand.RegisterCommand(<span style="color: blue">new </span><span style="color: #2b91af">DelegateCommand</span>&lt;<span style="color: blue">string</span>&gt;(<span style="color: blue">this</span>.OnNavigate));</strong>

    <span style="color: blue">this</span>.MainFrame.Navigated += <span style="color: blue">new </span><span style="color: #2b91af">NavigatedEventHandler</span>(<span style="color: blue">this</span>.MainFrame_Navigated);
    <span style="color: blue">this</span>.DataContext = command;
}

<strong><span style="color: blue">private void </span>OnNavigate(<span style="color: blue">string </span>url)
{
    <span style="color: blue">this</span>.MainFrame.Navigate(<span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(url, <span style="color: #2b91af">UriKind</span>.Relative));
}</strong></pre>
<p><a href="http://11011.net/software/vspaste"></a></li>
<li>Add a handler to the <strong>Navigated</strong> event of the frame control to perform dependency injection in the pages. This requires all the pages to use property injection instead of constructor injection.
<pre><span style="color: blue">private readonly </span><span style="color: #2b91af">IUnityContainer </span>container;

<span style="color: blue">private void </span>MainFrame_Navigated(<span style="color: blue">object </span>sender, <span style="color: #2b91af">NavigationEventArgs </span>e)
{
    <strong><span style="color: blue">if </span>(e.Content != <span style="color: blue">null</span>)
    {
        <span style="color: blue">this</span>.container.BuildUp(e.Content.GetType(), e.Content);
    }
</strong>}</pre>
<p><a href="http://11011.net/software/vspaste"></a></li>
</ol>
<p>You can download the final solution from the <a href="http://blogs.southworks.net/mconverti/wp-admin/#_Download">Download</a> section bellow.</p>
<h3><a name="_Limitations"></a>Limitations / Issues when modules are loaded dynamically</h3>
<p>When the modules are <strong>statically loaded</strong>, all the above steps work without problems. All the assemblies are declared in the <strong>AppManifest.xaml</strong> file of the Silverlight application and deployed / loaded before the application starts. Therefore, all the types and resources defined in the modules are available for navigation.</p>
<p>However, if the modules are <strong>dynamically loaded</strong> like in the <strong>Remote Modularity QuickStart</strong>, they are not included in the <strong>AppManifest.xaml</strong> file because their assemblies are deployed on demand by the CAL. This causes some problems when trying to crate an instance of a page class during the navigation. The exception you get says that the type specified in the <strong>x:Class </strong>attribute of the XAML could not be found in any loaded assembly. I’ve tried the following things to bypass this limitation without success:</p>
<ol>
<li>Modified the <strong>XapModuleTypeLoader</strong> class of the CAL to add all the <a href="http://msdn.microsoft.com/en-us/library/system.windows.assemblypart(VS.96).aspx" target="_blank">AssemblyPart</a>s of the modules to the <a href="http://msdn.microsoft.com/en-us/library/system.windows.deployment.parts(VS.96).aspx" target="_blank">Deployment.Current.Parts</a> collection. This caused no effect.</li>
<li>Tried to add the assembly name to the <a href="http://msdn.microsoft.com/en-us/library/cc189082(VS.96).aspx">x:Class</a> attribute of each page. However, I was no able to specify the assembly in the <strong>x:Class</strong> attribute using the syntax <strong>x:Class=&#8221;namespace.classname<em>;assembly=</em>assemblyname&#8221;</strong> like the <a href="http://msdn.microsoft.com/en-us/library/cc189082(VS.96).aspx">official Silverlight documentation</a> explains. I got a compilation error saying that the value of the x:Class attribute is not a valid fully qualified class name.</li>
</ol>
<p>Finally I opted for a workaround and found the following two possible ones:</p>
<ol>
<li><strong>Remove code behind classes in module’s pages</strong>: If your pages do not contain any <strong>x:Class</strong> attribute the navigation will work smoothly. You can take advantage of all the features available in Silverlight 3 (like Bindings, Commands, StaticResources, etc) to avoid having a code behind class.</li>
<li><strong>Use a Placeholder page in the shell module to host module pages</strong>: If your pages are complex and you cannot avoid having code behind classes, you can create a page in the Shell module to which all modules can navigate. This placeholder page will receive as a QueryString parameter the type of the view that should contain, resolve it in the application Container and add it to its <strong>Content</strong> property. This logic should be placed in the <strong>Loaded</strong> event of the page.
<pre><span style="color: green">// Loaded event of the placeholder page
</span><span style="color: blue">private void </span>ModulePlaceHolderPage_<strong>Loaded</strong>(<span style="color: blue">object </span>sender, <span style="color: #2b91af">RoutedEventArgs </span>e)
{
    <span style="color: blue">string </span>type = <span style="color: blue">this</span>.NavigationContext.QueryString[<span style="color: #a31515">"viewType"</span>];
    <span style="color: #2b91af">UIElement </span>moduleView = <span style="color: blue">null</span>;

    <span style="color: blue">if </span>((type != <span style="color: blue">null</span>) &amp;&amp; (<span style="color: #2b91af">Type</span>.GetType(type) != <span style="color: blue">null</span>))
    {
        <span style="color: #2b91af">Type </span>viewType = <span style="color: #2b91af">Type</span>.GetType(type, <span style="color: blue">false</span>);
        moduleView = <span style="color: blue">this</span>.Container.Resolve(viewType) <span style="color: blue">as </span><span style="color: #2b91af">UIElement</span>;
    }

    <span style="color: green">// Show in the content place holder the module view
    </span><span style="color: blue">this</span>.Content = (moduleView != <span style="color: blue">null</span>) ? moduleView :
                                          <span style="color: blue">new </span><span style="color: #2b91af">TextBlock</span>()
                                          {
                                              Foreground = <span style="color: blue">new </span><span style="color: #2b91af">SolidColorBrush</span>(<span style="color: #2b91af">Colors</span>.Red),
                                              TextWrapping = <span style="color: #2b91af">TextWrapping</span>.Wrap,
                                              Text = <span style="color: #2b91af">String</span>.Format(<span style="color: #2b91af">CultureInfo</span>.CurrentUICulture,
                                                                   <span style="color: #a31515">&#8220;View {0} was not found.&#8221;</span>, type)
                                          };
    <span style="color: blue">this</span>.Title = <span style="color: blue">this</span>.NavigationContext.QueryString[<span style="color: #a31515">"title"</span>];
}</pre>
<p>Each module should also define its own Uri mappings to point the placeholder page adding the right QueryString parameters.</p>
<pre><span style="color: blue">private static </span><span style="color: #2b91af">Uri </span>CreateModuleUri()
{
    <strong><span style="color: blue">string </span>queryString = <span style="color: #2b91af">String</span>.Format(<span style="color: #a31515">&#8220;viewType={0}&amp;title={1}&#8221;</span>,
                                       <span style="color: blue">typeof</span>(<span style="color: #2b91af">DefaultViewY</span>).AssemblyQualifiedName,   </strong><strong><span style="color: green">// View type
                                       </span><span style="color: #a31515">&#8220;Module Y - RemoteModuleLoading Quickstart&#8221;</span>); </strong><span style="color: green"><strong>// Title
</strong>
    // I added the base Uri of the placeholder page inside the Shell project.
    </span><span style="color: blue">string </span>modulePlaceHolderUri = <span style="color: #2b91af">Application</span>.Current.Resources[<span style="color: #a31515">"placeHolderUri"</span>] <span style="color: blue">as string</span>;

    <span style="color: blue">return new </span><span style="color: #2b91af">Uri</span>(<span style="color: #2b91af">String</span>.Format(<span style="color: #a31515">&#8220;{0}?{1}&#8221;</span>, modulePlaceHolderUri, queryString), <span style="color: #2b91af">UriKind</span>.Relative);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></li>
</ol>
<h3><a name="_Download"></a>Download</h3>
<p>Download the C# source code from <a href="http://blogs.southworks.net/mconverti/files/2009/04/silverlight3navigationwithprism2.zip">here</a>. The file contains the following:</p>
<ul>
<li><strong>CAL folder</strong>: contains the source code of the Composite Application Library shipped with the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=fa07e1ce-ca3f-4b9b-a21b-e3fa10d013dd">Composite Application Guidance for WPF and Silverlight - February 2009</a>.</li>
<li><strong>LIB folder</strong>: contains assemblies required by the Composite Application Library.</li>
<li><strong>RemoteModularityQuickstart folder</strong>: contains the updated Remote Modularity Quickstart to use navigation functionality with the Silverlight 3 Navigation Framework using workarounds described previously.</li>
<li><strong>StaticModularityQuickstart folder</strong>: contains the updated Remote Modularity Quickstart to use navigation functionality with the Silverlight 3 Navigation Framework and modified to statically load modules.</li>
</ul>
<table border="1" cellspacing="0" cellpadding="1" width="550">
<tbody>
<tr>
<td width="550" valign="top"><strong>Note</strong>: This code is provided “AS IS” with no warranties, and confers no rights.</td>
</tr>
</tbody>
</table>
<p>Feedback is always appreciated!</p>
<p>Mariano</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.southworks.net%2fmconverti%2f2009%2f04%2f12%2fhow-to-integrate-a-prism-v2-application-with-the-silverlight-3-navigation-framework%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.southworks.net%2fmconverti%2f2009%2f04%2f12%2fhow-to-integrate-a-prism-v2-application-with-the-silverlight-3-navigation-framework%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<img src="http://feeds.feedburner.com/~r/mconverti/~4/w-3EMOF20DM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/mconverti/2009/04/12/how-to-integrate-a-prism-v2-application-with-the-silverlight-3-navigation-framework/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/mconverti/2009/04/12/how-to-integrate-a-prism-v2-application-with-the-silverlight-3-navigation-framework/</feedburner:origLink></item>
		<item>
		<title>How To: Pass parameters to Commands Handlers in Composite UI Application Block (CAB) / SCSF</title>
		<link>http://feeds.southworks.net/~r/mconverti/~3/Ik763cN3Ou8/</link>
		<comments>http://blogs.southworks.net/mconverti/2009/02/04/how-to-pass-parameters-to-commands-handlers-in-composite-ui-application-block-cab-scsf/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 18:08:53 +0000</pubDate>
		<dc:creator>mconverti</dc:creator>
		
		<category><![CDATA[CAB]]></category>

		<category><![CDATA[SCSF]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/mconverti/?p=119</guid>
		<description><![CDATA[This week there were some questions in the SCSF Codeplex Forum asking for a way to pass custom parameters to a method marked as a Command Handler. As you may know, there is no out-of-the-box way to do it because they are raised internally by the Command class and, since you usually bind a command [...]]]></description>
			<content:encoded><![CDATA[<p>This week there were some questions in the <a href="http://www.codeplex.com/smartclient/Thread/List.aspx">SCSF Codeplex Forum</a> asking for a way to pass custom parameters to a method marked as a Command Handler. As you may know, there is no out-of-the-box way to do it because they are raised internally by the Command class and, since you usually bind a command to a control event via the <strong>AddInvoker</strong> method, you cannot manage when the command is executed.</p>
<p>Additionally, the signature of a command handler is fixed and should always be like the following:</p>
<pre>[<span style="color: #2b91af">CommandHandler</span>(<span style="color: #2b91af">CommandNames</span>.MyCommand)]
<span style="color: blue">public void </span>OnMyCommandHandler(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>args)
{
    <span style="color: green">// The sender parameter is an instance of the Command class.
    </span><span style="color: #2b91af">Command </span>cmd = sender <span style="color: blue">as </span><span style="color: #2b91af">Command</span>;

    <span style="color: green">// The args parameter is empty.
    </span><span style="color: blue">bool </span>f = (args == <span style="color: #2b91af">EventArgs</span>.Empty);
} </pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The instance of the Command class received in the <strong>sender</strong> parameter could be useful, for example, if you want to change the status of the command to <strong>Enabled</strong>, <strong>Disabled</strong> or <strong>Unavailable</strong>.</p>
<pre>cmd.Status = <span style="color: #2b91af">CommandStatus</span>.Disabled;</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>But, <strong>what if you want to share the same command handler for different command invokers (like several menu items) and perform some operations based on which item was the invoker?</strong> You will somehow need to receive a parameter describing which was the item that raised the command.</p>
<h3>Workaround</h3>
<p>A possible workaround to <i>receive parameters</i> using a command could be by not adding your items as invokers of the command and instead execute the command programmatically. If you do this, you could use the <strong>State</strong> collection of the RootWorkItem to <em>pass parameters</em> to the command. </p>
<p>To implement this workaround follow these steps (the code use the ToolStripMenuItem control but could be used with other toolstrip controls): </p>
<ol>
<li>Add the parameter that you want to receive in the command handler to the <strong>Tag</strong> property of your menu item control: 
<pre><span style="color: #2b91af">ToolStripMenuItem </span>item = <span style="color: blue">new </span><span style="color: #2b91af">ToolStripMenuItem</span>() { Text = <span style="color: #a31515">&#8220;My Menu Item&#8221;</span>, <strong>Tag = <span style="color: #a31515">&#8220;My Tag&#8221;</span></strong>};</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<li>Add a handler for the <strong>Click </strong>event to your menu item:
<pre>item.Click += <span style="color: blue">new </span><span style="color: #2b91af">EventHandler</span>(Item_Click);</pre>
<li>In the <b>Item_Click</b> method, add the Tag of your item to the <b>State</b> collection of the <strong>RootWorkItem</strong> and execute the command programmatically:
<pre>WorkItem.RootWorkItem.State[<span style="color: #a31515">"LastTag"</span>] = item.Tag;
WorkItem.Commands[<span style="color: #2b91af">CommandNames</span>.CommandWithParameters].Execute();</pre>
<li>In the command handler, retrieve the Tag from the State collection:
<pre><span style="color: blue">string </span>tag = WorkItem.RootWorkItem.State[<span style="color: #a31515">"LastTag"</span>] <span style="color: blue">as string</span>;</pre>
<p><a href="http://11011.net/software/vspaste"></a></li>
</ol>
<p>The following code shows a ModuleController class that demonstrates how the approach above could be implemented:</p>
<pre><span style="color: blue">public class </span><span style="color: #2b91af">ModuleController </span>: <span style="color: #2b91af">WorkItemController
</span>{
    <span style="color: blue">public override void </span>Run()
    {
        AddServices();
        ExtendMenu();
        AddViews();
    }

    <span style="color: blue">private void </span>ExtendMenu()
    {
        AddTaggedMenuItem(<span style="color: #a31515">&#8220;Menu Item 1&#8243;</span>, <span style="color: #a31515">&#8220;Tag 1&#8243;</span>, <span style="color: #2b91af">UIExtensionSiteNames</span>.ModulesMenu);
        AddTaggedMenuItem(<span style="color: #a31515">&#8220;Menu Item 2&#8243;</span>, <span style="color: #a31515">&#8220;Tag 2&#8243;</span>, <span style="color: #2b91af">UIExtensionSiteNames</span>.ModulesMenu);
        AddTaggedMenuItem(<span style="color: #a31515">&#8220;Menu Item 3&#8243;</span>, <span style="color: #a31515">&#8220;Tag 3&#8243;</span>, <span style="color: #2b91af">UIExtensionSiteNames</span>.ModulesMenu);
        AddTaggedMenuItem(<span style="color: #a31515">&#8220;Menu Item 4&#8243;</span>, <span style="color: #a31515">&#8220;Tag 4&#8243;</span>, <span style="color: #2b91af">UIExtensionSiteNames</span>.ModulesMenu);
    }

    <span style="color: blue">private void </span>AddTaggedMenuItem(<span style="color: blue">string </span>menuText, <span style="color: blue">string </span>menuTag, <span style="color: blue">string </span>extensionSiteName)
    {
        <span style="color: #2b91af">ToolStripMenuItem </span>menuItem = <span style="color: blue">new </span><span style="color: #2b91af">ToolStripMenuItem</span>() { Text = menuText, ToolTipText = menuText, Tag = menuTag };

        menuItem.Click += <span style="color: blue">new </span><span style="color: #2b91af">EventHandler</span>(MenuItem_Click);

        WorkItem.UIExtensionSites[extensionSiteName].Add(menuItem);
    }

    <span style="color: blue">private void </span>MenuItem_Click(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e)
    {
        <span style="color: #2b91af">ToolStripMenuItem </span>item = sender <span style="color: blue">as </span><span style="color: #2b91af">ToolStripMenuItem</span>;

        <span style="color: blue">if </span>(item != <span style="color: blue">null</span>)
        {
            WorkItem.RootWorkItem.State[<span style="color: #a31515">"LastTag"</span>] = item.Tag;
            WorkItem.Commands[<span style="color: #2b91af">CommandNames</span>.CommandWithParameters].Execute();
        }
    }

    [<span style="color: #2b91af">CommandHandler</span>(<span style="color: #2b91af">CommandNames</span>.CommandWithParameters)]
    <span style="color: blue">public void </span>OnCommandWithParameters(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>args)
    {
        <span style="color: blue">string </span>tag = WorkItem.RootWorkItem.State[<span style="color: #a31515">"LastTag"</span>] <span style="color: blue">as string</span>;

        <span style="color: blue">if </span>(tag != <span style="color: blue">null</span>)
        {
            <span style="color: #2b91af">MessageBox</span>.Show(<span style="color: #a31515">&#8220;The tag received in the command handler is: &#8221; </span>+ tag, <span style="color: #a31515">&#8220;Tags&#8221;</span>);
        }
    }

    <span style="color: green">// &#8230;
</span>}</pre>
<p>In this way, the <strong>State</strong> collection is used as a container for your custom command parameters.</p>
<p>&nbsp;</p>
<p>Enjoy.</p>
</p>
<div class="wlWriterSmartContent" id="8e6b10e2-b441-4deb-bf91-97dc72185b1c" style="padding-right: 0px;padding-left: 0px;padding-bottom: 0px;margin: 0px;padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/CAB" rel="tag">CAB</a>,<a href="http://technorati.com/tags/SCSF" rel="tag">SCSF</a>,<a href="http://technorati.com/tags/composite%20UI%20Application%20Block" rel="tag">composite UI Application Block</a>,<a href="http://technorati.com/tags/smart%20Client%20Software%20Factory" rel="tag">smart Client Software Factory</a></div>
<img src="http://feeds.feedburner.com/~r/mconverti/~4/Ik763cN3Ou8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/mconverti/2009/02/04/how-to-pass-parameters-to-commands-handlers-in-composite-ui-application-block-cab-scsf/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/mconverti/2009/02/04/how-to-pass-parameters-to-commands-handlers-in-composite-ui-application-block-cab-scsf/</feedburner:origLink></item>
		<item>
		<title>Migrating Prism v2 Silverlight applications from static to dynamic module loading</title>
		<link>http://feeds.southworks.net/~r/mconverti/~3/L9F2uDnAo0I/</link>
		<comments>http://blogs.southworks.net/mconverti/2009/02/02/migrating-prism-v2-silverlight-applications-from-static-to-dynamic-module-loading/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 16:37:29 +0000</pubDate>
		<dc:creator>mconverti</dc:creator>
		
		<category><![CDATA[Prism v2]]></category>

		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/mconverti/?p=118</guid>
		<description><![CDATA[The P&#38;P Sustained Engineering Team has published an article in the Composite WPF &#38; Silverlight Knowledge Base that explains how to modify the Prism v2 Silverlight Reference Implementation so it uses Dynamic Module Loading. By doing this, each module generates its own XAP file and the ModulesCatalog.xaml file in the Shell project defines how modules [...]]]></description>
			<content:encoded><![CDATA[<p>The P&amp;P Sustained Engineering Team has published an <a href="http://www.codeplex.com/CompositeWPF/Wiki/View.aspx?title=Migrating%20Prism%20v2%20RI%20from%20static%20to%20dynamic%20module%20loading">article</a> in the <a href="http://www.codeplex.com/CompositeWPF/Wiki/View.aspx?title=Knowledge%20Base">Composite WPF &amp; Silverlight Knowledge Base</a> that explains how to modify the <strong>Prism v2 Silverlight Reference Implementation</strong> so it uses <strong>Dynamic Module Loading</strong>. By doing this, each module generates its own <strong>XAP </strong>file and the <strong>ModulesCatalog.xaml</strong> file in the Shell project defines how modules should be loaded:</p>
<ul>
<li><a href="http://www.codeplex.com/CompositeWPF/Wiki/View.aspx?title=Migrating%20Prism%20v2%20RI%20from%20static%20to%20dynamic%20module%20loading">Migrating Prism v2 RI from static to dynamic module loading</a></li>
</ul>
<p>As I mentioned, the article targets the migration of the <strong>Silverlight Reference Implementation</strong> included in the <a href="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=22566">Prism V2 - Drop 10</a>, but you could use it as a guidance to migrate any Prism v2 Silverlight application from static to dynamic (remote) module loading. The main steps are:</p>
<ol>
<li>Update <strong>Silverlight class library</strong> projects to <strong>Silverlight application</strong> projects to generate <strong>XAP</strong> files</li>
<li>Set up remote module loading by adding a <strong>ModulesCatalog.xaml</strong> file and modify the <strong>Bootstrapper</strong> class</li>
<li>Create a <strong>Web Application Project</strong> to host the application</li>
</ol>
<p>The team also published the following:</p>
<ul>
<li>The <a href="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=CompositeWPF&amp;DownloadId=56997">PDF</a> version of the article</li>
<li>The updated <a href="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=CompositeWPF&amp;DownloadId=56998">source code</a> of the Silverligh RI</li>
</ul>
<table border="1" cellspacing="0" cellpadding="1" width="545">
<tbody>
<tr>
<td width="540" valign="top"><strong>Disclaimer:</strong> The code is provided &#8220;AS IS&#8221; with no warranties, and confers no rights.</td>
</tr>
</tbody>
</table>
<img src="http://feeds.feedburner.com/~r/mconverti/~4/L9F2uDnAo0I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/mconverti/2009/02/02/migrating-prism-v2-silverlight-applications-from-static-to-dynamic-module-loading/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/mconverti/2009/02/02/migrating-prism-v2-silverlight-applications-from-static-to-dynamic-module-loading/</feedburner:origLink></item>
		<item>
		<title>How To: Use the Ngen tool to improve the performance in CAB / SCSF applications</title>
		<link>http://feeds.southworks.net/~r/mconverti/~3/p3EAEUm0Gq8/</link>
		<comments>http://blogs.southworks.net/mconverti/2009/01/06/how-to-use-the-ngen-tool-to-improve-the-performance-in-cab-scsf-applications/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 13:15:36 +0000</pubDate>
		<dc:creator>mconverti</dc:creator>
		
		<category><![CDATA[CAB]]></category>

		<category><![CDATA[NGen]]></category>

		<category><![CDATA[SCSF]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/mconverti/?p=109</guid>
		<description><![CDATA[There are some scenarios, like applications with a very big number of modules and views, that could present performance issues at startup due to the just-in-time (JIT) compilation process. In these cases it could be useful to precompile the assemblies using the Ngen tool.
The Native Image Generator (Ngen.exe) is a tool that improves the performance [...]]]></description>
			<content:encoded><![CDATA[<p>There are some scenarios, like applications with a very big number of modules and views, that could present performance issues at startup due to the just-in-time (JIT) compilation process. In these cases it could be useful to precompile the assemblies using the <strong>Ngen</strong> tool.</p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/6t9t5wcf(VS.80).aspx">Native Image Generator (Ngen.exe)</a> is a tool that improves the performance of managed applications by creating native images, which are files containing compiled processor-specific machine code. This allows the runtime to use native images instead of using the just-in-time (JIT) compiler to compile the original assembly code in runtime. One disadvantage of native images is that you cannot use the <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.loadfrom(VS.80).aspx">Assembly.LoadFrom</a> method to load them.</p>
<p>If you are a user of CAB / SCSF, you may be aware of the <a href="http://msdn.microsoft.com/en-us/library/cc540704.aspx">Module Loader Service</a>. This service allows you to load modules&#8217; assemblies at run time when the application starts. The default implementation of this service uses the <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.loadfrom(VS.80).aspx">Assembly.LoadFrom</a> method to load the assemblies enumerated by the <a href="http://msdn.microsoft.com/en-us/library/cc540702.aspx">Module Enumerator Service</a>. So, <strong>if you try to &#8220;Ngen a CAB based application&#8221;, the native images of all your modules are not going to be used (the modules will be JIT compiled like always)</strong>.</p>
<h3>Workaround: Change the Module Loader Service class to use Assembly.Load method</h3>
<p>This workaround enables the usage of the <a href="http://msdn.microsoft.com/en-us/library/ky3942xh.aspx">Assembly.Load</a> method instead of the <a href="http://msdn.microsoft.com/en-us/library/1009fa28.aspx">Assembly.LoadFrom</a> method in the Module Loader Service class. The only limitation is that the modules’ assemblies must be physically located in the application’s working directory. To apply the workaround follow these steps:</p>
<ol>
<li>If you have an SCSF solution, open the <strong>DependentModuleLoaderService.cs</strong> file located in the <strong>Services</strong> folder of the <strong>Infrastructure.Library</strong> project. If you are using CAB without SCSF, open the <strong>ModuleLoaderService.cs</strong> file located in the <strong>Services</strong> folder of the <strong>CompositeUI</strong> project.</li>
<li>Replace the implementation of the <strong>Load(WorkItem workItem, params Assembly[] assemblies)</strong> method for the following one:
<pre><span style="color: #0000ff">public void </span>Load(<span style="color: #2b91af">WorkItem </span>workItem, <span style="color: #0000ff">params </span><span style="color: #2b91af">Assembly</span>[] assemblies)
{
    <span style="color: #2b91af">Guard</span>.ArgumentNotNull(workItem, <span style="color: #a31515">&#8220;workItem&#8221;</span>);
    <span style="color: #2b91af">Guard</span>.ArgumentNotNull(assemblies, <span style="color: #a31515">&#8220;assemblies&#8221;</span>);

    <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">IModuleInfo</span>&gt; modules = <span style="color: #0000ff">new </span><span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">IModuleInfo</span>&gt;();

    <span style="color: #0000ff">foreach </span>(<span style="color: #2b91af">Assembly </span>assembly <span style="color: #0000ff">in </span>assemblies)
    {
        <span style="color: #2b91af">ModuleInfo </span>mi = <span style="color: #0000ff">new </span><span style="color: #2b91af">ModuleInfo</span>(assembly);
        <span style="color: #008000">// Use Assembly&#8217;s Full Name instead of the Assembly&#8217;s File Name.
        </span><strong>mi.SetAssemblyFile(assembly.FullName);</strong>
        modules.Add(mi);
    }

    InnerLoad(workItem, modules.ToArray());
}</pre>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></li>
<li>Replace the implementation of the <strong>LoadAssembly(string assemblyFile)</strong> method for the following one:
<pre><span style="color: #0000ff">private </span><span style="color: #2b91af">Assembly </span>LoadAssembly(<span style="color: #0000ff">string </span>assemblyName)
{
    <span style="color: #2b91af">Guard</span>.ArgumentNotNullOrEmptyString(assemblyName, <span style="color: #a31515">&#8220;assemblyName&#8221;</span>);
    <span style="color: #2b91af">Assembly </span>assembly = <span style="color: #0000ff">null</span>;

    <span style="color: #0000ff">try
    </span>{
        <span style="color: #008000">// Use Assembly.Load instead of Assembly.LoadFrom
        </span><strong>assembly = <span style="color: #2b91af">Assembly</span>.Load(assemblyName);</strong>
    }
    <span style="color: #0000ff">catch </span>(<span style="color: #2b91af">Exception </span>ex)
    {
        <span style="color: #0000ff">throw new </span><span style="color: #2b91af">ModuleLoadException</span>(assemblyName, ex.Message, ex);
    }

    <span style="color: #0000ff">if </span>(traceSource != <span style="color: #0000ff">null</span>)
        traceSource.TraceInformation(Properties.<span style="color: #2b91af">Resources</span>.LogModuleAssemblyLoaded, assemblyName);

    <span style="color: #0000ff">return </span>assembly;
}</pre>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></li>
<li>Replace the implementation of the <strong>GuardLegalAssemblyFile(IModuleInfo modInfo)</strong> method for the following one:
<pre><span style="color: #0000ff">private void </span>GuardLegalAssemblyFile(<span style="color: #2b91af">IModuleInfo </span>modInfo)
{
    <span style="color: #2b91af">Guard</span>.ArgumentNotNull(modInfo, <span style="color: #a31515">&#8220;modInfo&#8221;</span>);
    <span style="color: #2b91af">Guard</span>.ArgumentNotNull(modInfo.AssemblyFile, <span style="color: #a31515">&#8220;modInfo.AssemblyFile&#8221;</span>);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></li>
<li>Open your <strong>ProfileCatalog.xml</strong> file.</li>
<li>Change the value of the <strong>AssemblyFile</strong> attribute of each of your <strong>ModuleInfo</strong> tags to the assembly’s <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.fullname.aspx">Full Name</a>:
<pre><span style="color: #0000ff">&lt;</span><span style="color: #a31515">ModuleInfo </span><strong><span style="color: #ff0000">AssemblyFile</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Module1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</span>&#8220;</strong> <span style="color: #0000ff">/&gt;
&lt;</span><span style="color: #a31515">ModuleInfo </span><strong><span style="color: #ff0000">AssemblyFile</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Module2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</span>&#8220;</strong> <span style="color: #0000ff">/&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></li>
</ol>
<h3>Running Ngen on CAB based applications</h3>
<p>When you run Ngen.exe on an assembly, it also generates native images for the all its dependencies (dependencies are determined from references in the assembly manifest). The only scenario in which you need to <em>install</em> a dependency separately is when the application loads it using reflection, for example by calling the <strong>Assembly.Load</strong> method.</p>
<p>This is the case for CAB / SCSF applications, so you must run Ngen for the your application executable (<strong>exe</strong> file) and all its modules. To do this follow these steps:</p>
<ol>
<li>Open a <strong>Visual Studio Command Prompt</strong>.<br />
<table border="1" cellspacing="0" cellpadding="1" width="500">
<tbody>
<tr>
<td width="500" valign="top"><strong>Note</strong>: If you are running on Vista with the <strong>User Account Control</strong> (UAC) activated, you must open it with the option <strong>Run as administrator</strong>.</td>
</tr>
</tbody>
</table>
</li>
<li>Navigate to the directory where all your applications binaries are located and run the following command:
<pre>ngen install YourApplication.exe</pre>
<p><a href="http://11011.net/software/vspaste"></a></li>
<li>Run the same command for all of your business and foundational modules.
<pre>ngen install ModuleN.dll</pre>
</li>
</ol>
<h3>Results</h3>
<p>After applying the workaround on the <a href="http://msdn.microsoft.com/en-us/library/cc540808.aspx">BankTeller Quickstart</a> and running Ngen to its binaries, the <strong>JIT compilation</strong> time was eliminated. To profile the application I used the <a href="http://www.red-gate.com/products/ants_profiler">ANTS Profiler</a>.</p>
<ul>
<li>Before generation the native images, the application presented some peaks in the JIT compilation time.<br />
<a href="http://blogs.southworks.net/mconverti/files/2009/01/withoutngen-thumb1.png"><img src="http://blogs.southworks.net/mconverti/files/2009/01/withoutngen.png" border="0" alt="Before generating the native images" width="640" height="53" /></a></li>
<li>After generating the native images, the JIT compilation time was eliminated.<br />
<a href="http://blogs.southworks.net/mconverti/files/2009/01/withngen-thumb1.png"><img src="http://blogs.southworks.net/mconverti/files/2009/01/withngen.png" border="0" alt="After generating the native images" width="640" height="53" /></a></li>
</ul>
<table border="1" cellspacing="0" cellpadding="1" width="500">
<tbody>
<tr>
<td width="500" valign="top"><strong>Note</strong>: In order to perform profiling to native images, you must <em>install</em> them using the <strong><em>/Profile</em></strong> scenario as follows:</p>
<pre><strong>ngen install YourApplication.exe /Profile</strong></pre>
</td>
</tr>
</tbody>
</table>
<p> </p>
<p>Feedback is appreciated!</p>
<p>Mariano</p>
<div id="65d44cfa-268a-4487-a89c-b5f4f54b893a" class="wlWriterSmartContent" style="padding-right: 0px;padding-left: 0px;padding-bottom: 0px;margin: 0px;padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/CAB">CAB</a>,<a rel="tag" href="http://technorati.com/tags/SCSF">SCSF</a>,<a rel="tag" href="http://technorati.com/tags/Ngen">Ngen</a></div>
<div class="wlWriterSmartContent" style="padding-right: 0px;padding-left: 0px;padding-bottom: 0px;margin: 0px;padding-top: 0px"><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblogs.southworks.net%2fmconverti%2f2009%2f01%2f06%2fhow-to-use-the-ngen-tool-to-improve-the-performance-in-cab-scsf-applications%2f"><img style="border: 0px" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fblogs.southworks.net%2fmconverti%2f2009%2f01%2f06%2fhow-to-use-the-ngen-tool-to-improve-the-performance-in-cab-scsf-applications%2" alt="kick it on DotNetKicks.com" /></a></div>
<img src="http://feeds.feedburner.com/~r/mconverti/~4/p3EAEUm0Gq8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/mconverti/2009/01/06/how-to-use-the-ngen-tool-to-improve-the-performance-in-cab-scsf-applications/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/mconverti/2009/01/06/how-to-use-the-ngen-tool-to-improve-the-performance-in-cab-scsf-applications/</feedburner:origLink></item>
		<item>
		<title>How To: Load modules on demand that have dependencies using Composite WPF (Prism)</title>
		<link>http://feeds.southworks.net/~r/mconverti/~3/DPW-FEU9j1o/</link>
		<comments>http://blogs.southworks.net/mconverti/2008/11/13/how-to-load-modules-on-demand-that-have-dependencies-using-composite-wpf-prism/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 14:50:26 +0000</pubDate>
		<dc:creator>mconverti</dc:creator>
		
		<category><![CDATA[Composite WPF]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/mconverti/?p=106</guid>
		<description><![CDATA[The Composite Application Guidance for WPF - June 2008 release brings out-of-the-box support to load modules on demand. The only thing that you need to do is set the StartupLoaded property of the module to false. This feature is provided by the following Module Enumerators classes:

The DirectoryLookupModuleEnumerator class that discovers modules in assemblies stored in a particular [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=6DD3D0C1-D5B4-453B-B827-98E162E1BD8D&amp;displaylang=en">Composite Application Guidance for WPF - June 2008</a> release brings out-of-the-box support to load modules on demand. The only thing that you need to do is set the <strong>StartupLoaded</strong> property of the module to <strong>false</strong>. This feature is provided by the following <strong>Module Enumerators</strong> classes:</p>
<ul>
<li>The <strong>DirectoryLookupModuleEnumerator</strong> class that discovers modules in assemblies stored in a particular folder. This approach requires you to configure modules using attributes in code like the following:
<pre>[<span style="color: #2b91af">Module</span>(ModuleName = <span style="color: #a31515">"ModuleB"</span>, <strong>StartupLoaded = <span style="color: #0000ff">false</span></strong>)]
<span style="color: #0000ff">public class </span><span style="color: #2b91af">ModuleB </span>: <span style="color: #2b91af">IModule
</span>{
    <span style="color: #008000">//&#8230;    </span>
}</pre>
<p>For more information see: <a href="http://msdn.microsoft.com/en-us/library/cc707909.aspx">Using the Directory Lookup Module Enumerator</a>.</li>
<li>The <strong>ConfigurationModuleEnumerator</strong> class that discovers modules by reading the configuration file of the application. This approach requires a configuration file. The following code shows the content of a sample <strong>App.config</strong> file:
<pre><span style="color: #0000ff">&lt;?</span><span style="color: #a31515">xml </span><span style="color: #ff0000">version</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">1.0</span>&#8221; <span style="color: #ff0000">encoding</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">utf-8</span>&#8221; <span style="color: #0000ff">?&gt;
&lt;</span><span style="color: #a31515">configuration</span><span style="color: #0000ff">&gt;
  &lt;</span><span style="color: #a31515">configSections</span><span style="color: #0000ff">&gt;
    &lt;</span><span style="color: #a31515">section </span><span style="color: #ff0000">name</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">modules</span>&#8221;
             <span style="color: #ff0000">type</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Microsoft.Practices.Composite.Modularity.ModulesConfigurationSection, Microsoft.Practices.Composite</span>&#8220;<span style="color: #0000ff">/&gt;
  &lt;/</span><span style="color: #a31515">configSections</span><span style="color: #0000ff">&gt;
  &lt;</span><span style="color: #a31515">modules</span><span style="color: #0000ff">&gt;
</span><span style="color: #0000ff">    &lt;</span><span style="color: #a31515">module </span><span style="color: #ff0000">assemblyFile</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Modules/ModuleA.dll</span>&#8221; <span style="color: #ff0000">moduleType</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">ModuleA.ModuleA</span>&#8221; <span style="color: #ff0000">moduleName</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">ModuleA</span>&#8220;<span style="color: #0000ff">/&gt;
    &lt;</span><span style="color: #a31515">module </span><span style="color: #ff0000">assemblyFile</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Modules/<span style="color: #0000ff">ModuleB</span>.dll</span>&#8221; <span style="color: #ff0000">moduleType</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff"><span style="color: #0000ff">ModuleB</span>.<span style="color: #0000ff">ModuleB</span></span>&#8221; <span style="color: #ff0000">moduleName</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">ModuleB</span>&#8221;
            <strong><span style="color: #ff0000">startupLoaded</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">false</span>&#8220;</strong> /<span style="color: #0000ff">&gt;</span><span style="color: #0000ff">
  &lt;/</span><span style="color: #a31515">modules</span><span style="color: #0000ff">&gt;
&lt;/</span><span style="color: #a31515">configuration</span><span style="color: #0000ff">&gt;</span></pre>
<p>For more information see: <a href="http://msdn.microsoft.com/en-us/library/cc707897.aspx">Using the Configuration Module Enumerator</a>.</li>
</ul>
<h2>Specifying Modules Dependencies</h2>
<p>The mentioned <strong>Module Enumerators</strong> allow you to specify dependencies on the modules. In this way the <strong>Module Loader</strong> initializes first all its dependent modules before loading it.</p>
<ul>
<li>With the <strong>DirectoryLookupModuleEnumerator</strong> class the dependencies are specified with the <strong>ModuleDependecy</strong> attribute.
<pre>[<span style="color: #2b91af">Module</span>(ModuleName = <span style="color: #a31515">"ModuleB"</span>, StartupLoaded = <span style="color: #0000ff">false</span>)]
<strong>[<span style="color: #2b91af">ModuleDependency</span>(<span style="color: #a31515">"ModuleA"</span>)]</strong>
<span style="color: #0000ff">public class </span><span style="color: #2b91af">ModuleB </span>: <span style="color: #2b91af">IModule
</span>{
    <span style="color: #008000">//&#8230;    </span>
}</pre>
</li>
<li>With the <strong>ConfigurationModuleEnumerator</strong> class the dependencies are specified with the <strong>depedencies</strong> node in the configuration file:
<pre><span style="color: #0000ff">&lt;?</span><span style="color: #a31515">xml </span><span style="color: #ff0000">version</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">1.0</span>&#8221; <span style="color: #ff0000">encoding</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">utf-8</span>&#8221; <span style="color: #0000ff">?&gt;
&lt;</span><span style="color: #a31515">configuration</span><span style="color: #0000ff">&gt;
  &lt;</span><span style="color: #a31515">configSections</span><span style="color: #0000ff">&gt;
    &lt;</span><span style="color: #a31515">section </span><span style="color: #ff0000">name</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">modules</span>&#8221;
             <span style="color: #ff0000">type</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Microsoft.Practices.Composite.Modularity.ModulesConfigurationSection, Microsoft.Practices.Composite</span>&#8220;<span style="color: #0000ff">/&gt;
  &lt;/</span><span style="color: #a31515">configSections</span><span style="color: #0000ff">&gt;
  &lt;</span><span style="color: #a31515">modules</span><span style="color: #0000ff">&gt;
</span><span style="color: #0000ff">    &lt;</span><span style="color: #a31515">module </span><span style="color: #ff0000">assemblyFile</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Modules/ModuleA.dll</span>&#8221; <span style="color: #ff0000">moduleType</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">ModuleA.ModuleA</span>&#8221; <span style="color: #ff0000">moduleName</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">ModuleA</span>&#8220;<span style="color: #0000ff">/&gt;
    &lt;</span><span style="color: #a31515">module </span><span style="color: #ff0000">assemblyFile</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">Modules/<span style="color: #0000ff">ModuleB</span>.dll</span>&#8221; <span style="color: #ff0000">moduleType</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff"><span style="color: #0000ff">ModuleB</span>.<span style="color: #0000ff">ModuleB</span></span>&#8221; <span style="color: #ff0000">moduleName</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">ModuleB</span>&#8221; <span style="color: #ff0000">startupLoaded</span><span style="color: #0000ff">=</span>&#8220;<span style="color: #0000ff">false</span>&#8221; /<span style="color: #0000ff">&gt;
<strong>      &lt;<span style="color: #a31515">dependencies</span></strong><span style="color: #0000ff"><strong>&gt;
        &lt;<span style="color: #a31515">dependency <span style="color: #ff0000">moduleName</span><span style="color: #0000ff">=</span><span style="color: #000000">&#8220;</span><span style="color: #0000ff">ModuleA</span><span style="color: #000000">&#8220;</span><span style="color: #0000ff">/&gt;</span></span>
      &lt;/<span style="color: #a31515">dependencies</span></strong><span style="color: #0000ff"><strong>&gt;</strong>
    &lt;/<span style="color: #a31515">modules</span><span style="color: #0000ff">&gt;</span></span></span></span><span style="color: #0000ff">
  &lt;/</span><span style="color: #a31515">modules</span><span style="color: #0000ff">&gt;
&lt;/</span><span style="color: #a31515">configuration</span><span style="color: #0000ff">&gt;</span></pre>
</li>
</ul>
<p>The current release of the Composite Application Library do not bring support for loading modules on demand with dependencies. If you try to do this, you will get a <strong>ModuleLoadException</strong> exception with the message: <strong>A module declared a dependency on another module which is not declared to be loaded. Missing module(s)</strong>.</p>
<p><img src="http://blogs.southworks.net/mconverti/files/2008/11/moduleloadexception1.png" alt="Module Load Exception" width="448" height="252" /></p>
<h2>Cause of the ModuleLoadException</h2>
<p>To load a module the Composite Application Library provides the a <strong>Module Loader</strong> class. This class contains the <strong>Initialize</strong> method that receives the list of the modules that you want to load as a parameter.</p>
<pre><span style="color: #0000ff">public </span>LoadModuleB(<span style="color: #2b91af">IModuleLoader </span>moduleLoader, <span style="color: #2b91af">IModuleEnumerator </span>moduleEnumerator)
{
    <span style="color: #2b91af">ModuleInfo</span>[] modules = <span style="color: #0000ff">new </span><span style="color: #2b91af">ModuleInfo</span>[] { moduleEnumerator.GetModule(<span style="color: #a31515">&#8220;ModuleB&#8221;</span>) };

    <strong>moduleLoader.Initialize(modules);</strong>
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The <strong>Module Loader</strong> assumes that the list of modules passed to its <strong>Initialize</strong> method also includes the dependencies. That is why it throws the exception: <strong>A module declared a dependency on another module which is not declared to be loaded</strong> when you want to load a single module on demand with dependencies (the module&#8217;s dependencies are not present in the list).</p>
<h2>Workaround</h2>
<p>A workaround to solve this issue could be creating an extension method to the <strong>Module Enumerator</strong> class that returns the module and its dependencies. The following is a possible implementation:</p>
<pre><span style="color: #0000ff">using </span>System.Linq;
<span style="color: #0000ff">using </span>System.Collections.Generic;

<span style="color: #008000">// The namespace is important to make the extension method work.
</span><span style="color: #0000ff">namespace </span>Microsoft.Practices.Composite.Modularity
{
    <span style="color: #0000ff">public static class </span><span style="color: #2b91af">ModuleEnumeratorExtensions
    </span>{
        <span style="color: #0000ff">public static </span><span style="color: #2b91af">ModuleInfo</span>[] GetModuleWithDependencies(<span style="color: #0000ff">this </span><span style="color: #2b91af">IModuleEnumerator </span>moduleEnumerator, <span style="color: #0000ff">string </span>moduleName)
        {
            <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">ModuleInfo</span>&gt; moduleInfoList = <span style="color: #0000ff">new </span><span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">ModuleInfo</span>&gt;();
            <span style="color: #2b91af">ModuleInfo </span>module = moduleEnumerator.GetModule(moduleName);
            moduleInfoList.Add(module);
            <span style="color: #0000ff">if </span>(module.DependsOn != <span style="color: #0000ff">null</span>)
            {
                <span style="color: #0000ff">foreach </span>(<span style="color: #0000ff">string </span>dependencyName <span style="color: #0000ff">in </span>module.DependsOn)
                {
                    <span style="color: #0000ff">if </span>(!moduleInfoList.Exists(existingModule =&gt; existingModule.ModuleName == dependencyName))
                    {
                        moduleInfoList.AddRange(GetModuleWithDependencies(moduleEnumerator, dependencyName));
                    }
                }
            }
            <span style="color: #0000ff">return </span>moduleInfoList.ToArray();
        }
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Then, when you need to initialize a module on demand you can use the previous extension method in the following way:</p>
<pre><span style="color: #0000ff">public </span>DefaultViewB(<span style="color: #2b91af">IModuleLoader </span>moduleLoader, <span style="color: #2b91af">IModuleEnumerator </span>moduleEnumerator)
{
    moduleLoader.Initialize( <strong>moduleEnumerator.GetModuleWithDependencies(<span style="color: #a31515">&#8220;ModuleB&#8221;</span>)</strong> );
}</pre>
<p> </p>
<p>Enjoy</p>
<div id="f78a1f74-d2c8-4875-9746-d0c904d405ab" class="wlWriterSmartContent" style="padding-right: 0px;padding-left: 0px;padding-bottom: 0px;margin: 0px;padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/CompositeWPF">CompositeWPF</a>,<a rel="tag" href="http://technorati.com/tags/Composite%20Application%20Guidance%20for%20WPF">Composite Application Guidance for WPF</a>,<a rel="tag" href="http://technorati.com/tags/Composite%20WPF">Composite WPF</a></div>
<img src="http://feeds.feedburner.com/~r/mconverti/~4/DPW-FEU9j1o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/mconverti/2008/11/13/how-to-load-modules-on-demand-that-have-dependencies-using-composite-wpf-prism/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/mconverti/2008/11/13/how-to-load-modules-on-demand-that-have-dependencies-using-composite-wpf-prism/</feedburner:origLink></item>
		<item>
		<title>Smart Client Software Factory (SCSF) GP source code with Installer that works on Visual Studio 2008 + SP1</title>
		<link>http://feeds.southworks.net/~r/mconverti/~3/TyuiGhOEgBo/</link>
		<comments>http://blogs.southworks.net/mconverti/2008/09/29/smart-client-software-factory-scsf-gp-source-code-with-installer-that-works-on-visual-studio-2008-sp1/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 19:15:14 +0000</pubDate>
		<dc:creator>mconverti</dc:creator>
		
		<category><![CDATA[CAB]]></category>

		<category><![CDATA[SCSF]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/mconverti/?p=99</guid>
		<description><![CDATA[A couple of months ago I announced in my blog that the P&#38;P Sustained Engineering team had published an article in the SCSF Knowledge Base that describes the Known Issues and Fixes for the SCSF - April 2008 release running with Microsoft Visual Studio 2008 Service Pack 1.
The fixes for these issues included modifying the [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of months ago I <a href="http://blogs.southworks.net/mconverti/2008/07/02/scsf-april-2008-with-vs2008-sp1-known-issues/">announced</a> in my blog that the P&amp;P Sustained Engineering team had published an article in the <a href="http://www.codeplex.com/smartclient/Wiki/View.aspx?title=SCSF%20Knowledge%20Base">SCSF Knowledge Base</a> that describes the <a href="http://www.codeplex.com/smartclient/Wiki/View.aspx?title=Known%20Issues%3a%20SC-SF%20April%202008%20with%20Visual%20Studio%202008%20and%20SP1%20Beta" target="_blank">Known Issues and Fixes</a> for the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=3BE112CC-B2C1-4215-9330-9C8CF9BCC6FA&amp;displaylang=en">SCSF - April 2008</a> release running with <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&amp;displaylang=en">Microsoft Visual Studio 2008 Service Pack 1</a>.</p>
<p>The fixes for these issues included modifying the guidance package source code and register a custom one. So I decided to post the source code with the fixes including a setup project in order to create an installer for it.</p>
<p><strong>Download it from <a href="http://cid-9c64c688b3024d64.skydrive.live.com/self.aspx/Smart%20Client%20Software%20Factory/SmartClientFactoryPackage.zip">here</a>.<br />
</strong></p>
<table border="1" cellspacing="0" cellpadding="2" width="500">
<tbody>
<tr>
<td width="600" valign="top"><strong>Disclaimer</strong>: This is not an official Microsoft release. Use it at your own risk.</td>
</tr>
</tbody>
</table>
<h2>Registering the Guidance Package using the installer</h2>
<p>To register the guidance package using the custom installer performs the following steps:</p>
<ol>
<li>Open and build the <strong>GuidancePackage.sln</strong> solution to generate the installer.</li>
<li>Navigate to the <strong>SmartClientFactorySetup\Debug</strong> folder.</li>
<li>Close all instances of <strong>Visual Studio</strong>.</li>
<li>Run the <strong>SmartClientFactoryPackageSetup.msi</strong> installer.<br />
<table border="1" cellspacing="0" cellpadding="2" width="600">
<tbody>
<tr>
<td width="598" valign="top"><strong>Note</strong>: If you are running on Vista with the <strong>User Account Control</strong> (UAC) activated, you must run the installer with the option <strong>Run as administrator</strong>.</td>
</tr>
</tbody>
</table>
</li>
</ol>
<h2>Manually registering the Guidance Package</h2>
<p>To manually register the guidance package perform the following steps:</p>
<ol>
<li>Open the <strong>GuidancePackage.sln</strong> solution.<br />
<table border="1" cellspacing="0" cellpadding="2" width="600">
<tbody>
<tr>
<td width="598" valign="top"><strong>Note</strong>: If you are running on Vista with the <strong>User Account Control</strong> (UAC) activated, you must open Visual Studio with the option <strong>Run as administrator</strong>.</td>
</tr>
</tbody>
</table>
</li>
<li>On the <strong>Tools</strong> menu of Visual Studio, click <strong>Guidance Package Manager</strong>.</li>
<li>In the <strong>Guidance Package Manager</strong> dialog box, click <strong>Enable / Disable Packages</strong>.</li>
<li>In the <strong>Enable and Disable Packages</strong> dialog box, select the <strong>Guidance Package Development</strong> check box.</li>
<li>Click <strong>OK</strong>.<br />
<table border="1" cellspacing="0" cellpadding="2" width="600">
<tbody>
<tr>
<td width="598" valign="top">Enabling the <strong>Guidance Package Development</strong> allows you to register a guidance package.</td>
</tr>
</tbody>
</table>
</li>
<li>Close all other instances of <strong>Visual Studio</strong>.</li>
<li>Right-click the <strong>SmartClientFactoryPackage</strong> project, and then click <strong>Register Guidance Package</strong>.</li>
</ol>
<p>For more information you can check the following article:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/cc558915.aspx">Modifying the Guidance Package</a></li>
</ul>
<h2>Using the Fixed Guidance Package</h2>
<p>Once you have installed/registered the guidance package, you will be able to use the <strong>Smart Client Development for SP1</strong> package (see the image below).</p>
<p><img src="http://blogs.southworks.net/mconverti/files/2008/09/smartclientdevelopmentforsp1-thumb.png" border="0" alt="SmartClientDevelopmentForSP1" width="604" height="435" /></p>
<p>Enjoy.</p>
<div id="b8ffbdec-6ec8-4a8f-87cc-0576c3b24afb" class="wlWriterSmartContent" style="padding-right: 0px;padding-left: 0px;padding-bottom: 0px;margin: 0px;padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/SCSF">SCSF</a>,<a rel="tag" href="http://technorati.com/tags/Smart%20Client%20Software%20Factory">Smart Client Software Factory</a>,<a rel="tag" href="http://technorati.com/tags/CAB">CAB</a>,<a rel="tag" href="http://technorati.com/tags/Composite%20UI%20Application%20Block">Composite UI Application Block</a></div>
<img src="http://feeds.feedburner.com/~r/mconverti/~4/TyuiGhOEgBo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/mconverti/2008/09/29/smart-client-software-factory-scsf-gp-source-code-with-installer-that-works-on-visual-studio-2008-sp1/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/mconverti/2008/09/29/smart-client-software-factory-scsf-gp-source-code-with-installer-that-works-on-visual-studio-2008-sp1/</feedburner:origLink></item>
		<item>
		<title>Enabling CWAB and Unity in SharePoint applications sets of guidance published</title>
		<link>http://feeds.southworks.net/~r/mconverti/~3/Z-VMYI61N2M/</link>
		<comments>http://blogs.southworks.net/mconverti/2008/09/10/enabling-cwab-and-unity-in-sharepoint-applications-sets-of-guidance-published/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 16:32:30 +0000</pubDate>
		<dc:creator>mconverti</dc:creator>
		
		<category><![CDATA[CWAB]]></category>

		<category><![CDATA[SharePoint]]></category>

		<category><![CDATA[Unity]]></category>

		<category><![CDATA[WCSF]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/mconverti/?p=96</guid>
		<description><![CDATA[The Patterns &#38; Practices Sustained Engineering has just published two sets of guidance for SharePoint to make Web Parts more testable. The approach is enabling a dependency injection container in SharePoint applications. You can download these new releases from here:

Guidance To Enable CWAB in a SharePoint Application
Guidance To Enable Unity in a SharePoint Application

Each of the releases [...]]]></description>
			<content:encoded><![CDATA[<p>The Patterns &amp; Practices Sustained Engineering has just published two sets of guidance for <strong>SharePoint</strong> to make <strong>Web Parts</strong> more testable. The approach is enabling a dependency injection container in SharePoint applications. You can download these new releases from here:</p>
<ul>
<li><a href="http://www.codeplex.com/websf/Release/ProjectReleases.aspx?ReleaseId=17137">Guidance To Enable CWAB in a SharePoint Application</a></li>
<li><a href="http://www.codeplex.com/websf/Release/ProjectReleases.aspx?ReleaseId=17134">Guidance To Enable Unity in a SharePoint Application</a></li>
</ul>
<p>Each of the releases include the following elements:</p>
<ul>
<li>A PDF document with guidance to enable CWAB/Unity in a SharePoint application to make Web Parts more testable.</li>
<li>Extensions for CWAB/Unity to work on a SharePoint application
<ul>
<li><strong>CompositeWeb.SharePoint</strong> solution: it includes a class that implements the <strong>IWebClientApplication</strong> interface and inherits from <strong>SPHttpApplication</strong> class.</li>
<li><strong>Unity.SharePoint</strong> solution: it includes a class that inherits from <strong>SPHttpApplication</strong> and hosts a Unity container.</li>
</ul>
</li>
<li>A sample implementation that uses the extensions for CWAB/Unity. This solution includes a Web Part that is injected with dependencies (also has a Unit Test project).</li>
<li>Sample files like the <strong>global.asax</strong> and <strong>web.config</strong> for a SharePoint application enabled with CWAB/Unity.</li>
</ul>
<p><a href="http://blogs.southworks.net/mconverti/files/2008/09/sharepoint-releases.png"><img src="http://blogs.southworks.net/mconverti/files/2008/09/sharepoint-releases-thumb.png" border="0" alt="SharePoint Releases" width="609" height="335" /></a></p>
<p>We also published the documentation guidance in the <a href="http://www.codeplex.com/websf/Wiki/View.aspx?title=Knowledge%20Base">WCSF KB</a> as wiki pages. You can find them here:</p>
<ul>
<li><a href="http://www.codeplex.com/websf/Wiki/View.aspx?title=How%20To:%20Enable%20CWAB%20in%20a%20SharePoint%20Application">How To: Enable CWAB in a SharePoint Application</a></li>
<li><a href="http://www.codeplex.com/websf/Wiki/View.aspx?title=How%20To:%20Enable%20Unity%20in%20a%20SharePoint%20Application%20to%20make%20Web%20Parts%20more%20testable">How To: Enable Unity in a SharePoint Application</a></li>
</ul>
<p>Enjoy</p>
<div id="d627bf8c-286b-4adf-b929-d1cc8c3fabd7" class="wlWriterSmartContent" style="padding-right: 0px;padding-left: 0px;float: none;padding-bottom: 0px;margin: 0px;padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/CWAB">CWAB</a>,<a rel="tag" href="http://technorati.com/tags/WCSF">WCSF</a>,<a rel="tag" href="http://technorati.com/tags/Web%20Client%20Software%20Factory">Web Client Software Factory</a>,<a rel="tag" href="http://technorati.com/tags/SharePoint">SharePoint</a>,<a rel="tag" href="http://technorati.com/tags/Unity">Unity</a></div>
<img src="http://feeds.feedburner.com/~r/mconverti/~4/Z-VMYI61N2M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/mconverti/2008/09/10/enabling-cwab-and-unity-in-sharepoint-applications-sets-of-guidance-published/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/mconverti/2008/09/10/enabling-cwab-and-unity-in-sharepoint-applications-sets-of-guidance-published/</feedburner:origLink></item>
		<item>
		<title>Workaround for DeckWorkspace issue: The smartpart is not present in the workspace</title>
		<link>http://feeds.southworks.net/~r/mconverti/~3/8tI1h012qN0/</link>
		<comments>http://blogs.southworks.net/mconverti/2008/09/09/workaround-for-deckworkspace-issue-the-smartpart-is-not-present-in-the-workspace/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 19:00:05 +0000</pubDate>
		<dc:creator>mconverti</dc:creator>
		
		<category><![CDATA[CAB]]></category>

		<category><![CDATA[SCSF]]></category>

		<guid isPermaLink="false">http://blogs.southworks.net/mconverti/?p=95</guid>
		<description><![CDATA[There are several questions in the SCSF forums asking about this excepction: The smartpart is not present in the workspace, when using the DeckWorkspace.
Symptom
When you show several views in the same DeckWorkspace and then close the application or terminate the parent WorkItem, you get the following exception:

Cause
Every time a Smartpart is closed in a DeckWorkspace [...]]]></description>
			<content:encoded><![CDATA[<p>There are several questions in the <a href="http://www.codeplex.com/smartclient/Thread/List.aspx">SCSF forums</a> asking about this excepction: <strong>The smartpart is not present in the workspace</strong>, when using the <strong>DeckWorkspace</strong>.</p>
<h3>Symptom</h3>
<p>When you show several views in the same <strong>DeckWorkspace</strong> and then close the application or terminate the parent <strong>WorkItem</strong>, you get the following exception:</p>
<p><img src="http://blogs.southworks.net/mconverti/files/2008/09/exception-thumb.png" border="0" alt="Exception" width="504" height="267" /></p>
<h3>Cause</h3>
<p>Every time a <strong>Smartpart</strong> is closed in a <strong>DeckWorkspace</strong> it is removed from its <strong>Controls</strong> collection. Then the <strong>ActivateTopmost</strong> method is called to show the previously shown <strong>Smartpart</strong>. That method takes the first element in the <strong>Controls</strong> collection of the <strong>DeckWorkspace</strong> and activates it (<strong>this.Controls[0]</strong>).</p>
<p>When the <strong>Shell</strong> is being closed (by closing the application), the <strong>DeckWorkspace</strong> is disposed and starts to dispose all of its child elements. Therefore, because the <strong>DeckWorkspace</strong> is being disposed, the <strong>Controls</strong> collection cannot be modified.</p>
<p>Consequently, when the <strong>Smarparts</strong> in the <strong>DeckWorkspace</strong> begin to get closed, they cannot be removed from the <strong>Controls</strong> collection (because it is being disposed). The <strong>ActivateTopmost</strong> method then receives a <strong>Smartpart</strong> that is no longer present in the DeckWorkspace and tries to activate it. This causes the &#8220;<strong>The SmartPart is not present in workspace&#8221;</strong> exception.</p>
<h3>Workaround</h3>
<p>Modify the <strong>Deckworkspace</strong> source code (you will need to have the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=5C42C35D-DA1C-40B9-892E-11AB13AAFD9E&amp;displaylang=en">SCSF source code</a> installed) to avoid activating the previous <strong>Smartpart </strong>when the workspace is being disposed.</p>
<p>You can perform the following steps to get this done:</p>
<ol>
<li>Open the <strong>CompositeUI-CS.sln</strong> solution.</li>
<li>Right-click in the <strong>DeckWorkspace.cs</strong> file located in the <strong>Workspaces</strong> folder in the <strong>CompositeUI.WinForms</strong> project and select the <strong>View Code</strong> option.</li>
<li>Replace the <strong>OnClose</strong> method for the following one:
<pre><span style="color: #0000ff">protected virtual void </span>OnClose(<span style="color: #2b91af">Control </span>smartPart)
{
    <span style="color: #0000ff">this</span>.Controls.Remove(smartPart);

    smartPart.Disposed -= ControlDisposed;

<strong>    <span style="color: #0000ff">if </span>(!Disposing)
    {
        ActivateTopmost();
    }</strong>
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></li>
<li>Build the solution.</li>
<li>Copy the recompiled CAB assemblies to the <strong>Lib</strong> folder of your SCSF solution.</li>
</ol>
<div id="761f4d47-a742-4ff7-bf41-73b8835b42cf" class="wlWriterSmartContent" style="padding-right: 0px;padding-left: 0px;padding-bottom: 0px;margin: 0px;padding-top: 0px">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/CAB">CAB</a>,<a rel="tag" href="http://technorati.com/tags/SCSF">SCSF</a></div>
<img src="http://feeds.feedburner.com/~r/mconverti/~4/8tI1h012qN0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blogs.southworks.net/mconverti/2008/09/09/workaround-for-deckworkspace-issue-the-smartpart-is-not-present-in-the-workspace/feed/</wfw:commentRss>
		<feedburner:origLink>http://blogs.southworks.net/mconverti/2008/09/09/workaround-for-deckworkspace-issue-the-smartpart-is-not-present-in-the-workspace/</feedburner:origLink></item>
	</channel>
</rss>
