<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>C# .NET</title>
        <link>http://geekswithblogs.net/TimH/category/2068.aspx</link>
        <description>C# .NET</description>
        <language>en-NZ</language>
        <copyright>Tim Huffam</copyright>
        <managingEditor>timhuffam@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Winform Progress Bar Marquee Style Not Working</title>
            <link>http://geekswithblogs.net/TimH/archive/2009/07/21/winform-progress-bar-marquee-style-not-working.aspx</link>
            <description>&lt;p&gt;When trying to run a .Net winforms app with a progressbar on it, I found that if it was run from a non-standard class, the marquee style did not work.&lt;/p&gt;
&lt;p&gt;The reason was because we were running the app from our own loader class, instead of the usual winforms program.cs.  This was because we were instatiating it from VB using COM interop - I thought this was the cause of the issue - but it turns out that this is not the case...  &lt;/p&gt;
&lt;p&gt;The problem was that our own loader class did not enable the windows XP visual styles (apparently the Marquee style is only supported on platforms later than and including Windows XP - &lt;em&gt;with visual styles enabled&lt;/em&gt;).&lt;/p&gt;
&lt;p&gt;So the solution (to make the Marquee style work) is to include the following line of code before instantiating your form:&lt;/p&gt;
&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;Application&lt;font color="#000000"&gt;.EnableVisualStyles();&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#000000"&gt;HTH&lt;br /&gt;
Tim&lt;/font&gt;&lt;/p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133634"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133634" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/133634.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2009/07/21/winform-progress-bar-marquee-style-not-working.aspx</guid>
            <pubDate>Wed, 22 Jul 2009 02:19:52 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/133634.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2009/07/21/winform-progress-bar-marquee-style-not-working.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/133634.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/133634.aspx</trackback:ping>
        </item>
        <item>
            <title>Async web service/WCF calls updating the UI on the UI thread (using WinForms)</title>
            <link>http://geekswithblogs.net/TimH/archive/2009/07/07/async-web-servicewcf-calls-updating-the-ui-on-the-ui-again.aspx</link>
            <description>&lt;p&gt;To update the UI with values returned from an asynchronous WCF/web service call you need to make sure the coding updating the UI is running on the UI thread.  Depending on how you've performed the async remote service call, often this is done on another thread - so when the handler executes upon completion of the call it is not on the UI thread and causes a threading exception.&lt;/p&gt;
&lt;p&gt;Within winforms, the solution is to use the Invoke() method eg the following method would be on your form or user control and could be safely called from the async service call handler:&lt;/p&gt;
&lt;font size="2"&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; UpdateCustomerName()&lt;br /&gt;
{&lt;br /&gt;
  &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.InvokeRequired)&lt;br /&gt;
  {&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Invoke(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;EventHandler&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;delegate&lt;br /&gt;
      &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;{textBox1.Text = presenter.Customer.Name;}));&lt;br /&gt;
  }&lt;br /&gt;
  &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;else&lt;br /&gt;
  &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;{&lt;br /&gt;
    textBox1.Text = presenter.Customer.Name;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;If you're using something like the MVP pattern (in winforms) then you could make your presenter base class provide some generic handling for it with these 2 members:&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;protected&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;delegate&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;UIDeligate&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;();&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;///&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;&amp;lt;summary&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;///&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt; Invokes the specified method in the UI thread. This is useful for executing view methods, that update the UI, from an asynchronous callback handler in the presenter.&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;///&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt; Eg: &lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;&amp;lt;code&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;OnUIThread(new Presenter&amp;amp;lt;ITestView&amp;amp;gt;.UIDeligate(View.BindCustomers));&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;///&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;&amp;lt;/summary&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;///&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt; &lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;///&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;&amp;lt;example&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;///&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt; The folling code executes the view method BindCustomrs() in the UI thread.&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;///&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt; OnUIThread(new Presenter&amp;amp;lt;ITestView&amp;amp;gt;.UIDeligate(View.BindCustomers));&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;///&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;&amp;lt;/example&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;///&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;&amp;lt;param name="method"&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;Method to invoke.&lt;/font&gt;&lt;/font&gt;&lt;font color="#808080" size="2"&gt;&lt;font color="#808080" size="2"&gt;&amp;lt;/param&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;protected&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; OnUIThread(&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;UIDeligate&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; method)&lt;br /&gt;
{&lt;br /&gt;
  &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (disposed) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;
  &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Control&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; control = View &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;as&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Control&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;
  &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ((control != &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;) &amp;amp;&amp;amp; (control.Created))&lt;br /&gt;
    control.Invoke(method);&lt;br /&gt;
  &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;else&lt;br /&gt;
    &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;method.DynamicInvoke();&lt;br /&gt;
}&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;These allow your presenter to handle the thread synchronization for you (as it would be the one handling the the callback processing).  In this case your UI method, in your form or usercontrol, would look like this:&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; UpdateCustomerName()&lt;br /&gt;
{&lt;br /&gt;
&lt;/font&gt;&lt;font size="2"&gt;    textBox1.Text = presenter.Customer.Name;&lt;br /&gt;
}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;and the presenter implementation class would call it like this:&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;public void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; customerService_CustomerUpdate(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;object&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; sender, &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;EventArgs&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Customer&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;gt; e)&lt;br /&gt;
{&lt;br /&gt;
  customer = e.Data;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;  // Previously we would have done:  &lt;br /&gt;
  &lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// View.UpdateCustomerName();&lt;br /&gt;
  // but now we do this:&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;  OnUIThread(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Presenter&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;ITestView&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;gt;.&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;UIDeligate&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(View.BindLivingExpenseRates));&lt;br /&gt;
}&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;So now the view does not need to care about any threading/async issues.&lt;/p&gt;
&lt;p&gt;You could also use the &amp;lt;methodname&amp;gt;Async method and &amp;lt;methodname&amp;gt;Completed event in the generated WCF client proxy - as from what I've seen the &amp;lt;methodname&amp;gt;Completed event magically executes on the UI thread (have no idea how/why).  See &lt;a href="http://blogs.msdn.com/rickrain/archive/2009/03/18/making-asynchronous-service-calls-from-a-winform-client.aspx"&gt;this article&lt;/a&gt; for a good example.&lt;/p&gt;
&lt;p&gt;HTH&lt;br /&gt;
Tim&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;/font&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133332"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=133332" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/133332.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2009/07/07/async-web-servicewcf-calls-updating-the-ui-on-the-ui-again.aspx</guid>
            <pubDate>Wed, 08 Jul 2009 02:56:40 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/133332.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2009/07/07/async-web-servicewcf-calls-updating-the-ui-on-the-ui-again.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/133332.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/133332.aspx</trackback:ping>
        </item>
        <item>
            <title>Turning on code coverage/instrumentation in a TFS Build</title>
            <link>http://geekswithblogs.net/TimH/archive/2009/06/16/turning-on-code-coverageinstrumentation-in-a-tfs-build.aspx</link>
            <description>&lt;p&gt;This requires a testrunconfig file that has been configured correctly.  To do this I did the following:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;In VS2008, right click on Solution Items folder and select Add - New Item... &lt;/li&gt;
    &lt;li&gt;Select Test Run Configuration and enter the name WithCodeCoverage.testrunconfig. &lt;/li&gt;
    &lt;li&gt;Open/edit this file in VS. &lt;/li&gt;
    &lt;li&gt;Select the 'Code Coverage' item on the left, then selected (checked) the assemblies I wanted to instrument &lt;/li&gt;
    &lt;li&gt;Click Apply to save these changes. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Note that you can select which is the active test run configuration from under the Test menu in VS2008. &lt;/p&gt;
&lt;p&gt;Now we need to update the TFS build...&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Open your TFS build file (eg TFSBuild.proj)&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;In the section starting with&lt;br /&gt;
    &lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;PropertyGroup&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
    &amp;lt;!--&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&lt;font face="Courier New"&gt; TEST ARGUMENTS&lt;/font&gt;...&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;
    Add the following line (after the comments and before the closing of PropertyGroup):&lt;br /&gt;
    &lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;RunConfigFile&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;Condition&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; '$(IsDesktopBuild)' != 'true' &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;$(SolutionRoot)\DEV\Release1\Source\WithCodeCoverage.testrunconfig&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;RunConfigFile&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;
    (update accordingly to suit your build server paths). &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That's it.  Queue a build to test - you may need to verify your server build paths to get it working (I did).&lt;/p&gt;
&lt;p&gt;HTH&lt;br /&gt;
Tim&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=132870"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=132870" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/132870.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2009/06/16/turning-on-code-coverageinstrumentation-in-a-tfs-build.aspx</guid>
            <pubDate>Wed, 17 Jun 2009 04:32:14 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/132870.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2009/06/16/turning-on-code-coverageinstrumentation-in-a-tfs-build.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/132870.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/132870.aspx</trackback:ping>
        </item>
        <item>
            <title>How to turn on unit testing in your TFS build</title>
            <link>http://geekswithblogs.net/TimH/archive/2009/06/16/how-to-turn-on-unit-testing-in-your-tfs-build.aspx</link>
            <description>&lt;p&gt;The following will make your builds (running on a TFS Server) execute your unit tests after the build:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Open your build file (eg TFSBuild.proj).  VS2008 has a nice xml editor for this.&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Search for the RunTest node and change it from:&lt;br /&gt;
    &lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;RunTest&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;false&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;RunTest&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;
    &lt;/font&gt;&lt;/font&gt;to:&lt;br /&gt;
    &lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;RunTest&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;true&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;RunTest&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Look for a section that starts with:&lt;br /&gt;
    &lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ItemGroup&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
    &amp;lt;!--&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&lt;font face="Courier New"&gt; TEST ARGUMENTS&lt;/font&gt; ...&lt;/font&gt;&lt;/font&gt;&lt;br /&gt;
    and add nodes within this (after the comments and before the closing of the ItemGroup node) - one entry for each unit test assembly you have eg:&lt;br /&gt;
    &lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;TestContainer&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;Include&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;$(OutDir)\My.App.UnitTests.dll&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Thats it - check in this file and queue a build.&lt;/p&gt;
&lt;p&gt;An error I got while getting this working indicated that the MSTest.exe could not be found - this was because TFS Client had not been installed on the build server - once these were installed it worked fine.&lt;/p&gt;
&lt;p&gt;Something else you may want to do is ensure that a build is triggered every time someone checks in.  To do this, edit your build definition (right click on your build within Team Explorer and choose "Edit Build Definition...") - click on the 'Trigger' item in the list on the left and make sure the "Build each check-in (more builds)" item is checked.&lt;/p&gt;
&lt;p&gt;HTH&lt;br /&gt;
Tim&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=132866"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=132866" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/132866.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2009/06/16/how-to-turn-on-unit-testing-in-your-tfs-build.aspx</guid>
            <pubDate>Wed, 17 Jun 2009 03:54:27 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/132866.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2009/06/16/how-to-turn-on-unit-testing-in-your-tfs-build.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/132866.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/132866.aspx</trackback:ping>
        </item>
        <item>
            <title>How to unit test against resources (localization) values within Visual Studio 2008</title>
            <link>http://geekswithblogs.net/TimH/archive/2009/05/22/how-to-unit-test-against-resources-localization-values-within-visual.aspx</link>
            <description>&lt;p&gt;When unit testing you sometimes need to test that values are being set to the correct literal/constant value - and this value is often stored in a resources file.&lt;/p&gt;
&lt;p&gt;However, for some reason the VS2008 'Create Private Accessor' feature did not work for me for resources (maybe be cause they're all static properties and the generated _Accessor classes need to be instantiated).  So to make these resource available within the unit test project I simply made the Resources class public (by default it's internal).&lt;/p&gt;
&lt;p&gt;To do this:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Open the resource file (eg Resources.resx) using the Visual Studio resource editor tool (just double click on the .resx file).&lt;/li&gt;
    &lt;li&gt;At the top of the editor tab there is a drop down box labelled "Access Modifier" - change this from Internal to Public and save the file.&lt;/li&gt;
    &lt;li&gt;Rebuild the project.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Your resources will now be accessible in your unit tests.&lt;/p&gt;
&lt;p&gt;HTH&lt;br /&gt;
Tim&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=132362"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=132362" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/132362.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2009/05/22/how-to-unit-test-against-resources-localization-values-within-visual.aspx</guid>
            <pubDate>Fri, 22 May 2009 21:07:55 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/132362.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2009/05/22/how-to-unit-test-against-resources-localization-values-within-visual.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/132362.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/132362.aspx</trackback:ping>
        </item>
        <item>
            <title>Script to remove unchanged files in TFS/VS2008</title>
            <link>http://geekswithblogs.net/TimH/archive/2009/01/22/script-to-remove-unchanged-files-in-tfsvs2008.aspx</link>
            <description>TFS has a wonderful feature whereby it marks files as changed, even though there are no changes.  These files show up in the Pending Changes window in Visual Studio (VS 2008). &lt;br /&gt;
&lt;br /&gt;
To work around this,  add the following external command to your VS tools:&lt;br /&gt;
&lt;ol&gt;
    &lt;li&gt;First you need to install &lt;a href="javascript:void(0);/*1232591142036*/"&gt;TFS Power Tools&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;In VS go into Tools - External Tools and click Add&lt;/li&gt;
    &lt;li&gt;Enter the following details:&lt;br /&gt;
    &lt;span style="font-weight: bold;"&gt;Title&lt;/span&gt;: Unchange&lt;br /&gt;
    &lt;span style="font-weight: bold;"&gt;Command&lt;/span&gt;: C:\Program Files\Microsoft Team Foundation Server 2008 Power Tools\tfpt.exe&lt;br /&gt;
    &lt;span style="font-weight: bold;"&gt;Arguments&lt;/span&gt;: uu /recursive /noget&lt;br /&gt;
    &lt;span style="font-weight: bold;"&gt;Initial Directory&lt;/span&gt;: $(SolutionDir)&lt;/li&gt;
    &lt;li&gt;And check 'Use Output Window'&lt;/li&gt;
    &lt;li&gt;Click Ok&lt;/li&gt;
&lt;/ol&gt;
That's it.  To test, view the Pending Changes window - usually after a 'Get Latest' is when it lists unmodified files as changed - then click Tools  - Unchange.&lt;br /&gt;
&lt;br /&gt;
Thanks to &lt;a href="javascript:void(0);/*1232591391656*/"&gt;Duncan Smith&lt;/a&gt; for this gem of info.&lt;br /&gt;
&lt;br /&gt;
The fact they created a tool for this makes you wonder!&lt;br /&gt;
&lt;br /&gt;
HTH&lt;br /&gt;
Tim&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128877"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128877" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/128877.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2009/01/22/script-to-remove-unchanged-files-in-tfsvs2008.aspx</guid>
            <pubDate>Thu, 22 Jan 2009 21:31:34 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/128877.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2009/01/22/script-to-remove-unchanged-files-in-tfsvs2008.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/128877.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/128877.aspx</trackback:ping>
        </item>
        <item>
            <title>How to move/drag objects in Silverlight (2.0)</title>
            <link>http://geekswithblogs.net/TimH/archive/2008/11/05/how-to-movedrag-objects-in-silverlight-2.0.aspx</link>
            <description>&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;font face="Arial"&gt;The following code shows you how you can make Silverlight controls/objects moveable by dragging them with the mouse.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;font face="Arial"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;font face="Arial"&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;font face="Arial" color="#000000" size="3"&gt;&lt;strong&gt;Page.cs:&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;UserControl&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; x&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;:&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt;Class&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="MovingObjs.Page"&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;   &lt;span style="COLOR: red"&gt; xmlns&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;   &lt;span style="COLOR: red"&gt; xmlns&lt;/span&gt;&lt;span style="COLOR: blue"&gt;:&lt;/span&gt;&lt;span style="COLOR: red"&gt;x&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;   &lt;span style="COLOR: red"&gt; Width&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="400"&lt;/span&gt;&lt;span style="COLOR: red"&gt; Height&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="300"&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;    &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;Canvas&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; x&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;:&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt;Name&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="LayoutRoot"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; Background&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="White"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;        &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;Border&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; CornerRadius&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="10"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; x&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;:&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt;Name&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="brdMovable"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; BorderBrush&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="Black"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; BorderThickness&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="2"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; Background&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="AntiqueWhite"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; Canvas.Top&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="100"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; Canvas.Left&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="10"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; MouseLeftButtonDown&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="brdMovable_MouseLeftButtonDown"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; MouseLeftButtonUp&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="brdMovable_MouseLeftButtonUp"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; MouseMove&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="brdMovable_MouseMove"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;            &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;Grid&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; x&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;:&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt;Name&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="grid1"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; Width&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="300"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; Margin&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="5" &amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;                &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;TextBlock&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; x&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;:&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt;Name&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="txtBlkTest"&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'"&gt; Text&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;="Test"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;TextBlock&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;            &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;Grid&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;        &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;Border&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;    &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;Canvas&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'"&gt;UserControl&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;&lt;font face="Arial" color="#000000" size="3"&gt;&lt;strong&gt;Page.xaml.cs:&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"&gt;namespace&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt; MovingObjs&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;    &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;partial&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Page&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;UserControl&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;    {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;bool&lt;/span&gt; moving = &lt;span style="COLOR: blue"&gt;false&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;double&lt;/span&gt; offSetX;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;double&lt;/span&gt; offSetY;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; Page()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;            InitializeComponent();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; brdMovable_MouseLeftButtonDown(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;MouseButtonEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;            moving = &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;            &lt;span style="COLOR: #2b91af"&gt;Point&lt;/span&gt; offset = e.GetPosition(brdMovable);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;            offSetX = offset.X;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;            offSetY = offset.Y;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; brdMovable_MouseLeftButtonUp(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;MouseButtonEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;            moving = &lt;span style="COLOR: blue"&gt;false&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        &lt;span style="COLOR: blue"&gt;private&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; brdMovable_MouseMove(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;MouseEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;            &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (moving)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;            {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;                &lt;span style="COLOR: #2b91af"&gt;Canvas&lt;/span&gt; parent = (&lt;span style="COLOR: #2b91af"&gt;Canvas&lt;/span&gt;)&lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.brdMovable.Parent;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;                &lt;span style="COLOR: #2b91af"&gt;Point&lt;/span&gt; p = e.GetPosition(parent);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;                &lt;span style="COLOR: blue"&gt;double&lt;/span&gt; x = p.X - offSetX;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;                &lt;span style="COLOR: blue"&gt;double&lt;/span&gt; y = p.Y - offSetY;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;                txtBlkTest.Text = &lt;span style="COLOR: #a31515"&gt;"X: "&lt;/span&gt; + x.ToString() + &lt;span style="COLOR: #a31515"&gt;", Y: "&lt;/span&gt; + y.ToString();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;                &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.brdMovable.SetValue(&lt;span style="COLOR: #2b91af"&gt;Canvas&lt;/span&gt;.LeftProperty, x);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;                &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.brdMovable.SetValue(&lt;span style="COLOR: #2b91af"&gt;Canvas&lt;/span&gt;.TopProperty, y);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;            }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;    }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=126621"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=126621" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/126621.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2008/11/05/how-to-movedrag-objects-in-silverlight-2.0.aspx</guid>
            <pubDate>Wed, 05 Nov 2008 18:24:43 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/126621.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2008/11/05/how-to-movedrag-objects-in-silverlight-2.0.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/126621.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/126621.aspx</trackback:ping>
        </item>
        <item>
            <title>How to remove TFS workspaces</title>
            <link>http://geekswithblogs.net/TimH/archive/2008/10/09/how-to-remove-tfs-workspaces.aspx</link>
            <description>&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="210411022-23082008"&gt;This will actually remove the your workspaces - unlike the VS/TFS Source Control Explorer which simply does not display them - duh!&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="210411022-23082008"&gt;&lt;/span&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;span class="210411022-23082008"&gt;From the VS command prompt: &lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span class="210411022-23082008"&gt;  &lt;/span&gt;&lt;font color="#0000ff"&gt;tf workspaces /remove:*&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font face="Arial" size="2"&gt;&lt;/font&gt; &lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125718"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125718" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/125718.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2008/10/09/how-to-remove-tfs-workspaces.aspx</guid>
            <pubDate>Thu, 09 Oct 2008 14:10:29 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/125718.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2008/10/09/how-to-remove-tfs-workspaces.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/125718.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/125718.aspx</trackback:ping>
        </item>
        <item>
            <title>ASP.NET SQL Server error: The connection was not closed. The connection's current state is open</title>
            <link>http://geekswithblogs.net/TimH/archive/2008/09/09/asp.net-sql-server-error-the-connection-was-not-closed.-the.aspx</link>
            <description>&lt;p&gt;The following error occured when 2 requests hit an ASP.NET (2.0) web app (using SQL Server 2005) at the same time:&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" color="#0000ff"&gt;The connection was not closed. The connection's current state is open&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Normally this only occurs if you have a connection that is not being closed.  However in our case all connections where being closed using a &lt;font face="Courier New" color="#0000ff"&gt;try&lt;/font&gt;-&lt;font face="Courier New" color="#0000ff"&gt;finally&lt;/font&gt; block (personally I prefer using a &lt;font face="Courier New" color="#0000ff"&gt;using&lt;/font&gt; block).&lt;/p&gt;
&lt;p&gt;This error only occured when the 2 request were initiated from different machines.&lt;/p&gt;
&lt;p&gt;It turns out that the error occured because the same username was being used  for all requests (we were not interested in the username  in the app - and simply validated the request through a token and set the username to the same static string for all requests).  As soon as we made the username unique (by appending a guid to it) the error ceased to occur.&lt;/p&gt;
&lt;p&gt;This indicates that ADO.NET uses the username as part of it's connection pooling management. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;*** UPDATE 17 Nov 08 ***&lt;br /&gt;
&lt;/strong&gt;After more testing we proved this theory incorrect.  We found that the root cause of the original exception (connection state is open) was because we used a static member in one of our ORM classes - this held on to the connection, and it never got closed (hence the exception) - once we converted this to a non-static variable the problem disappeared.  However, adding the GUID to the ASP.NET username did have the above mentioned affect in several scenarios - which still leads me to believe the username has some relation/use in the connection pooling management (not sure why - as it's the process's identity that things run as - not the user's).&lt;/p&gt;
&lt;p&gt;HTH&lt;/p&gt;
&lt;p&gt;Tim&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125020"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125020" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/125020.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2008/09/09/asp.net-sql-server-error-the-connection-was-not-closed.-the.aspx</guid>
            <pubDate>Tue, 09 Sep 2008 17:48:33 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/125020.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2008/09/09/asp.net-sql-server-error-the-connection-was-not-closed.-the.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/125020.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/125020.aspx</trackback:ping>
        </item>
        <item>
            <title>Task Oriented Programming</title>
            <link>http://geekswithblogs.net/TimH/archive/2008/09/09/task-oriented-programming.aspx</link>
            <description>&lt;p&gt;For some time I've been wondering if there's a better way to program business logic.  Years ago I used to write COBOL, then moved onto a 4GL, bla bla bla... and today I find myself well entrenched in OO with Microsoft's .Net.  Development times don't seem to be much better these days - and the complexity of things seems to have mushroomed.  &lt;/p&gt;
&lt;p&gt;We went from barely-a-3GL to 4GL back to 3GL plus an explosion of things you need to consider.  We started with procedural code then moved to OO and seem to have got stuck there.  But somehow I think we need to revise our use of OO.  Business logic is predominantly procedural code - even if written in OO; it starts, follows a process, performing stuff until finished eg Customer.UpdateCreditLimit()&lt;/p&gt;
&lt;p&gt;OO is really good for modelling things - as per the classic OO examples of a bicycle or car.  And thus they model business things quite well too - like an Invoice or a Customer.  &lt;/p&gt;
&lt;p&gt;However, I've found that the more object oriented the code gets - the less productive, maintainable and flexible it becomes.  Not saying leave OO - far from it - it's brilliant.  It's just that we need to learn when to say 'when'.   The use of patterns has helped a huge amount - but these can also caused similar problems - when being applied where they aren't really needed - resulting in overly complex software (read: inflexible and unmaintainable and unproductive).  It's a fine line - and it's not easy to get the balance.&lt;/p&gt;
&lt;p&gt;A major break through in this area is &lt;a href="http://msdn.microsoft.com/en-us/library/bb397926.aspx"&gt;LINQ&lt;/a&gt;.  This has meant we have less clutter in our apps catering for ORM (brilliant).  This has resulted in code very similar to the old 4GL days (essentially 4GLs were just SQL based code anyway) - where all you care/code about is the business logic - caring not a jot about how or where a Customer or Order got created - and in this age of SOA - that becomes more important (as a Customer could come from many different sources - local RDBMS, company ERP, external CRM etc).  I guess you could say LINQ allows you to focus your code to be more domain specific (not saying it's a DSL).&lt;/p&gt;
&lt;p&gt;I have been playing with workflows for donkeys of years and found that although the individual workflow systems themselves can range from very simple to incredibly complex - the individual tasks they perform need not be.   This had lead me to start thinking about applying this principle to code design at a reasonably low level....  what if we developed tasks as objects.  Each task has just one job (I've heard some people say this is how objects 'should' be coded anyway).  It has properties that can be get/set.  Keeping things dead simple, eg:&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff" size="2"&gt;class&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#2b91af" size="2"&gt;AdderTask&lt;br /&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;{&lt;/font&gt;&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; &lt;font color="#000000"&gt;Addend1 {&lt;/font&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;;&lt;/font&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;; }&lt;br /&gt;
&lt;/font&gt;    &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; &lt;font color="#000000"&gt;Addend2 {&lt;/font&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;;&lt;/font&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;; }&lt;/font&gt;&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; &lt;font color="#000000"&gt;Result {&lt;/font&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;;&lt;/font&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;; }&lt;/font&gt;&lt;br /&gt;
    &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font color="#000000"&gt;&lt;font size="2"&gt; AdderTask(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; addend1, &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000"&gt;&lt;font face="Courier New" size="2"&gt; addend2)&lt;br /&gt;
    {&lt;br /&gt;
        &lt;/font&gt;&lt;/font&gt;&lt;font color="#000000"&gt;&lt;font face="Courier New" size="2"&gt;Addend1 = addend1;&lt;br /&gt;
        &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;Addend2 = addend2;&lt;br /&gt;
    }&lt;br /&gt;
&lt;/font&gt;    &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;AdderTask&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; &lt;/font&gt;&lt;font face="Courier New" color="#000000"&gt;Execute()&lt;br /&gt;
    &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;{&lt;br /&gt;
        Result = Addend1 + Addend2;&lt;br /&gt;
&lt;/font&gt;        &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;font color="#000000"&gt;;&lt;br /&gt;
&lt;/font&gt;  &lt;font color="#000000"&gt;  &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#000000" size="2"&gt;}&lt;br /&gt;
}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;To run this you'd simply do this:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; &lt;font color="#000000"&gt;result =&lt;/font&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;AdderTask&lt;/font&gt;&lt;font color="#000000" size="2"&gt;(1, 2).Execute().Result;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#000000" size="2"&gt;Exposing the task's properties means you can build up get and set statements - and because the Execute method returns the task object itself you can easily use it in a single line as if it was a method on it's own - or retrieve it's property values after the Execute (these tasks would easily be adapted to work within a workflow system).&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#000000" size="2"&gt;This style lends itself to expanding; rather like building blocks, you can build large workflows out of these task oriented blocks.  The workflows themselves coded just like these tasks - whereby all the business logic resides within the Execute() method.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#000000" size="2"&gt;Adding LINQ to the mix takes this to the next level - allowing you to build software that is simple to develop and understand.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#000000" size="2"&gt;I've been building a sizable system using this technique and I'm finding that I'm converting code developed using standard OO practices over to this methodology as it makes code more easily reused - but most importantly: easier to read and maintain.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;In summary:&lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;font size="2"&gt;All input and output parameters should be implemented as properties (getter and setter accessors).&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font size="2"&gt;Provide a constructor that accepts all required parameters. A default constructor (with no parameters) is optional (I've found I never need these - but if you were to use these tasks in a workflow system they may need this).&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font size="2"&gt;Provide an Execute() method that takes no parameters and returns the object instance eg &lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font size="2"&gt;The object should clean up after itself.  &lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;font size="2"&gt;Other notes:&lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;font size="2"&gt;Originally I created a similar type of class for workflows - but I found that these ended up being no different in concept to tasks.  Likewise I've found that some tasks needed to call other tasks - so I've ended up just implementing everything as tasks.  On reflection this is actually quite valid - because, as I found when building large orchestrations using Biztalk, workflows become atomic tasks themselves when used within the context of a large orchestration (which may run many workflows and external tasks) - and the orchestration, from a highlevel could also be considered an atomic task.&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font size="2"&gt;I've found using System.Transactions.TransactionScope great for scoping transactions around many tasks when creating a macro task that runs many sub tasks.&lt;/font&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Suggestions/comments very welcome - I'd like others to expand or comment on this.&lt;/p&gt;
&lt;p&gt;&lt;font color="#000000" size="2"&gt;Tim&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125008"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=125008" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/TimH/aggbug/125008.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Tim Huffam</dc:creator>
            <guid>http://geekswithblogs.net/TimH/archive/2008/09/09/task-oriented-programming.aspx</guid>
            <pubDate>Tue, 09 Sep 2008 05:10:06 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/TimH/comments/125008.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/TimH/archive/2008/09/09/task-oriented-programming.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/TimH/comments/commentRss/125008.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/TimH/services/trackbacks/125008.aspx</trackback:ping>
        </item>
    </channel>
</rss>