<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" version="2.0">
  <channel>
    <title>deepdark.net - James Green's Blog - C#</title>
    <link>http://deepdark.net/</link>
    <description>.NET, SQL Server and *.*</description>
    <image>
      <url>http://deepdark.net/files/deepdark.jpg</url>
      <title>deepdark.net - James Green's Blog - C#</title>
      <link>http://deepdark.net/</link>
    </image>
    <language>en-us</language>
    <copyright>James Green</copyright>
    <lastBuildDate>Tue, 01 Apr 2008 11:25:00 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>James.Green@deepdark.net</managingEditor>
    <webMaster>James.Green@deepdark.net</webMaster>
    <item>
      <trackback:ping>http://deepdark.net/Trackback.aspx?guid=5d5addad-0186-4e0d-a8ce-4da5400da852</trackback:ping>
      <pingback:server>http://deepdark.net/pingback.aspx</pingback:server>
      <pingback:target>http://deepdark.net/PermaLink,guid,5d5addad-0186-4e0d-a8ce-4da5400da852.aspx</pingback:target>
      <dc:creator>James Green</dc:creator>
      <wfw:comment>http://deepdark.net/CommentView,guid,5d5addad-0186-4e0d-a8ce-4da5400da852.aspx</wfw:comment>
      <wfw:commentRss>http://deepdark.net/SyndicationService.asmx/GetEntryCommentsRss?guid=5d5addad-0186-4e0d-a8ce-4da5400da852</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">This is the first in what I hope will become <a href="http://deepdark.net/CategoryView,category,C%23%2B3.0.aspx">a
series on the new language features in C# 3.0</a> used in <a href="http://msdn2.microsoft.com/en-us/library/w0x726c2.aspx">.NET
3.5</a> / <a href="http://msdn2.microsoft.com/en-us/vs2008/default.aspx">Visual Studio
2008</a>.<br /><br />
One thing I am not intending to cover is LINQ.  Just because the <a href="http://www.technorati.com/search/linq?authority=a4&amp;language=en">blogosphere
has been buzzing with LINQ</a> articles since the early days of <i>"Orcas"</i>. 
And with good reason I hasten to add!<br /><br /><b>Where I am starting is with the <font color="#000080" face="Courier New">var </font>keyword.</b><br /><br />
VB6 veterans will remember the <font color="#000080" face="Courier New">Variant </font>type. 
A <font color="#000080" face="Courier New">Variant </font>could contain anything,
even <font color="#000080" face="Courier New">Object</font>.  While this was <i>sort
of</i> useful, my memory of it is as a synonym for:  <i>I can't be bothered,
lets just stick it in a Variant and deal with it later</i>.<br /><br />
There was also a performance impact of using the special Variant type, they were large
in memory and have an overhead of extra runtime checking that added up; like when
assigned inside a loop for example.  They were also a special case in their un-assigned
form, taking on the value <font color="#000080" face="Courier New">Empty </font>(test
with <font color="#000080" face="Courier New">IsEmpty()</font>) vs <font color="#000080" face="Courier New">Nothing </font>(test
with <font color="#000080" face="Courier New">Is Nothing</font>).  
<br /><br />
So when I saw <font color="#000080" face="Courier New">var </font>added to C# I raised
my eyebrows in the way a Fed might, when the beagle sits quietly next to your suitcase
at the airport.<br /><br />
Most of the time you see it in the samples, it is used when returning an Anonymous
Type from a LINQ query.  And this is the clue!  <font color="#000080" face="Courier New">var </font>is
not itself a type, but instead <b>it is a signal to the compiler to infer the type
of an operation, and substitute in the required type</b>.  It does not even have
to be an Anonymous Type.  Consider the following simple example:<br /><br /><font face="Courier New"><font color="#000080">var </font>result = 10 / 2.0;<br /><font color="#0000ff"><font color="#000080">Console</font>.</font>WriteLine(result.ToString());<br /></font><br />
By the time this code is compiled, <font color="#000080" face="Courier New">var </font>is
replaced with <font color="#000080" face="Courier New">double</font>.  In fact,
the Intellisense on result will be correct for it being a <font color="#000080" face="Courier New">double</font>.<br /><br />
To confirm this, looking at those lines of the assembly in <a href="http://www.aisto.com/roeder/dotnet/">Lutz
Roder's Reflector</a> show the following after disassembly:<br /><br /><font face="Courier New"><font color="#000080">double </font>result = 5.0;<br /><font color="#000080">Console</font>.WriteLine(result.ToString());</font><br /><br />
OK, so var can be used independant of Anonymous Types, <b>but why would you want to
be <i>less </i>explicit in typing your variables?</b>  Consider the following
fictitious example:<br /><br /><font color="#000080" face="Courier New">DatabaseRequestService </font><font face="Courier New">req
= </font><font color="#000080" face="Courier New">DatabaseRequestService</font><font face="Courier New">.CreateFrom(value);</font><br /><br />
And compare it with the equivalent line using <font color="#000080" face="Courier New"><font color="#0000ff">var</font></font>: 
<br /><br /><font color="#000080" face="Courier New"><font color="#0000ff">var<font color="#000000"></font></font><font color="#000000">req
= </font>DatabaseRequestService</font><font face="Courier New">.CreateFrom(value);</font><br /><br />
Here, <b><font color="#000080" face="Courier New"><font color="#0000ff">var<font color="#000000"></font></font></font>leads
itself to much more readable syntax</b> with the same typing, Intellisense, and everything
else!<br /><br /><font color="#808080" size="1"><b>Listening To:  Róisín Murphy</b></font><br /><p></p></body>
      <title>The var keyword (C# 3.0) - Nothing at all like VB6 Variant - It's not even a Type!</title>
      <guid isPermaLink="false">http://deepdark.net/PermaLink,guid,5d5addad-0186-4e0d-a8ce-4da5400da852.aspx</guid>
      <link>http://deepdark.net/PermaLink,guid,5d5addad-0186-4e0d-a8ce-4da5400da852.aspx</link>
      <pubDate>Tue, 01 Apr 2008 11:25:00 GMT</pubDate>
      <description>This is the first in what I hope will become &lt;a href="http://deepdark.net/CategoryView,category,C%23%2B3.0.aspx"&gt;a
series on the new language features in C# 3.0&lt;/a&gt; used in &lt;a href="http://msdn2.microsoft.com/en-us/library/w0x726c2.aspx"&gt;.NET
3.5&lt;/a&gt; / &lt;a href="http://msdn2.microsoft.com/en-us/vs2008/default.aspx"&gt;Visual Studio
2008&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
One thing I am not intending to cover is LINQ.&amp;nbsp; Just because the &lt;a href="http://www.technorati.com/search/linq?authority=a4&amp;amp;language=en"&gt;blogosphere
has been buzzing with LINQ&lt;/a&gt; articles since the early days of &lt;i&gt;"Orcas"&lt;/i&gt;.&amp;nbsp;
And with good reason I hasten to add!&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Where I am starting is with the &lt;font color="#000080" face="Courier New"&gt;var &lt;/font&gt;keyword.&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
VB6 veterans will remember the &lt;font color="#000080" face="Courier New"&gt;Variant &lt;/font&gt;type.&amp;nbsp;
A &lt;font color="#000080" face="Courier New"&gt;Variant &lt;/font&gt;could contain anything,
even &lt;font color="#000080" face="Courier New"&gt;Object&lt;/font&gt;.&amp;nbsp; While this was &lt;i&gt;sort
of&lt;/i&gt; useful, my memory of it is as a synonym for:&amp;nbsp; &lt;i&gt;I can't be bothered,
lets just stick it in a Variant and deal with it later&lt;/i&gt;.&lt;br&gt;
&lt;br&gt;
There was also a performance impact of using the special Variant type, they were large
in memory and have an overhead of extra runtime checking that added up; like when
assigned inside a loop for example.&amp;nbsp; They were also a special case in their un-assigned
form, taking on the value &lt;font color="#000080" face="Courier New"&gt;Empty &lt;/font&gt;(test
with &lt;font color="#000080" face="Courier New"&gt;IsEmpty()&lt;/font&gt;) vs &lt;font color="#000080" face="Courier New"&gt;Nothing &lt;/font&gt;(test
with &lt;font color="#000080" face="Courier New"&gt;Is Nothing&lt;/font&gt;).&amp;nbsp; 
&lt;br&gt;
&lt;br&gt;
So when I saw &lt;font color="#000080" face="Courier New"&gt;var &lt;/font&gt;added to C# I raised
my eyebrows in the way a Fed might, when the beagle sits quietly next to your suitcase
at the airport.&lt;br&gt;
&lt;br&gt;
Most of the time you see it in the samples, it is used when returning an Anonymous
Type from a LINQ query.&amp;nbsp; And this is the clue!&amp;nbsp; &lt;font color="#000080" face="Courier New"&gt;var &lt;/font&gt;is
not itself a type, but instead &lt;b&gt;it is a signal to the compiler to infer the type
of an operation, and substitute in the required type&lt;/b&gt;.&amp;nbsp; It does not even have
to be an Anonymous Type.&amp;nbsp; Consider the following simple example:&lt;br&gt;
&lt;br&gt;
&lt;font face="Courier New"&gt;&lt;font color="#000080"&gt;var &lt;/font&gt;result = 10 / 2.0;&lt;br&gt;
&lt;font color="#0000ff"&gt;&lt;font color="#000080"&gt;Console&lt;/font&gt;.&lt;/font&gt;WriteLine(result.ToString());&lt;br&gt;
&lt;/font&gt;
&lt;br&gt;
By the time this code is compiled, &lt;font color="#000080" face="Courier New"&gt;var &lt;/font&gt;is
replaced with &lt;font color="#000080" face="Courier New"&gt;double&lt;/font&gt;.&amp;nbsp; In fact,
the Intellisense on result will be correct for it being a &lt;font color="#000080" face="Courier New"&gt;double&lt;/font&gt;.&lt;br&gt;
&lt;br&gt;
To confirm this, looking at those lines of the assembly in &lt;a href="http://www.aisto.com/roeder/dotnet/"&gt;Lutz
Roder's Reflector&lt;/a&gt; show the following after disassembly:&lt;br&gt;
&lt;br&gt;
&lt;font face="Courier New"&gt;&lt;font color="#000080"&gt;double &lt;/font&gt;result = 5.0;&lt;br&gt;
&lt;font color="#000080"&gt;Console&lt;/font&gt;.WriteLine(result.ToString());&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
OK, so var can be used independant of Anonymous Types, &lt;b&gt;but why would you want to
be &lt;i&gt;less &lt;/i&gt;explicit in typing your variables?&lt;/b&gt;&amp;nbsp; Consider the following
fictitious example:&lt;br&gt;
&lt;br&gt;
&lt;font color="#000080" face="Courier New"&gt;DatabaseRequestService &lt;/font&gt;&lt;font face="Courier New"&gt;req
= &lt;/font&gt;&lt;font color="#000080" face="Courier New"&gt;DatabaseRequestService&lt;/font&gt;&lt;font face="Courier New"&gt;.CreateFrom(value);&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
And compare it with the equivalent line using &lt;font color="#000080" face="Courier New"&gt;&lt;font color="#0000ff"&gt;var&lt;/font&gt;&lt;/font&gt;: 
&lt;br&gt;
&lt;br&gt;
&lt;font color="#000080" face="Courier New"&gt;&lt;font color="#0000ff"&gt;var&lt;font color="#000000"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#000000"&gt;req
= &lt;/font&gt;DatabaseRequestService&lt;/font&gt;&lt;font face="Courier New"&gt;.CreateFrom(value);&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
Here, &lt;b&gt;&lt;font color="#000080" face="Courier New"&gt;&lt;font color="#0000ff"&gt;var&lt;font color="#000000"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;leads
itself to much more readable syntax&lt;/b&gt; with the same typing, Intellisense, and everything
else!&lt;br&gt;
&lt;br&gt;
&lt;font color="#808080" size="1"&gt;&lt;b&gt;Listening To:&amp;nbsp; Róisín Murphy&lt;/b&gt;&lt;/font&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;</description>
      <comments>http://deepdark.net/CommentView,guid,5d5addad-0186-4e0d-a8ce-4da5400da852.aspx</comments>
      <category>C#</category>
      <category>C# 3.0</category>
      <category>Geeking Out!</category>
      <category>Microsoft.NET</category>
    </item>
    <item>
      <trackback:ping>http://deepdark.net/Trackback.aspx?guid=ed371657-e6c0-4014-9611-4a71b54d00a3</trackback:ping>
      <pingback:server>http://deepdark.net/pingback.aspx</pingback:server>
      <pingback:target>http://deepdark.net/PermaLink,guid,ed371657-e6c0-4014-9611-4a71b54d00a3.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://deepdark.net/CommentView,guid,ed371657-e6c0-4014-9611-4a71b54d00a3.aspx</wfw:comment>
      <wfw:commentRss>http://deepdark.net/SyndicationService.asmx/GetEntryCommentsRss?guid=ed371657-e6c0-4014-9611-4a71b54d00a3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
For a limited time, members of CSharpZealot.com have access to some free Silverlight
training content!  Here's how:<br /><ul><li>
You will need to grab the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=C72F125F-A6F6-4F4E-A11D-6942C9BA1834&amp;displaylang=en&amp;Hash=QzwnkymYiCieDfSWumQgSvEujdch544vwBZetAbr2ParNfc%2bQ6a6PpweeR8jaCs4PXD3u%2f8bNhDsuk5sYXdSjw%3d%3d">Silverlight
1.0 RC1 SDK</a></li><li><a href="http://www.microsoft.com/downloads/details.aspx?familyid=262D25E3-F589-4842-8157-034D1E7CF3A3&amp;displaylang=en">.NET
Framework, v1.1</a> (required by the InnerWorkings bits, regardless of the training
being in Visual Studio 2005)<br /></li><li>
Register at <a href="http://csharpzealot.com/">CSharpZealot.com</a> if you have not
already done so<a href="http://csharpzealot.com/"><br /></a></li><li>
Follow <a href="http://www.innerworkings.com/promotions/664b06ea-357c-4730-8cb0-44376cceb865/csharpzealot-silverlight-promotion">the
link on Brian's blog to InnerWorkings special promotion for CSharpZealots</a></li></ul>
Easy!<br /><br />
Also, I'm impressed at how well the InnerWorkings bits integrate with Visual Studio
during the training experience.  You should really check it out.<br /><br />
Now please keep in mind that Web 2.0 <i>(and it's previous incarnation, Web 0.9) </i><b>supports
bi-directional time travel</b>.  
<br /><ul><li>
Forward, at a pace of 1 second per second, same as daily life, really; and 
<br /></li><li>
Backwards at a rate of 20 yrs in, say, about 150 miliseconds.</li></ul>
That means that if you are reading this blog post some time in the future, <b>this
offer may be closed</b>.  It's only open for a limited time, so get to it! 
Don't be the last guy on the block to not know how to use the MediaElement and VideoBrush
in Silverlight!<br /><br />
Mad props <font color="#808080" size="2">(that's what the kids say these days, don't
ya know?)</font> to <a href="http://msmvps.com/blogs/brianmadsen/">Brian Madsen</a>,
btw, for keeping CSharpZealot the place to get your .NET love.<br /><p></p></body>
      <title>Quickest way to free Silverlight training?  InnerWorkings and CSharpZealot work together to make you cooler than your friends</title>
      <guid isPermaLink="false">http://deepdark.net/PermaLink,guid,ed371657-e6c0-4014-9611-4a71b54d00a3.aspx</guid>
      <link>http://deepdark.net/PermaLink,guid,ed371657-e6c0-4014-9611-4a71b54d00a3.aspx</link>
      <pubDate>Wed, 15 Aug 2007 08:01:21 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
For a limited time, members of CSharpZealot.com have access to some free Silverlight
training content!&amp;nbsp; Here's how:&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
You will need to grab the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=C72F125F-A6F6-4F4E-A11D-6942C9BA1834&amp;amp;displaylang=en&amp;amp;Hash=QzwnkymYiCieDfSWumQgSvEujdch544vwBZetAbr2ParNfc%2bQ6a6PpweeR8jaCs4PXD3u%2f8bNhDsuk5sYXdSjw%3d%3d"&gt;Silverlight
1.0 RC1 SDK&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=262D25E3-F589-4842-8157-034D1E7CF3A3&amp;amp;displaylang=en"&gt;.NET
Framework, v1.1&lt;/a&gt; (required by the InnerWorkings bits, regardless of the training
being in Visual Studio 2005)&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;
Register at &lt;a href="http://csharpzealot.com/"&gt;CSharpZealot.com&lt;/a&gt; if you have not
already done so&lt;a href="http://csharpzealot.com/"&gt;
&lt;br&gt;
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Follow &lt;a href="http://www.innerworkings.com/promotions/664b06ea-357c-4730-8cb0-44376cceb865/csharpzealot-silverlight-promotion"&gt;the
link on Brian's blog to InnerWorkings special promotion for CSharpZealots&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
Easy!&lt;br&gt;
&lt;br&gt;
Also, I'm impressed at how well the InnerWorkings bits integrate with Visual Studio
during the training experience.&amp;nbsp; You should really check it out.&lt;br&gt;
&lt;br&gt;
Now please keep in mind that Web 2.0 &lt;i&gt;(and it's previous incarnation, Web 0.9) &lt;/i&gt;&lt;b&gt;supports
bi-directional time travel&lt;/b&gt;.&amp;nbsp; 
&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
Forward, at a pace of 1 second per second, same as daily life, really; and 
&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;
Backwards at a rate of 20 yrs in, say, about 150 miliseconds.&lt;/li&gt;
&lt;/ul&gt;
That means that if you are reading this blog post some time in the future, &lt;b&gt;this
offer may be closed&lt;/b&gt;.&amp;nbsp; It's only open for a limited time, so get to it!&amp;nbsp;
Don't be the last guy on the block to not know how to use the MediaElement and VideoBrush
in Silverlight!&lt;br&gt;
&lt;br&gt;
Mad props &lt;font color="#808080" size="2"&gt;(that's what the kids say these days, don't
ya know?)&lt;/font&gt; to &lt;a href="http://msmvps.com/blogs/brianmadsen/"&gt;Brian Madsen&lt;/a&gt;,
btw, for keeping CSharpZealot the place to get your .NET love.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;</description>
      <comments>http://deepdark.net/CommentView,guid,ed371657-e6c0-4014-9611-4a71b54d00a3.aspx</comments>
      <category>C#</category>
      <category>Geeking Out!</category>
    </item>
    <item>
      <trackback:ping>http://deepdark.net/Trackback.aspx?guid=926727ff-1b0e-4130-960f-179ac570bb0d</trackback:ping>
      <pingback:server>http://deepdark.net/pingback.aspx</pingback:server>
      <pingback:target>http://deepdark.net/PermaLink,guid,926727ff-1b0e-4130-960f-179ac570bb0d.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://deepdark.net/CommentView,guid,926727ff-1b0e-4130-960f-179ac570bb0d.aspx</wfw:comment>
      <wfw:commentRss>http://deepdark.net/SyndicationService.asmx/GetEntryCommentsRss?guid=926727ff-1b0e-4130-960f-179ac570bb0d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">It became clear to me <a href="http://deepdark.net/PermaLink,guid,970418da-7cd9-4a02-8741-377a05a8f997.aspx">during
my last blog post on the .NET landscape</a> that it was going to grow into more than
one post.  
<br /><p></p><b>Framework Versions</b><br /><br />
One fact that is important to note about the graphic in that post, and it was the
catalyst for me making the drawing, is that <b>the .NET 3.0 and .NET 3.5 frameworks
do not supersede .NET 2.0 but augment it</b>.<br /><br />
What I mean by this is if you were to look into your <font face="Courier New">%WINDIR%\Microsoft.NET\Framework\v3.0</font> folder
you do not get a new <font face="Courier New">System.Data.Dll</font> or <font face="Courier New">System.Web.dll</font>. 
Instead you see the folders for:<br /><ul><li><a href="http://wcf.netfx3.com/">Windows Communication Foundation</a> (Including <a href="http://cardspace.netfx3.com/">Windows
CardSpace</a>) 
</li><li><a href="http://wf.netfx3.com/">Windows Workflow Foundation</a></li><li><a href="http://wpf.netfx3.com/">Windows Presentation Foundation</a><br /></li></ul>
If you look in your <font face="Courier New">%WINDIR%\Microsoft.NET\Framework\v3.5.xxx\</font><font color="#808080" size="1">(still
beta at time of writing)</font> the main thing to note here is a new <font face="Courier New">csc.exe</font> and <font face="Courier New">vbc.exe</font>.<br /><br /><b>So what do you get with .NET 3.5 &amp; Visual Studio 2008 (codename "Orcas")?</b><br /><br /><ul><li><a href="http://blogs.msdn.com/tq/archive/2005/09/15/467714.aspx">Managed AddIn Framework </a>(System.AddIn
&amp; System.AddIn.Contract) ...also the <a href="http://blogs.msdn.com/clraddins/">CLR
Add-In team blog</a>.<br /></li><li><a href="http://www.danielmoth.com/Blog/2007/05/accountmanagement.html">An AD/ADAM
wrapper </a>(System.DirectoryServices.AccountManagement) 
</li><li>
A <a href="http://msdn2.microsoft.com/en-us/library/aa394053.aspx">WMI 2.0 Managed
wrapper</a> (System.Management.Instrumentation) 
</li><li><a href="http://blogs.msdn.com/p2p/archive/2007/03/12/writing-peer-to-peer-applications-using-net-part-1-pnrp.aspx">Peer-to-Peer
API's </a>(System.Net.PeerToPeer &amp; System.Net.PeerToPeer.Collaboration) 
</li><li>
In ASP.NET there is <a href="http://ajax.asp.net/">ASP.NET AJAX</a>, <a href="http://weblogs.asp.net/wallym/archive/2007/05/23/asp-net-podcast-show-93-asp-net-listview-in-orcas-beta-1-video.aspx">asp:ListView</a>,
and the <a href="http://weblogs.asp.net/scottgu/archive/2007/01/28/video-using-linq-with-asp-net-in-vs-orcas-part-1.aspx">LinqDataSource</a>.
(System.Web.Extensions) 
</li><li><a href="http://blogs.msdn.com/mwinkle/archive/2007/02/28/wcf-and-wf-in-quot-orcas-quot.aspx">Improvements
to WCF and WF </a>(System.ServiceModel.Web &amp; System.WorkflowServices) 
</li><li><a href="http://blogs.msdn.com/adonet/archive/2007/04/20/ado-net-entity-framework-orcas-beta-1.aspx">ADO.NET
Entity Framework </a>(System.Data.Entity) 
</li><li><a href="http://blogs.msdn.com/shawnfa/archive/2007/01/17/new-crypto-algorithms-in-orcas.aspx">New
Crypto algorithms</a> and <a href="http://msdn2.microsoft.com/en-us/library/aa375276.aspx">support
for Vista's Next-Gen Crypto, which replaces CryptoAPI</a>. (System.Security)</li></ul><p><strong><font color="#808080">Update</font></strong>:  Please also <a href="http://www.danielmoth.com/Blog/labels/Orcas.html">check
out Daniel Moth's whole bunch Orcas posts</a>, and <a href="http://www.danielmoth.com/Blog/2007/06/net-framework-35.html">his
run-down of the new bits</a>.
</p>
...and last but not least, the golden haired child, <a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx">LINQ</a>...<br /><ul><li><a href="http://www.danielmoth.com/Blog/2007/05/systemxmllinq.html">LINQ to Xml </a>(System.Xml.Linq)
and <a href="http://weblogs.asp.net/scottgu/archive/2006/09/01/Understanding-LINQ-to-SQL-Query-Translations.aspx">LINQ
to SQL </a>(System.Data.Linq) ...also ScottGu's posts <a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx">here</a>, <a href="http://weblogs.asp.net/scottgu/archive/2007/05/29/linq-to-sql-part-2-defining-our-data-model-classes.aspx">here</a> and <a href="http://weblogs.asp.net/scottgu/archive/2007/06/29/linq-to-sql-part-3-querying-our-database.aspx">here</a> are
some of the best you'll find)<br /></li></ul><p>
...and for everything that I have missed, or is not in the beta bits yet, <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=17319EB4-299C-43B8-A360-A1C2BD6A421B&amp;displaylang=en">grab
the Orcas overview whitepaper</a>.<br /><br /><b>What is .NET 3.5 going to do to 3.0?</b><br /><br />
It seems <a href="http://www.danielmoth.com/Blog/2007/06/net-framework-35.html">it
has to do with Green Bits and Red Bits</a><font size="1">(source: Daniel Moth)</font>. 
In other words, .NET 3.5 will <i>also include</i> SP1 for .NET 3.0 and SP1 for .NET
2.0.<br /><br /></p></body>
      <title>What is the .NET landscape to date and going into the next year - part 2:  Framework Versions</title>
      <guid isPermaLink="false">http://deepdark.net/PermaLink,guid,926727ff-1b0e-4130-960f-179ac570bb0d.aspx</guid>
      <link>http://deepdark.net/PermaLink,guid,926727ff-1b0e-4130-960f-179ac570bb0d.aspx</link>
      <pubDate>Mon, 02 Jul 2007 23:11:18 GMT</pubDate>
      <description>It became clear to me &lt;a href="http://deepdark.net/PermaLink,guid,970418da-7cd9-4a02-8741-377a05a8f997.aspx"&gt;during
my last blog post on the .NET landscape&lt;/a&gt; that it was going to grow into more than
one post.&amp;nbsp; 
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;b&gt;Framework Versions&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
One fact that is important to note about the graphic in that post, and it was the
catalyst for me making the drawing, is that &lt;b&gt;the .NET 3.0 and .NET 3.5 frameworks
do not supersede .NET 2.0 but augment it&lt;/b&gt;.&lt;br&gt;
&lt;br&gt;
What I mean by this is if you were to look into your &lt;font face="Courier New"&gt;%WINDIR%\Microsoft.NET\Framework\v3.0&lt;/font&gt; folder
you do not get a new &lt;font face="Courier New"&gt;System.Data.Dll&lt;/font&gt; or &lt;font face="Courier New"&gt;System.Web.dll&lt;/font&gt;.&amp;nbsp;
Instead you see the folders for:&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://wcf.netfx3.com/"&gt;Windows Communication Foundation&lt;/a&gt; (Including &lt;a href="http://cardspace.netfx3.com/"&gt;Windows
CardSpace&lt;/a&gt;) 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://wf.netfx3.com/"&gt;Windows Workflow Foundation&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://wpf.netfx3.com/"&gt;Windows Presentation Foundation&lt;/a&gt;
&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
If you look in your &lt;font face="Courier New"&gt;%WINDIR%\Microsoft.NET\Framework\v3.5.xxx\&lt;/font&gt; &lt;font color="#808080" size="1"&gt;(still
beta at time of writing)&lt;/font&gt; the main thing to note here is a new &lt;font face="Courier New"&gt;csc.exe&lt;/font&gt; and &lt;font face="Courier New"&gt;vbc.exe&lt;/font&gt;.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;So what do you get with .NET 3.5 &amp;amp; Visual Studio 2008 (codename "Orcas")?&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/tq/archive/2005/09/15/467714.aspx"&gt;Managed AddIn Framework &lt;/a&gt;(System.AddIn
&amp;amp; System.AddIn.Contract) ...also the &lt;a href="http://blogs.msdn.com/clraddins/"&gt;CLR
Add-In team blog&lt;/a&gt;.&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.danielmoth.com/Blog/2007/05/accountmanagement.html"&gt;An AD/ADAM
wrapper &lt;/a&gt;(System.DirectoryServices.AccountManagement) 
&lt;/li&gt;
&lt;li&gt;
A &lt;a href="http://msdn2.microsoft.com/en-us/library/aa394053.aspx"&gt;WMI 2.0 Managed
wrapper&lt;/a&gt; (System.Management.Instrumentation) 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/p2p/archive/2007/03/12/writing-peer-to-peer-applications-using-net-part-1-pnrp.aspx"&gt;Peer-to-Peer
API's &lt;/a&gt;(System.Net.PeerToPeer &amp;amp; System.Net.PeerToPeer.Collaboration) 
&lt;/li&gt;
&lt;li&gt;
In ASP.NET there is &lt;a href="http://ajax.asp.net/"&gt;ASP.NET AJAX&lt;/a&gt;, &lt;a href="http://weblogs.asp.net/wallym/archive/2007/05/23/asp-net-podcast-show-93-asp-net-listview-in-orcas-beta-1-video.aspx"&gt;asp:ListView&lt;/a&gt;,
and the &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/01/28/video-using-linq-with-asp-net-in-vs-orcas-part-1.aspx"&gt;LinqDataSource&lt;/a&gt;.
(System.Web.Extensions) 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/mwinkle/archive/2007/02/28/wcf-and-wf-in-quot-orcas-quot.aspx"&gt;Improvements
to WCF and WF &lt;/a&gt;(System.ServiceModel.Web &amp;amp; System.WorkflowServices) 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/adonet/archive/2007/04/20/ado-net-entity-framework-orcas-beta-1.aspx"&gt;ADO.NET
Entity Framework &lt;/a&gt;(System.Data.Entity) 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://blogs.msdn.com/shawnfa/archive/2007/01/17/new-crypto-algorithms-in-orcas.aspx"&gt;New
Crypto algorithms&lt;/a&gt; and &lt;a href="http://msdn2.microsoft.com/en-us/library/aa375276.aspx"&gt;support
for Vista's Next-Gen Crypto, which replaces CryptoAPI&lt;/a&gt;. (System.Security)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font color="#808080"&gt;Update&lt;/font&gt;&lt;/strong&gt;:&amp;nbsp; Please also &lt;a href="http://www.danielmoth.com/Blog/labels/Orcas.html"&gt;check
out Daniel Moth's whole bunch Orcas posts&lt;/a&gt;, and &lt;a href="http://www.danielmoth.com/Blog/2007/06/net-framework-35.html"&gt;his
run-down of the new bits&lt;/a&gt;.
&lt;/p&gt;
...and last but not least, the golden haired child, &lt;a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx"&gt;LINQ&lt;/a&gt;...&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.danielmoth.com/Blog/2007/05/systemxmllinq.html"&gt;LINQ to Xml &lt;/a&gt;(System.Xml.Linq)
and &lt;a href="http://weblogs.asp.net/scottgu/archive/2006/09/01/Understanding-LINQ-to-SQL-Query-Translations.aspx"&gt;LINQ
to SQL &lt;/a&gt;(System.Data.Linq) ...also ScottGu's posts &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx"&gt;here&lt;/a&gt;, &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/05/29/linq-to-sql-part-2-defining-our-data-model-classes.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/06/29/linq-to-sql-part-3-querying-our-database.aspx"&gt;here&lt;/a&gt; are
some of the best you'll find)&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
...and for everything that I have missed, or is not in the beta bits yet, &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=17319EB4-299C-43B8-A360-A1C2BD6A421B&amp;amp;displaylang=en"&gt;grab
the Orcas overview whitepaper&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;What is .NET 3.5 going to do to 3.0?&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
It seems &lt;a href="http://www.danielmoth.com/Blog/2007/06/net-framework-35.html"&gt;it
has to do with Green Bits and Red Bits&lt;/a&gt; &lt;font size="1"&gt;(source: Daniel Moth)&lt;/font&gt;.&amp;nbsp;
In other words, .NET 3.5 will &lt;i&gt;also include&lt;/i&gt; SP1 for .NET 3.0 and SP1 for .NET
2.0.&lt;br&gt;
&lt;br&gt;
&lt;/p&gt;</description>
      <comments>http://deepdark.net/CommentView,guid,926727ff-1b0e-4130-960f-179ac570bb0d.aspx</comments>
      <category>C#</category>
      <category>Geeking Out!</category>
      <category>Microsoft.NET</category>
      <category>Visual Basic</category>
    </item>
    <item>
      <trackback:ping>http://deepdark.net/Trackback.aspx?guid=970418da-7cd9-4a02-8741-377a05a8f997</trackback:ping>
      <pingback:server>http://deepdark.net/pingback.aspx</pingback:server>
      <pingback:target>http://deepdark.net/PermaLink,guid,970418da-7cd9-4a02-8741-377a05a8f997.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://deepdark.net/CommentView,guid,970418da-7cd9-4a02-8741-377a05a8f997.aspx</wfw:comment>
      <wfw:commentRss>http://deepdark.net/SyndicationService.asmx/GetEntryCommentsRss?guid=970418da-7cd9-4a02-8741-377a05a8f997</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">When I started playing with LINQ, I needed
to get some clarity <strike><font color="#d3d3d3">on this in my mind, so in the spirit
of </font></strike><a href="http://en.wikipedia.org/wiki/Carolus_Linnaeus"><strike><font color="#d3d3d3">Linnaeus</font></strike></a><strike><font color="#d3d3d3">, </font></strike><a href="http://en.wikipedia.org/wiki/Dmitri_Mendeleev"><strike><font color="#d3d3d3">Mendeleev</font></strike></a><strike><font color="#d3d3d3"> and </font></strike><a href="http://en.wikipedia.org/wiki/Murray_Gell-Mann"><strike><font color="#d3d3d3">Gell-Mann</font></strike></a><strike><font color="#d3d3d3">,
I put together a graphic that showed the generations of the various bits, and after
talking with friends thought it was worth sharing:</font></strike><br /><br /><strong><font color="#808080">Update</font></strong>:  <a href="http://www.danielmoth.com/Blog/2007/06/visual-studio-2008-stack.html">Daniel
Moth has a better graphic for the same data on his blog first</a>.  Shame, not
an image map. :-)<br /><br /><a href="http://blogs.msdn.com/mohammadakif/">Mohammad Adil Akif</a> also <a href="http://blogs.msdn.com/mohammadakif/archive/2006/12/03/net-3-0-different-versions-of-the-net-framework.aspx">has
a version in his blog</a>.<br /><br /><font color="#d3d3d3"><strike>...This is the blog version - the original form was
a Post-It note.<br />
...And in the spirit of Web 0.9 <i>(which came before Web 2.0 :-)</i> the graphic
is an image map :-)<br /></strike></font><br />
I know there is much more coming, like the Dynamic Language Runtime, <a href="http://msdn2.microsoft.com/en-us/vstudio/aa718368.aspx">Domain-Specific
Language tools</a>, <a href="http://www.microsoft.com/silverlight/default01.aspx">Silverlight</a>,
and so on.   I've also chosen not to call out the <a href="http://msdn2.microsoft.com/en-us/teamsystem/default.aspx">versions
of Team System</a>, both in the interest of clarity.</body>
      <title>What is the .NET landscape to date and going into the next year - part 1</title>
      <guid isPermaLink="false">http://deepdark.net/PermaLink,guid,970418da-7cd9-4a02-8741-377a05a8f997.aspx</guid>
      <link>http://deepdark.net/PermaLink,guid,970418da-7cd9-4a02-8741-377a05a8f997.aspx</link>
      <pubDate>Sun, 01 Jul 2007 13:51:05 GMT</pubDate>
      <description>When I started playing with LINQ, I needed to get some clarity &lt;strike&gt;&lt;font color="#d3d3d3"&gt;on
this in my mind, so in the spirit of &lt;/font&gt;&lt;/strike&gt;&lt;a href="http://en.wikipedia.org/wiki/Carolus_Linnaeus"&gt;&lt;strike&gt;&lt;font color="#d3d3d3"&gt;Linnaeus&lt;/font&gt;&lt;/strike&gt;&lt;/a&gt;&lt;strike&gt;&lt;font color="#d3d3d3"&gt;, &lt;/font&gt;&lt;/strike&gt;&lt;a href="http://en.wikipedia.org/wiki/Dmitri_Mendeleev"&gt;&lt;strike&gt;&lt;font color="#d3d3d3"&gt;Mendeleev&lt;/font&gt;&lt;/strike&gt;&lt;/a&gt;&lt;strike&gt;&lt;font color="#d3d3d3"&gt; and &lt;/font&gt;&lt;/strike&gt;&lt;a href="http://en.wikipedia.org/wiki/Murray_Gell-Mann"&gt;&lt;strike&gt;&lt;font color="#d3d3d3"&gt;Gell-Mann&lt;/font&gt;&lt;/strike&gt;&lt;/a&gt;&lt;strike&gt;&lt;font color="#d3d3d3"&gt;,
I put together a graphic that showed the generations of the various bits, and after
talking with friends thought it was worth sharing:&lt;/font&gt;&lt;/strike&gt;
&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;&lt;font color="#808080"&gt;Update&lt;/font&gt;&lt;/strong&gt;:&amp;nbsp; &lt;a href="http://www.danielmoth.com/Blog/2007/06/visual-studio-2008-stack.html"&gt;Daniel
Moth has a better graphic for the same data on his blog first&lt;/a&gt;.&amp;nbsp; Shame, not
an image map. :-)&lt;br&gt;
&lt;br&gt;
&lt;a href="http://blogs.msdn.com/mohammadakif/"&gt;Mohammad Adil Akif&lt;/a&gt; also &lt;a href="http://blogs.msdn.com/mohammadakif/archive/2006/12/03/net-3-0-different-versions-of-the-net-framework.aspx"&gt;has
a version in his blog&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
&lt;font color="#d3d3d3"&gt;&lt;strike&gt;...This is the blog version - the original form was
a Post-It note.&lt;br&gt;
...And in the spirit of Web 0.9 &lt;i&gt;(which came before Web 2.0 :-)&lt;/i&gt; the graphic
is an image map :-)&lt;br&gt;
&lt;/strike&gt;&lt;/font&gt;
&lt;br&gt;
I know there is much more coming, like the Dynamic Language Runtime, &lt;a href="http://msdn2.microsoft.com/en-us/vstudio/aa718368.aspx"&gt;Domain-Specific
Language tools&lt;/a&gt;, &lt;a href="http://www.microsoft.com/silverlight/default01.aspx"&gt;Silverlight&lt;/a&gt;,
and so on.&amp;nbsp;&amp;nbsp; I've also chosen not to call out the &lt;a href="http://msdn2.microsoft.com/en-us/teamsystem/default.aspx"&gt;versions
of Team System&lt;/a&gt;, both in the interest of clarity.</description>
      <comments>http://deepdark.net/CommentView,guid,970418da-7cd9-4a02-8741-377a05a8f997.aspx</comments>
      <category>C#</category>
      <category>Geeking Out!</category>
      <category>Microsoft.NET</category>
      <category>Visual Basic</category>
    </item>
    <item>
      <trackback:ping>http://deepdark.net/Trackback.aspx?guid=b77aac01-fdec-4e60-984e-192722f69b41</trackback:ping>
      <pingback:server>http://deepdark.net/pingback.aspx</pingback:server>
      <pingback:target>http://deepdark.net/PermaLink,guid,b77aac01-fdec-4e60-984e-192722f69b41.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://deepdark.net/CommentView,guid,b77aac01-fdec-4e60-984e-192722f69b41.aspx</wfw:comment>
      <wfw:commentRss>http://deepdark.net/SyndicationService.asmx/GetEntryCommentsRss?guid=b77aac01-fdec-4e60-984e-192722f69b41</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've just got a couple of lessons from the last week to share around developing Office
2003 (and <span style="FONT-SIZE: 10pt; COLOR: #003300; FONT-FAMILY: Verdana; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-AU; mso-fareast-language: EN-AU; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'">specifically </span>Visio
2003) Add-Ins
</p>
        <p>
I'm also trying to saturate this post with links because I have come up with a good
size folder in my bookmarks for what started out to be a simple task.
</p>
        <ul>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=3c9a983a-ac14-4125-8ba0-d36d67e0f4ad&amp;DisplayLang=en">Grab
the PIA's</a>.  <a href="http://msdn2.microsoft.com/en-us/library/aa169585(office.11).aspx">Anyone
who wants to run the Add-In will need them</a>.  Alternatively they can be installed
from the Office Add/Remove/Repair under the guise of <strong>.NET <span style="FONT-SIZE: 10pt; COLOR: #003300; FONT-FAMILY: Verdana; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-AU; mso-fareast-language: EN-AU; mso-bidi-language: AR-SA">Programmability </span>Support</strong>,
but in reality the user may not have the media or security access to do this. 
Do <strong>NOT</strong> however <a href="http://blogs.msdn.com/artleo/archive/2005/04/19/409715.aspx">ship
the PIA's <em>in</em> your bits</a>.  Ship the PIA's <em>with</em> your bits: 
This means 2x MSI's. 
</li>
          <li>
Using <a href="http://blogs.msdn.com/artleo/archive/2005/09/19/471497.aspx">NAant
to automate the build with csc.exe &amp; vbc.exe is suboptimal</a>.  I'm keeping
my project to one small assembly that depends on the PIAs, and also depends on another
assembly that does the heavy lifting but has no ref to the PIA's. 
</li>
          <li>
Strong Name everything.  Well, strong name everything anyway, but when trying
to pass of managed code as COM it is essential. 
</li>
          <li>
You cannot load a .NET DLL, even one with the <font face="Courier New">ComVisibleAttribute</font> on
the Assembly or Classes, via the Office UI.  You just can't.  <a href="http://support.microsoft.com/kb/316723">KB316723
gives an explanation</a>.  This is because Office will try and register it the
old<font face="Courier New"> regsvr32</font> way, which of course won't work. 
To get a .NET DLL into the Macros -&gt; Add-Ins list, <strong>you must write
the registry entry</strong> under: <font face="Courier New" color="#000000">HKEY_CURRENT_USER\Software\Microsoft\<em>&lt;office
program name&gt;</em>\Addins\</font></li>
          <li>
This brings me to my next point.  <a href="http://support.microsoft.com/kb/316723">KB316723</a> hints
at it, but your setup must write a HKCU key not a HKLM key.  <strong>The
Shared Add-In Wizard</strong> in Studio is ambiguous when it shows you this choice:</li>
        </ul>
        <p>
          <img src="http://deepdark.net/content/binary/20070529_4of5.jpg" border="0" />
        </p>
        <ul>
          <li>
I know this may be contentious, but consider using VB.NET over C#.  This depends
of course, but some parts of the Office object model make heavy use of Optional Parameters
which <a href="http://msdn2.microsoft.com/en-us/library/aa192488(office.11).aspx">C#
does not support</a>.  It has been <a href="http://msmvps.com/blogs/bill/archive/2006/03/28/88259.aspx">noted
elsewhere what Type.Missing can do for readability</a>.  Having said that,
it does vary greatly depending on where in the Office Object Model you are. 
</li>
          <li>
Spend some time with the Setup project that the Shared Add-In Wizard makes and test
it.  Once you like it, reverse engineer it to a WiX script and feed that to your
automated build.  For the record, you do that with: 
</li>
        </ul>
        <p>
          <font face="Courier New" color="#000000">Dark.exe –x path Debug/msi My.wxs 
<br />
Candle My.wxs 
<br />
Light My.Wixobj </font>
        </p>
        <ul>
          <li>
To extra points when dealing with WiX-ified MSI's 
<ol><li>
It's useful to note that the extracted (<font face="Courier New">-x</font>) resources take
many forms. <font face="Courier New"> DefBannerBitmap.ibd</font> for example
is just a bitmap.  I think it is easier to rename it to .bmp &amp; tweak it in
Photoshop than to add a new banner in Visual Studio. 
</li><li>
The Add-in reg setting mentioned in point #4 above references an assembly version. 
Visual Studio tweeks this for you but your WiX script will be frozen at the time your <font face="Courier New">Dark.exe'd</font> it. 
So don't auto-increment your assembly version numbers, or tweak you WiX script. 
The choice is yours but your MSI must write the version of the Add-In DLL to the target
machine's registry.</li></ol></li>
        </ul>
        <p>
          <font color="#808080">
            <strong>Listening To: Leftfield, Leftism</strong>
          </font>
        </p>
      </body>
      <title>Office Add-Ins - gotcha's from the field </title>
      <guid isPermaLink="false">http://deepdark.net/PermaLink,guid,b77aac01-fdec-4e60-984e-192722f69b41.aspx</guid>
      <link>http://deepdark.net/PermaLink,guid,b77aac01-fdec-4e60-984e-192722f69b41.aspx</link>
      <pubDate>Tue, 29 May 2007 02:53:56 GMT</pubDate>
      <description>&lt;p&gt;
I've just got a couple of lessons from the last week to share around developing Office
2003 (and &lt;span style="FONT-SIZE: 10pt; COLOR: #003300; FONT-FAMILY: Verdana; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-AU; mso-fareast-language: EN-AU; mso-bidi-language: AR-SA; mso-bidi-font-family: 'Times New Roman'"&gt;specifically &lt;/span&gt;Visio
2003) Add-Ins
&lt;/p&gt;
&lt;p&gt;
I'm also trying to saturate this post with links because I have come up with a good
size folder in my bookmarks for what started out to be a simple task.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=3c9a983a-ac14-4125-8ba0-d36d67e0f4ad&amp;amp;DisplayLang=en"&gt;Grab
the PIA's&lt;/a&gt;.&amp;nbsp; &lt;a href="http://msdn2.microsoft.com/en-us/library/aa169585(office.11).aspx"&gt;Anyone
who wants to run the Add-In will need them&lt;/a&gt;.&amp;nbsp; Alternatively they can be installed
from the Office Add/Remove/Repair under the guise of &lt;strong&gt;.NET &lt;span style="FONT-SIZE: 10pt; COLOR: #003300; FONT-FAMILY: Verdana; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-AU; mso-fareast-language: EN-AU; mso-bidi-language: AR-SA"&gt;Programmability &lt;/span&gt;Support&lt;/strong&gt;,
but in reality the user may not have the media or security access to do this.&amp;nbsp;
Do &lt;strong&gt;NOT&lt;/strong&gt; however &lt;a href="http://blogs.msdn.com/artleo/archive/2005/04/19/409715.aspx"&gt;ship
the PIA's &lt;em&gt;in&lt;/em&gt; your bits&lt;/a&gt;.&amp;nbsp; Ship the PIA's &lt;em&gt;with&lt;/em&gt; your bits:&amp;nbsp;
This means 2x MSI's. 
&lt;li&gt;
Using &lt;a href="http://blogs.msdn.com/artleo/archive/2005/09/19/471497.aspx"&gt;NAant
to automate the build with csc.exe &amp;amp; vbc.exe is suboptimal&lt;/a&gt;.&amp;nbsp; I'm keeping
my project to one small assembly that depends on the PIAs, and also depends on another
assembly that does the heavy lifting but has no ref to the PIA's. 
&lt;li&gt;
Strong Name everything.&amp;nbsp; Well, strong name everything anyway, but when trying
to pass of managed code as COM it is essential. 
&lt;li&gt;
You cannot load a .NET DLL, even one with the &lt;font face="Courier New"&gt;ComVisibleAttribute&lt;/font&gt; on
the Assembly or Classes, via the Office UI.&amp;nbsp; You just can't.&amp;nbsp; &lt;a href="http://support.microsoft.com/kb/316723"&gt;KB316723
gives an explanation&lt;/a&gt;.&amp;nbsp; This is because Office will try and register it the
old&lt;font face="Courier New"&gt; regsvr32&lt;/font&gt; way, which of course won't work.&amp;nbsp;
To get a .NET DLL into the Macros -&amp;gt; Add-Ins list,&amp;nbsp;&lt;strong&gt;you must write
the registry entry&lt;/strong&gt; under: &lt;font face="Courier New" color=#000000&gt;HKEY_CURRENT_USER\Software\Microsoft\&lt;em&gt;&amp;lt;office
program name&amp;gt;&lt;/em&gt;\Addins\&lt;/font&gt; 
&lt;li&gt;
This brings me to my next point.&amp;nbsp; &lt;a href="http://support.microsoft.com/kb/316723"&gt;KB316723&lt;/a&gt; hints
at it, but&amp;nbsp;your setup must write a HKCU key not a HKLM key.&amp;nbsp; &lt;strong&gt;The
Shared Add-In Wizard&lt;/strong&gt; in Studio is ambiguous when it shows you this choice:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;img src="http://deepdark.net/content/binary/20070529_4of5.jpg" border=0&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
I know this may be contentious, but consider using VB.NET over C#.&amp;nbsp; This depends
of course, but some parts of the Office object model make heavy use of Optional Parameters
which &lt;a href="http://msdn2.microsoft.com/en-us/library/aa192488(office.11).aspx"&gt;C#
does not support&lt;/a&gt;.&amp;nbsp;&amp;nbsp;It has been &lt;a href="http://msmvps.com/blogs/bill/archive/2006/03/28/88259.aspx"&gt;noted
elsewhere what Type.Missing&amp;nbsp;can do for readability&lt;/a&gt;.&amp;nbsp; Having said that,
it does vary greatly depending on where in the Office Object Model you are. 
&lt;li&gt;
Spend some time with the Setup project that the Shared Add-In Wizard makes and test
it.&amp;nbsp; Once you like it, reverse engineer it to a WiX script and feed that to your
automated build.&amp;nbsp; For the record, you do that with: 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;font face="Courier New" color=#000000&gt;Dark.exe –x path Debug/msi My.wxs 
&lt;br&gt;
Candle My.wxs 
&lt;br&gt;
Light My.Wixobj &lt;/font&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
To extra points when dealing with WiX-ified MSI's 
&lt;ol&gt;
&lt;li&gt;
It's useful to note that the extracted (&lt;font face="Courier New"&gt;-x&lt;/font&gt;) resources&amp;nbsp;take
many forms.&amp;nbsp;&lt;font face="Courier New"&gt; DefBannerBitmap.ibd&lt;/font&gt; for example
is just a bitmap.&amp;nbsp; I think it is easier to rename it to .bmp &amp;amp; tweak it in
Photoshop than to add a new banner in Visual Studio. 
&lt;li&gt;
The Add-in reg setting mentioned in point #4 above references an assembly version.&amp;nbsp;
Visual Studio tweeks this for you but your WiX script will be frozen at the time your &lt;font face="Courier New"&gt;Dark.exe'd&lt;/font&gt; it.&amp;nbsp;
So don't auto-increment your assembly version numbers, or tweak you WiX script.&amp;nbsp;
The choice is yours but your MSI must write the version of the Add-In DLL to the target
machine's registry.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;font color=#808080&gt;&lt;strong&gt;Listening To: Leftfield, Leftism&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;</description>
      <comments>http://deepdark.net/CommentView,guid,b77aac01-fdec-4e60-984e-192722f69b41.aspx</comments>
      <category>C#</category>
      <category>Continuous-Integration</category>
      <category>Geeking Out!</category>
      <category>WiX</category>
    </item>
    <item>
      <trackback:ping>http://deepdark.net/Trackback.aspx?guid=a208ab20-931b-4f15-b74e-577177b8bdf7</trackback:ping>
      <pingback:server>http://deepdark.net/pingback.aspx</pingback:server>
      <pingback:target>http://deepdark.net/PermaLink,guid,a208ab20-931b-4f15-b74e-577177b8bdf7.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://deepdark.net/CommentView,guid,a208ab20-931b-4f15-b74e-577177b8bdf7.aspx</wfw:comment>
      <wfw:commentRss>http://deepdark.net/SyndicationService.asmx/GetEntryCommentsRss?guid=a208ab20-931b-4f15-b74e-577177b8bdf7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            </span>
            <font color="#000000">
              <font face="Verdana">So
I feel that <a href="http://deepdark.net/PermaLink,guid,56e30a60-fd97-4d42-aa54-323c3e296187.aspx">my
last post on pretty gray info bars in Photoshop</a> could do with a second chapter
:)</font>
            </font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana">This
is a pretty long series so I'll be breif - what follows is the rough outline of how
to achieve the same result as a User Control in your Visual Studio project. 
The advantage of this aproach would be to allow you to dymanically add text or other
sparkle of your own creation :-)</font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          </span>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana">Here's
a sample:</font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana">
              <img src="http://deepdark.net/content/binary/20070327_2ndBars.jpg" border="0" />
            </font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana">Code
follows :-)</font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">namespace</span> GrayBar<br />
{<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">   public</span> partial <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span><font color="#000080">GrayBar</font> : <font color="#000080">UserControl<br /></font>   {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">enum</span><font color="#000080"><font color="#800080">GrayBarModes</font><br /></font>      {<br />
         GreenTick <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 0,<br />
         YellowBang <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 1,<br />
         RedX <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 2<br />
      }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span> GrayBar()<br />
      {<br />
         InitializeComponent();<br />
      }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      protected</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">override</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> OnPaint(PaintEventArgs
e)<br />
      {<br />
         <font color="#000080">Graphics</font> g <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>.CreateGraphics();<br />
         g.SmoothingMode <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><font color="#800080">SmoothingMode</font>.HighQuality;<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         //
Fill the whole canvas</span><br />
         <font color="#000080">Rectangle</font> wholeControlSpace <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">Rectangle</font>(0,
0, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>.Width, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>.Height);<br />
         <font color="#000080">Brush</font> controlFiller <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">LinearGradientBrush</font>(wholeControlSpace, <font color="#800080">Color</font>.DarkGray, <font color="#800080">Color</font>.LightGray,
LinearGradientMode.Vertical);<br />
         g.FillRectangle(controlFiller,
wholeControlSpace);<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         //
Make icon in corner</span><br />
         <font color="#000080">Rectangle</font> iconSpace <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">Rectangle</font>(1,
1, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>.Height <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">-</span> 2, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>.Height <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">-</span> 2);<br />
         <font color="#000080">Brush</font> iconFiller <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">LinearGradientBrush</font>(iconSpace, <font color="#800080">Color</font>.Gray, <font color="#800080">Color</font>.DarkGray, <font color="#800080">LinearGradientMode</font>.Vertical);<br />
         g.FillEllipse(iconFiller, iconSpace);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         base</span>.OnPaint(e);<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"> </span>        <font color="#000080">Font</font> iconFont <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">Font</font>(<font color="#800080">FontFamily</font>.GenericSansSerif,
12, <font color="#800080">FontStyle</font>.Regular);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         string</span> iconText <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">""</span>;<br />
         <font color="#000080">Brush</font> iconTextBrush <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">SolidBrush</font>(<font color="#800080">Color</font>.NavajoWhite);<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         float</span> fontHight <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">this</span>.Height; <br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         //
The Font, Text and Colour depends on the setting on our GrayBarMode property</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         switch</span> (GrayBarMode)<br />
         {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            case</span><font color="#000080">GrayBarModes</font>.GreenTick:<br />
               iconFont <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">Font</font>(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Wingdings
2"</span>, fontHight, <font color="#800080">GraphicsUnit</font>.Pixel);<br />
               iconText <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"P"</span>; <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//
P == "tick" in "Wingdings 2"</span><br />
               iconTextBrush <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">LinearGradientBrush</font>(iconSpace, <font color="#800080">Color</font>.DarkGreen, <font color="#800080">Color</font>.LightGreen, <font color="#800080">LinearGradientMode</font>.Vertical);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">               break</span>;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            case</span><font color="#000080">GrayBarModes</font>.YellowBang:<br />
               iconFont <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">Font</font>(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Arial"</span>,
fontHight, <font color="#800080">FontStyle</font>.Bold, <font color="#800080">GraphicsUnit</font>.Pixel);<br />
               iconText <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"!"</span>; <br />
               iconTextBrush <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">LinearGradientBrush</font>(iconSpace, <font color="#800080">Color</font>.Orange, <font color="#800080">Color</font>.Yellow, <font color="#800080">LinearGradientMode</font>.Vertical);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">               break</span>;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            case</span><font color="#000080">GrayBarModes</font>.RedX:<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">               </span>iconFont <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">Font</font>(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Arial"</span>,
fontHight, <font color="#800080">FontStyle</font>.Bold, <font color="#800080">GraphicsUnit</font>.Pixel);<br />
               iconText <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"X"</span>; <br />
               iconTextBrush <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span><font color="#000080">LinearGradientBrush</font>(iconSpace, <font color="#800080">Color</font>.Maroon, <font color="#800080">Color</font>.Red, <font color="#800080">LinearGradientMode</font>.Vertical);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">               break</span>;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            default</span>:<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">               throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> ApplicationException(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Unknow
Mode"</span>);<br />
         }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         float</span> iconTextXPos <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> (iconSpace.Width <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">/</span> 2) <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">-</span> (iconFont.GetHeight(g) <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">/</span> 4);<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         float</span> iconTextYPos <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> (iconSpace.Height <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">/</span> 2) <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">-</span> (iconFont.GetHeight(g) <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">/</span> 2);<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">         </span>g.DrawString(iconText,
iconFont, iconTextBrush, iconTextXPos, iconTextYPos);<br /><br />
      }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><font color="#800080">GrayBarModes</font> _GrayBarMode <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><font color="#800080">GrayBarModes</font>.GreenTick;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span><font color="#800080">GrayBarModes</font> GrayBarMode<br />
      {<br />
         get<br />
         {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            return</span> _GrayBarMode;<br />
         }<br />
         set<br />
         {<br />
            _GrayBarMode <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> value;<br />
         }<br />
      }<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> _MessageText;<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">      public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">string</span> MessageText<br />
      {<br />
         get<br />
         {<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">            return</span> _MessageText;<br />
         }<br />
         set<br />
         {<br />
            _MessageText <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> value;<br />
         }<br />
      }<br /><br />
   }<br />
}<br /></span>
        </p>
      </body>
      <title>UX: Pretty bars are easy, just add gradient - Part II: Managed code</title>
      <guid isPermaLink="false">http://deepdark.net/PermaLink,guid,a208ab20-931b-4f15-b74e-577177b8bdf7.aspx</guid>
      <link>http://deepdark.net/PermaLink,guid,a208ab20-931b-4f15-b74e-577177b8bdf7.aspx</link>
      <pubDate>Mon, 26 Mar 2007 11:26:02 GMT</pubDate>
      <description>&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;/span&gt;&lt;font color=#000000&gt;&lt;font face=Verdana&gt;So
I feel that &lt;a href="http://deepdark.net/PermaLink,guid,56e30a60-fd97-4d42-aa54-323c3e296187.aspx"&gt;my
last post&amp;nbsp;on pretty gray info bars in Photoshop&lt;/a&gt; could do with a second chapter
:)&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana&gt;This
is a pretty long series so I'll be breif - what follows is the rough outline of how
to achieve the same&amp;nbsp;result as a User Control in&amp;nbsp;your Visual Studio project.&amp;nbsp;
The advantage of this aproach would be to allow you to dymanically add text or other
sparkle of your own creation :-)&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana&gt;Here's
a sample:&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana&gt;&lt;img src="http://deepdark.net/content/binary/20070327_2ndBars.jpg" border=0&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;font face=Verdana&gt;Code
follows :-)&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;namespace&lt;/span&gt; GrayBar&lt;br&gt;
{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; partial &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; &lt;font color=#000080&gt;GrayBar&lt;/font&gt; : &lt;font color=#000080&gt;UserControl&lt;br&gt;
&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;enum&lt;/span&gt; &lt;font color=#000080&gt;&lt;font color=#800080&gt;GrayBarModes&lt;/font&gt;
&lt;br&gt;
&lt;/font&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;GreenTick &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; 0,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;YellowBang &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; 1,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RedX &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; 2&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; GrayBar()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;InitializeComponent();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;protected&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;override&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; OnPaint(PaintEventArgs
e)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#000080&gt;Graphics&lt;/font&gt; g &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;.CreateGraphics();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;g.SmoothingMode &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;font color=#800080&gt;SmoothingMode&lt;/font&gt;.HighQuality;&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
Fill the whole canvas&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#000080&gt;Rectangle&lt;/font&gt; wholeControlSpace &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;Rectangle&lt;/font&gt;(0,
0, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;.Width, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;.Height);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#000080&gt;Brush&lt;/font&gt; controlFiller &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;LinearGradientBrush&lt;/font&gt;(wholeControlSpace, &lt;font color=#800080&gt;Color&lt;/font&gt;.DarkGray, &lt;font color=#800080&gt;Color&lt;/font&gt;.LightGray,
LinearGradientMode.Vertical);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;g.FillRectangle(controlFiller,
wholeControlSpace);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
Make icon in corner&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#000080&gt;Rectangle&lt;/font&gt; iconSpace &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;Rectangle&lt;/font&gt;(1,
1, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;.Height &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;-&lt;/span&gt; 2, &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;.Height &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;-&lt;/span&gt; 2);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#000080&gt;Brush&lt;/font&gt; iconFiller &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;LinearGradientBrush&lt;/font&gt;(iconSpace, &lt;font color=#800080&gt;Color&lt;/font&gt;.Gray, &lt;font color=#800080&gt;Color&lt;/font&gt;.DarkGray, &lt;font color=#800080&gt;LinearGradientMode&lt;/font&gt;.Vertical);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;g.FillEllipse(iconFiller, iconSpace);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;base&lt;/span&gt;.OnPaint(e);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#000080&gt;Font&lt;/font&gt; iconFont &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;Font&lt;/font&gt;(&lt;font color=#800080&gt;FontFamily&lt;/font&gt;.GenericSansSerif,
12, &lt;font color=#800080&gt;FontStyle&lt;/font&gt;.Regular);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;string&lt;/span&gt; iconText &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;""&lt;/span&gt;;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#000080&gt;Brush&lt;/font&gt; iconTextBrush &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;SolidBrush&lt;/font&gt;(&lt;font color=#800080&gt;Color&lt;/font&gt;.NavajoWhite);&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;float&lt;/span&gt; fontHight &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;this&lt;/span&gt;.Height;&amp;nbsp;&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//
The Font, Text and Colour depends on the setting on our GrayBarMode property&lt;/span&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switch&lt;/span&gt; (GrayBarMode)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&lt;/span&gt; &lt;font color=#000080&gt;GrayBarModes&lt;/font&gt;.GreenTick:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iconFont &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;Font&lt;/font&gt;(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Wingdings
2"&lt;/span&gt;, fontHight, &lt;font color=#800080&gt;GraphicsUnit&lt;/font&gt;.Pixel);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iconText &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"P"&lt;/span&gt;; &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//
P == "tick" in "Wingdings 2"&lt;/span&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iconTextBrush &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;LinearGradientBrush&lt;/font&gt;(iconSpace, &lt;font color=#800080&gt;Color&lt;/font&gt;.DarkGreen, &lt;font color=#800080&gt;Color&lt;/font&gt;.LightGreen,&amp;nbsp;&lt;font color=#800080&gt;LinearGradientMode&lt;/font&gt;.Vertical);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break&lt;/span&gt;;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&lt;/span&gt; &lt;font color=#000080&gt;GrayBarModes&lt;/font&gt;.YellowBang:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iconFont &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;Font&lt;/font&gt;(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Arial"&lt;/span&gt;,
fontHight, &lt;font color=#800080&gt;FontStyle&lt;/font&gt;.Bold, &lt;font color=#800080&gt;GraphicsUnit&lt;/font&gt;.Pixel);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iconText &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"!"&lt;/span&gt;;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iconTextBrush &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;LinearGradientBrush&lt;/font&gt;(iconSpace, &lt;font color=#800080&gt;Color&lt;/font&gt;.Orange, &lt;font color=#800080&gt;Color&lt;/font&gt;.Yellow, &lt;font color=#800080&gt;LinearGradientMode&lt;/font&gt;.Vertical);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break&lt;/span&gt;;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&lt;/span&gt; &lt;font color=#000080&gt;GrayBarModes&lt;/font&gt;.RedX:&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;iconFont &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;Font&lt;/font&gt;(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Arial"&lt;/span&gt;,
fontHight, &lt;font color=#800080&gt;FontStyle&lt;/font&gt;.Bold, &lt;font color=#800080&gt;GraphicsUnit&lt;/font&gt;.Pixel);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iconText &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"X"&lt;/span&gt;;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iconTextBrush &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; &lt;font color=#000080&gt;LinearGradientBrush&lt;/font&gt;(iconSpace, &lt;font color=#800080&gt;Color&lt;/font&gt;.Maroon, &lt;font color=#800080&gt;Color&lt;/font&gt;.Red, &lt;font color=#800080&gt;LinearGradientMode&lt;/font&gt;.Vertical);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break&lt;/span&gt;;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default&lt;/span&gt;:&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; ApplicationException(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"Unknow
Mode"&lt;/span&gt;);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;float&lt;/span&gt; iconTextXPos &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; (iconSpace.Width &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;/&lt;/span&gt; 2) &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;-&lt;/span&gt; (iconFont.GetHeight(g) &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;/&lt;/span&gt; 4);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;float&lt;/span&gt; iconTextYPos &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; (iconSpace.Height &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;/&lt;/span&gt; 2) &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;-&lt;/span&gt; (iconFont.GetHeight(g) &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;/&lt;/span&gt; 2);&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;g.DrawString(iconText,
iconFont, iconTextBrush, iconTextXPos, iconTextYPos);&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/span&gt; &lt;font color=#800080&gt;GrayBarModes&lt;/font&gt; _GrayBarMode &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;font color=#800080&gt;GrayBarModes&lt;/font&gt;.GreenTick;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;font color=#800080&gt;GrayBarModes&lt;/font&gt; GrayBarMode&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/span&gt; _GrayBarMode;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_GrayBarMode &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; value;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; _MessageText;&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;string&lt;/span&gt; MessageText&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/span&gt; _MessageText;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_MessageText &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; value;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}&lt;br&gt;
&lt;/p&gt;
&gt;</description>
      <comments>http://deepdark.net/CommentView,guid,a208ab20-931b-4f15-b74e-577177b8bdf7.aspx</comments>
      <category>C#</category>
      <category>Geeking Out!</category>
      <category>UX</category>
    </item>
    <item>
      <trackback:ping>http://deepdark.net/Trackback.aspx?guid=171c7adf-7239-4698-af28-451d732d5f0a</trackback:ping>
      <pingback:server>http://deepdark.net/pingback.aspx</pingback:server>
      <pingback:target>http://deepdark.net/PermaLink,guid,171c7adf-7239-4698-af28-451d732d5f0a.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://deepdark.net/CommentView,guid,171c7adf-7239-4698-af28-451d732d5f0a.aspx</wfw:comment>
      <wfw:commentRss>http://deepdark.net/SyndicationService.asmx/GetEntryCommentsRss?guid=171c7adf-7239-4698-af28-451d732d5f0a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">...snipped from a discussion earlier today
with <a href="http://msmvps.com/blogs/brianmadsen/Default.aspx">someone </a>who <a href="http://csharpzealot.com/">should
know about C#</a>!<br /><br />
btw, I found one conclusive reason as why to use C# over VB.Net when doing unit tests
with NMock<br />
in C# the line is:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">Expect.Once.On(mockFetcher).Method(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"GetDatabases"</span>).Will(Return.Value(mockReturnValue));</span></p>
in VB it is:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">Expect.Once.<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">On</span>(mockFetcher).Method(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"GetDatabases"</span>).Will(NMock2.<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">Return</span>.Value(mockReturnValue))</span></p>
Return is a <a href="http://nmock.org/">NMock2</a> type as well as (with caps) a VB
reserved word!  so you have to add a qualifier. 
<br /><br />
taking into consideration the semicolon that's 6 extra keystrokes!<br /><p></p></body>
      <title>It's Friday:  C# is better than VB.Net</title>
      <guid isPermaLink="false">http://deepdark.net/PermaLink,guid,171c7adf-7239-4698-af28-451d732d5f0a.aspx</guid>
      <link>http://deepdark.net/PermaLink,guid,171c7adf-7239-4698-af28-451d732d5f0a.aspx</link>
      <pubDate>Fri, 16 Mar 2007 06:23:05 GMT</pubDate>
      <description>...snipped from a discussion earlier today with &lt;a href="http://msmvps.com/blogs/brianmadsen/Default.aspx"&gt;someone &lt;/a&gt;who &lt;a href="http://csharpzealot.com/"&gt;should
know about C#&lt;/a&gt;!&lt;br&gt;
&lt;br&gt;
btw, I found one conclusive reason as why to use C# over VB.Net when doing unit tests
with NMock&lt;br&gt;
in C# the line is:&lt;br&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;Expect.Once.On(mockFetcher).Method(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"GetDatabases"&lt;/span&gt;).Will(Return.Value(mockReturnValue));&lt;/span&gt;
&lt;/p&gt;
in VB it is:&lt;br&gt;
&lt;p&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;Expect.Once.&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;On&lt;/span&gt;(mockFetcher).Method(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"GetDatabases"&lt;/span&gt;).Will(NMock2.&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;Return&lt;/span&gt;.Value(mockReturnValue))&lt;/span&gt;
&lt;/p&gt;
Return is a &lt;a href="http://nmock.org/"&gt;NMock2&lt;/a&gt; type as well as (with caps) a VB
reserved word!&amp;nbsp; so you have to add a qualifier. 
&lt;br&gt;
&lt;br&gt;
taking into consideration the semicolon that's 6 extra keystrokes!&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;</description>
      <comments>http://deepdark.net/CommentView,guid,171c7adf-7239-4698-af28-451d732d5f0a.aspx</comments>
      <category>C#</category>
      <category>Geeking Out!</category>
    </item>
    <item>
      <trackback:ping>http://deepdark.net/Trackback.aspx?guid=135156b9-3b5e-491c-9d8c-29b74d492e2c</trackback:ping>
      <pingback:server>http://deepdark.net/pingback.aspx</pingback:server>
      <pingback:target>http://deepdark.net/PermaLink,guid,135156b9-3b5e-491c-9d8c-29b74d492e2c.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://deepdark.net/CommentView,guid,135156b9-3b5e-491c-9d8c-29b74d492e2c.aspx</wfw:comment>
      <wfw:commentRss>http://deepdark.net/SyndicationService.asmx/GetEntryCommentsRss?guid=135156b9-3b5e-491c-9d8c-29b74d492e2c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just a follow-up on <a href="http://deepdark.net/PermaLink,guid,68e12777-ada0-4226-b10b-c37a9bde6aa2.aspx">my
post of yesterday</a> about the intent of exposing a read-write property of an
Array/Collection type.
</p>
        <p>
          <em>Practical Guidelines and Best Practices </em>has the following guidance (i'm paraphrasing)
</p>
        <p>
          <strong>13.13 </strong>To protect the state of a backing var for properties that return
arrays, consider 
</p>
        <p>
          <font face="Courier New">get { <font color="#0000ff">return DirectCast</font>(_arr.Clone(), <font color="#0000ff">string</font>());
}</font>
        </p>
        <p>
which is good protection, but less efficient.  Or, provide indexed access to
the array by an indexed property or function.  <strong><em>Getting close...</em></strong></p>
        <p>
          <strong>13.14 </strong>Properties that return a collection should be read-only to
prevent clients replacing the whole array with a new one, or with a null reference
as that could break assumptions elsewhere in the class. <strong><em>Disco!  </em></strong></p>
        <p>
Thanks lads!
</p>
      </body>
      <title>Properties that expose arrays, best practices - Francesco &amp; Giuseppe have spoken!</title>
      <guid isPermaLink="false">http://deepdark.net/PermaLink,guid,135156b9-3b5e-491c-9d8c-29b74d492e2c.aspx</guid>
      <link>http://deepdark.net/PermaLink,guid,135156b9-3b5e-491c-9d8c-29b74d492e2c.aspx</link>
      <pubDate>Mon, 26 Feb 2007 21:53:36 GMT</pubDate>
      <description>&lt;p&gt;
Just a follow-up on &lt;a href="http://deepdark.net/PermaLink,guid,68e12777-ada0-4226-b10b-c37a9bde6aa2.aspx"&gt;my
post of yesterday&lt;/a&gt;&amp;nbsp;about the intent of exposing a read-write property of an
Array/Collection type.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Practical Guidelines and Best Practices &lt;/em&gt;has the following guidance (i'm paraphrasing)
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;13.13 &lt;/strong&gt;To protect the state of a backing var for properties that return
arrays, consider 
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;get { &lt;font color=#0000ff&gt;return DirectCast&lt;/font&gt;(_arr.Clone(), &lt;font color=#0000ff&gt;string&lt;/font&gt;());
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
which is good protection, but less efficient.&amp;nbsp; Or, provide indexed access to
the array by an indexed property or function.&amp;nbsp; &lt;strong&gt;&lt;em&gt;Getting close...&lt;/em&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;13.14 &lt;/strong&gt;Properties that return a collection should be read-only to
prevent clients replacing the whole array with a new one, or with a null reference
as that could break assumptions elsewhere in the class. &lt;strong&gt;&lt;em&gt;Disco!&amp;nbsp; &lt;/em&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Thanks lads!
&lt;/p&gt;</description>
      <comments>http://deepdark.net/CommentView,guid,135156b9-3b5e-491c-9d8c-29b74d492e2c.aspx</comments>
      <category>C#</category>
      <category>Geeking Out!</category>
    </item>
    <item>
      <trackback:ping>http://deepdark.net/Trackback.aspx?guid=68e12777-ada0-4226-b10b-c37a9bde6aa2</trackback:ping>
      <pingback:server>http://deepdark.net/pingback.aspx</pingback:server>
      <pingback:target>http://deepdark.net/PermaLink,guid,68e12777-ada0-4226-b10b-c37a9bde6aa2.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://deepdark.net/CommentView,guid,68e12777-ada0-4226-b10b-c37a9bde6aa2.aspx</wfw:comment>
      <wfw:commentRss>http://deepdark.net/SyndicationService.asmx/GetEntryCommentsRss?guid=68e12777-ada0-4226-b10b-c37a9bde6aa2</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This one came up in discussion last week and could be worth mentioning.
</p>
        <p>
Consider the following property:
</p>
        <p>
          <font face="Courier New">
            <font color="#000080">private </font>
            <font color="#0000ff">List</font>&lt;<font color="#0000ff">SchemaAttribute</font>&gt;
_attributes = <font color="#000080">new</font><font color="#0000ff">List</font>&lt;<font color="#0000ff">SchemaAttribute</font>&gt;();<br /><font color="#000080">public</font><font color="#0000ff">List</font>&lt;<font color="#0000ff">SchemaAttribute</font>&gt;
Attributes<br />
{<br />
   <font color="#000080">get</font><br />
   {<br />
      <font color="#000080">return</font> _attributes;<br />
   }<br />
   <font color="#000080">set</font><br />
   {<br />
      _attributes = <font color="#000080">value</font>;<br />
   }<br />
}</font>
        </p>
        <p>
          <a href="http://ncover.org/">NCover</a>/<a href="http://www.kiwidude.com/dotnet/NCoverExplorerFAQ.html">NCoverExplorer</a> reliably
inform me that this property has only 50% coverage<br />
in my tests.
</p>
        <p>
By hereto unexplored forces of nature, every consumer of this class calls<br /><font face="Courier New">.Attributes.Add()</font></p>
        <p>
or, itterates over it as so:<br /><font face="Courier New"><font color="#000080">foreach</font> (<font color="#0000ff">SchemaAttribute</font> element <font color="#000080">in</font> instance.Attributes)<br />
{<br />
   <font color="#006400">// ...</font><br />
}</font></p>
        <p>
The keen eye will notice that neither of these ways to access the property actually
hit the setter!  
</p>
        <p>
Two possible paths present themselves:
</p>
        <ol>
          <li>
            <strong>Write a test that just exercises the setter</strong>.  This seems to
me pointless.  
<br />
If we are to consider that our tests can serve to express our intention<br />
in a repeatable fashion, what is our intent?  To see if a Generic List still
works? 
</li>
          <li>
            <strong>Consider makeing the property read-only.</strong>  Including braces I
could own three lines less code.  Yay!<br />
And also now I have had cause to think about it, it's not my intention that the<br />
List be set as a list, for this class it just dosen't make sense right now.</li>
        </ol>
        <p>
Next step?  Consult <a href="http://www.microsoft.com/mspress/books/8198.aspx">Francesco
&amp; Giuseppe</a>!
</p>
        <p>
          <em>Sleep.  The best 10 hours of the week.</em>
        </p>
        <p>
Listening to:  Nick Cave and the Bad Seeds - Abattoir Blues
</p>
      </body>
      <title>Intent insurance?  Have you got coverage?</title>
      <guid isPermaLink="false">http://deepdark.net/PermaLink,guid,68e12777-ada0-4226-b10b-c37a9bde6aa2.aspx</guid>
      <link>http://deepdark.net/PermaLink,guid,68e12777-ada0-4226-b10b-c37a9bde6aa2.aspx</link>
      <pubDate>Mon, 26 Feb 2007 03:02:40 GMT</pubDate>
      <description>&lt;p&gt;
This one came up in discussion last week and could be worth mentioning.
&lt;/p&gt;
&lt;p&gt;
Consider the following property:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&lt;font color=#000080&gt;private &lt;/font&gt;&lt;font color=#0000ff&gt;List&lt;/font&gt;&amp;lt;&lt;font color=#0000ff&gt;SchemaAttribute&lt;/font&gt;&amp;gt;
_attributes = &lt;font color=#000080&gt;new&lt;/font&gt; &lt;font color=#0000ff&gt;List&lt;/font&gt;&amp;lt;&lt;font color=#0000ff&gt;SchemaAttribute&lt;/font&gt;&amp;gt;();&lt;br&gt;
&lt;font color=#000080&gt;public&lt;/font&gt; &lt;font color=#0000ff&gt;List&lt;/font&gt;&amp;lt;&lt;font color=#0000ff&gt;SchemaAttribute&lt;/font&gt;&amp;gt;
Attributes&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#000080&gt;get&lt;/font&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#000080&gt;return&lt;/font&gt; _attributes;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#000080&gt;set&lt;/font&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_attributes = &lt;font color=#000080&gt;value&lt;/font&gt;;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://ncover.org/"&gt;NCover&lt;/a&gt;/&lt;a href="http://www.kiwidude.com/dotnet/NCoverExplorerFAQ.html"&gt;NCoverExplorer&lt;/a&gt; reliably
inform me that this property has only 50% coverage&lt;br&gt;
in my tests.
&lt;/p&gt;
&lt;p&gt;
By hereto unexplored forces of nature, every consumer of this class calls&lt;br&gt;
&lt;font face="Courier New"&gt;.Attributes.Add()&lt;/font&gt; 
&lt;/p&gt;
&lt;p&gt;
or, itterates over it as so:&lt;br&gt;
&lt;font face="Courier New"&gt;&lt;font color=#000080&gt;foreach&lt;/font&gt; (&lt;font color=#0000ff&gt;SchemaAttribute&lt;/font&gt; element &lt;font color=#000080&gt;in&lt;/font&gt; instance.Attributes)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color=#006400&gt;// ...&lt;/font&gt;
&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
The keen eye will notice that neither of these ways to access the property actually
hit the setter!&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Two possible paths present themselves:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Write a test that just exercises the setter&lt;/strong&gt;.&amp;nbsp; This seems to
me pointless.&amp;nbsp; 
&lt;br&gt;
If we are to consider that our tests can serve to express our intention&lt;br&gt;
in a repeatable fashion, what is our intent?&amp;nbsp; To see if a Generic List still
works? 
&lt;li&gt;
&lt;strong&gt;Consider makeing the property read-only.&lt;/strong&gt;&amp;nbsp; Including braces I
could own three lines less code.&amp;nbsp; Yay!&lt;br&gt;
And also now I have had cause to think about it, it's not my intention that the&lt;br&gt;
List be set as a list, for this class it just dosen't make sense right now.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Next step?&amp;nbsp; Consult &lt;a href="http://www.microsoft.com/mspress/books/8198.aspx"&gt;Francesco
&amp;amp; Giuseppe&lt;/a&gt;!
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Sleep.&amp;nbsp; The best 10 hours of the week.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
Listening to:&amp;nbsp; Nick Cave and the Bad Seeds - Abattoir Blues
&lt;/p&gt;</description>
      <comments>http://deepdark.net/CommentView,guid,68e12777-ada0-4226-b10b-c37a9bde6aa2.aspx</comments>
      <category>Continuous-Integration</category>
      <category>Geeking Out!</category>
      <category>C#</category>
    </item>
  </channel>
</rss>