<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8684086013521169566</id><updated>2012-02-08T13:57:09.598-08:00</updated><category term='Windows Phone'/><category term='Interop'/><category term='Random'/><category term='MOSS'/><category term='ADFS'/><category term='Azure Marketplace'/><category term='WPF'/><category term='Azure ACS'/><category term='TFS'/><category term='Silverlight'/><category term='Utilities'/><title type='text'>Toad's Code</title><subtitle type='html'>Ramblings of a toad on code.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-1909678424890331598</id><published>2011-11-30T09:10:00.001-08:00</published><updated>2011-11-30T09:10:41.933-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Azure ACS'/><title type='text'>MVC 3 and Azure ACS–Protect parts of the site</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you have worked with ADFS 2.0 or other claims based security models Azure’s Access Control Service (ACS) should not seem all the new to you. It is basically Azure’s hosted Secure Token Service (STS). &lt;/p&gt;  &lt;p&gt;Recently I have been building an MVC 3 application and did not want my application to be forums protected. My personal opinion is that no one wants to create one off logins on the web anymore. To solve this I decided to use MVC 3 with ACS. Adding ACS to your MVC 3 project is not very hard and is explained in a few blogs on the net (&lt;a href="http://blogs.southworks.net/mwoloski/2011/04/12/adding-internet-identity-providers-like-facebook-google-liveid-and-yahoo-to-your-mvc-web-application-using-windows-azure-appfabric-access-control-service-and-jquery-in-3-steps/" target="_blank"&gt;here is a good one&lt;/a&gt;). You basically just use Visual Studio’s “Add STS” functional like you would for any other STS. &lt;/p&gt;  &lt;p&gt;When you add the STS to your project it updates your web.config with information it needs for federation to work. By default it protects your entire website. This means you cannot even hit the login page without signing in. But what if I want unauthenticated people to read parts of my website, like the homepage? Well this is what I had to figure out. In the end it is pretty simple but given my newness to MVC and experience with using ADFS to protect WCF services I went down the wrong direction for awhile. &lt;/p&gt;  &lt;p&gt;Your web.config is updated by the STS fedutil with the following information. &lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;location&lt;/span&gt; &lt;span class="attr"&gt;path&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;FederationMetadata&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;authorization&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;allow&lt;/span&gt; &lt;span class="attr"&gt;users&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;*&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;authorization&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;location&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;authorization&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;deny&lt;/span&gt; &lt;span class="attr"&gt;users&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;?&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;authorization&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;This does two things. 1) It tells the website not to protect the path to the federationmetadata. This allows the STS to get the information it needs. 2) It tells the site to deny access to all unauthenticated users (&amp;lt;deny users=”?”&amp;gt;). Since that node is not inside a location node that directive applies to the entire site, minus any location node directives. &lt;/p&gt;

&lt;p&gt;Now if you want to unprotect certain areas of your site you might think you can just use some additional location nodes. Well this will send you down the wrong path with MVC. With a standard ASP.net or WCF app this could work but MVC adds a framework that causes this so it doesn’t work very well. In &lt;a href="http://www.pluralsight-training.net/microsoft/players/PSODPlayer.aspx?author=scott-allen&amp;amp;name=mvc3-building-security&amp;amp;mode=live&amp;amp;clip=0&amp;amp;course=aspdotnet-mvc3-intro" target="_blank"&gt;MVC 3 authorization&lt;/a&gt; is handled via the “authorize” attribute added to methods in controls or the controller class. In order to make sure you don’t open security holes this is really where you want to keep that control. If you add this attribute to a controller method, and it fails, the requests will fall into the Windows Identity Framework pipeline. The user will then be pushed to authenticate, &lt;strong&gt;&lt;u&gt;IF&lt;/u&gt;&lt;/strong&gt;, you change your config file a little. &lt;/p&gt;

&lt;p&gt;Since the fedutil setup your web.config file to protect your entire site the website configuration will pick up the authorization requirement before it gets to any controller actions. So we need to change our web.config so it is not protecting anything. Update your web.config so it looks like the following:&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;location&lt;/span&gt; &lt;span class="attr"&gt;path&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;FederationMetadata&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;authorization&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;allow&lt;/span&gt; &lt;span class="attr"&gt;users&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;*&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;authorization&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;location&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;All we did was remove the authorization deny nodes from the web.config. This now opens up your entire site so nothing is protected by ACS. To start locking down your site you need to go into each of your controllers and start applying the Authorize attribute. For each method that has this attribute applied the site will fail over to your ACS (via the WIF pipeline) and request the user to login (unless of course they are already logged in). &lt;/p&gt;

&lt;p&gt;Here is what a HomeController might look like:&lt;/p&gt;

&lt;pre class="csharpcode"&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; HomeController : Controller
    {
        &lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult Index()
        {
            ViewBag.Message = &lt;span class="str"&gt;&amp;quot;Welcome to MVC 3!!&amp;quot;&lt;/span&gt;;

            &lt;span class="kwrd"&gt;return&lt;/span&gt; View();
        }

        [Authorize]
        &lt;span class="kwrd"&gt;public&lt;/span&gt; ActionResult About()
        {
            &lt;span class="kwrd"&gt;return&lt;/span&gt; View();
        }
    }&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Notice how the About method has the authorize attribute. Now when this method is called (in the standard MVC 3 default template this is called via clicking on the about link in the navigation) the user will be directed to login if they have not already. &lt;/p&gt;

&lt;p&gt;You can also apply the attribute to the entire controller if everything should be projected. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-1909678424890331598?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/1909678424890331598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=1909678424890331598' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/1909678424890331598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/1909678424890331598'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2011/11/mvc-3-and-azure-acsprotect-parts-of.html' title='MVC 3 and Azure ACS–Protect parts of the site'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-5589190988526624647</id><published>2011-11-12T11:12:00.001-08:00</published><updated>2011-11-12T11:12:35.450-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Phone'/><title type='text'>Windows Phone and HTTPS service calls</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you have been working with Windows Phone and trying to make HTTPS based calls to other services there are a couple things you will want to know. Since these HTTPS calls happen over a secure connection there are a few nuances you have to be aware of. Windows Phone is pretty touchy about HTTPS certificates. Normally on a web page you can just create a self-signed cert and either bypass the cert trust warning or install the cert in to the machines trusted CA list. However, Windows Phone does not have this flexibility. During development or test you probably are using a self-signed cert. If your Windows Phone app calls a HTTPS service using a self-signed cert you will get an error saying “service not found” or “remote server returned a error: not found.” This is because the call is causing a certificate error since the cert is not in the phones trusted cert tree. To solve this problem the emulator or device needs to install the certificate. To do this just navigate to the .cer file in the device or emulator’s browser and tell it to install the cert. This will then let your phone make calls to the HTTPS service. Once you do this it should solve your problem. &lt;/p&gt;  &lt;p&gt;The other issue you may see in production is that the cert you bought and installed works fine in Windows but not when called by Windows Phone. For some reason the CA trust tree for Windows and Windows Phone are not the same. Make sure you buy a cert from a CA trust that is in both. &lt;/p&gt;  &lt;p&gt;Here is the list to help you find one:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/gg521150(v=VS.92).aspx"&gt;Windows Phone CA trust&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/windows-root-certificate-program-members.aspx"&gt;Windows CA trust&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you install a cert that is in the Windows trust tree but not in Windows Phone the phone will still give you an error when trying to call the HTTPS service because it does not trust the cert protecting the service. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-5589190988526624647?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/5589190988526624647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=5589190988526624647' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/5589190988526624647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/5589190988526624647'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2011/11/windows-phone-and-https-service-calls.html' title='Windows Phone and HTTPS service calls'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-4084998449908837810</id><published>2011-11-05T16:00:00.000-07:00</published><updated>2011-11-05T16:00:01.231-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Azure Marketplace'/><title type='text'>Understanding Azure Marketplace event flow</title><content type='html'>&lt;p&gt;In working with the sample projects in the the Azure SDK I wanted to make sure I understood how the Marketplace event flow was happening. If you do the tutorial in the Azure 1.4 it helps you connect an application so it can handle subscription events from the marketplace. There is a lot of code created for you though. Once I got it working I still did not really understand what the event flow was happening from the Marketplace to my application. The solution? Spend some time digging through all the code and application flow and create a nice little Visio to help visualize it. Below is the diagram I created. Hopefully, if you have used the tutorial this will help you understand how the components you created and configured actually get wired together. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-j6wMGz4ywgg/TrRufRJQrgI/AAAAAAAAAGY/YHeCkdSHjKk/s1600-h/image%25255B17%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-XbOFGAeoCUE/TrRufxqdnKI/AAAAAAAAAGg/JqOHiGt1mbo/image_thumb%25255B11%25255D.png?imgmax=800" width="598" height="737" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-4084998449908837810?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/4084998449908837810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=4084998449908837810' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4084998449908837810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4084998449908837810'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2011/11/understanding-azure-marketplace-event.html' title='Understanding Azure Marketplace event flow'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/-XbOFGAeoCUE/TrRufxqdnKI/AAAAAAAAAGg/JqOHiGt1mbo/s72-c/image_thumb%25255B11%25255D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-7071256047211315365</id><published>2011-11-04T09:52:00.001-07:00</published><updated>2011-11-04T09:52:25.133-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Azure ACS'/><title type='text'>Azure Access Control - ACS50000: There was an error issuing a token.</title><content type='html'>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I have been playing with the Azure Access control solution and how to put an application into the Azure Marketplace SaaS offering. The first issue I ran into was getting ACS to work. I had developed a solution with Microsoft’s Active Directory Federation services 2.0 before some the concept was familiar to me. Even through the topic was familiar to me federation errors are often still a pain to resolve. &lt;/p&gt;  &lt;p&gt;The first thing you have to do is understand if the error is coming from the provider or client. In this case even though ACS is throwing the error the error is actually coming from the client as it is rejecting the token. It can be rejecting the token for a few reasons.&lt;/p&gt;  &lt;p&gt;1) The certificate thumbprint the website is looking to validate against does not match. Check the sites web.config trusted issuers section and make sure the thumbprint matches what ACS has. &lt;/p&gt;    &lt;pre class="csharpcode"&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;issuerNameRegistry&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;trustedIssuers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;thumbprint&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;[yourthumbprint]&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;[yournamespace]&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;trustedIssuers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;issuerNameRegistry&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Here is where you get the thumbprint from in the Azure ACS&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/--ptc69b5tKM/TrQYPqgmFUI/AAAAAAAAAF4/SifnWZpdIxc/s1600-h/image%25255B9%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-nSdZn8wQmeE/TrQYQdEnc7I/AAAAAAAAAGA/WRDI68f4ST4/image_thumb%25255B5%25255D.png?imgmax=800" width="594" height="259" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;



&lt;p&gt;If that does not work your wreply URL back to your website is not correct.&lt;/p&gt;

&lt;p&gt;2) Check that the URL the token is being issued for (based on the wreply url) matches the audience URI configured in your application. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-77LmiH6giFs/TrQYQ7c5DGI/AAAAAAAAAGI/1QZzhmjmuF8/s1600-h/image%25255B13%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-EUTEVBhmgBk/TrQYRtAiRPI/AAAAAAAAAGQ/oHZVk467pAo/image_thumb%25255B7%25255D.png?imgmax=800" width="535" height="168" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my case I was in my development environment and therefore using odd port numbers. Once I updated the return URL so it had the port number of 444 and the audience URI in my web config to match it worked. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-7071256047211315365?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/7071256047211315365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=7071256047211315365' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/7071256047211315365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/7071256047211315365'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2011/11/azure-access-control-acs50000-there-was.html' title='Azure Access Control - ACS50000: There was an error issuing a token.'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/-nSdZn8wQmeE/TrQYQdEnc7I/AAAAAAAAAGA/WRDI68f4ST4/s72-c/image_thumb%25255B5%25255D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-2208519708529353188</id><published>2011-08-23T13:34:00.001-07:00</published><updated>2011-08-23T13:34:59.903-07:00</updated><title type='text'>Security Config in IIS Express</title><content type='html'>&lt;p&gt;I have gotten tired of always having to look this up or remember where it is at. That means it is time to post to my blog so I can find it easier and hopefully others can too. &lt;/p&gt;  &lt;p&gt;If you are having issues with IIS Express authentication errors (like the Unauthorized 401.2 error I always get) here is some help. I can never remember what the last setting was I had IIS Express set to for authorization. To change IIS Express for windows auth or anonymous auth you want to work with the applicationhost.config file. It can be found here …Documents\IISExpress\config. You want to change the settings in the following area of the config file. &lt;/p&gt;  &lt;pre class="csharpcode"&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;authentication&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;anonymousAuthentication&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;userName&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;basicAuthentication&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;clientCertificateMappingAuthentication&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;digestAuthentication&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;iisClientCertificateMappingAuthentication&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;iisClientCertificateMappingAuthentication&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;windowsAuthentication&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;providers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Negotiate&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;NTLM&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;providers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;windowsAuthentication&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;authentication&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-2208519708529353188?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/2208519708529353188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=2208519708529353188' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/2208519708529353188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/2208519708529353188'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2011/08/security-config-in-iis-express.html' title='Security Config in IIS Express'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-1071490729875246229</id><published>2011-01-04T16:00:00.001-08:00</published><updated>2011-01-04T16:00:27.552-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ADFS'/><title type='text'>Sharepoint 2010, ADFS 2.0 and Roles</title><content type='html'>&lt;p&gt;I actually copied this article from &lt;a href="http://lindstrom.nullsession.com/?p=236"&gt;here&lt;/a&gt;. I have been working with ADFS a lot and know that before long this will come in handy so I wanted to save it on my blog. &lt;/p&gt;    &lt;p&gt;February 6th, 2010 by Fredrik Lindström in &lt;a href="http://lindstrom.nullsession.com/?cat=10"&gt;ADFS&lt;/a&gt;, &lt;a href="http://lindstrom.nullsession.com/?cat=21"&gt;Windows Server 2008 R2&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I’ve been tinkering quite a bit with Sharepoint 2010 and ADFS 2.0 lately and figured that this was worth sharing.&lt;/p&gt;  &lt;p&gt;I followed the steps outlined in &lt;a href="http://blogs.pointbridge.com/Blogs/nielsen_travis/Pages/Post.aspx?_ID=33"&gt;Travis Nielsen’s blog post&lt;/a&gt; to configure a federated identity provider in Sharepoint 2010 and configured ADFS 2.0 in my own way since our setup involves quite a few partner organizations. One thing that is not mentioned in the step by step guide is how to configure Sharepoint to accept role claims and assign access rights based on those claims.&lt;/p&gt;  &lt;p&gt;The following Powershell snippet will do the trick&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;$issuer = Get-SPTrustedIdentityTokenIssuer&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;$issuer.ClaimTypes.Add(”http://schemas.microsoft.com/ws/2008/06/identity/claims/role“)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;$map=New-SPClaimTypeMapping “http://schemas.microsoft.com/ws/2008/06/identity/claims/role” -IncomingClaimTypeDisplayName “Role” -SameAsIncoming&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;$issuer.AddClaimTypeInformation($map)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;$issuer.Update()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;After this the “Role” entry will show up in the people picker and you will be able to assign role claims to Sharepoint groups.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-1071490729875246229?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/1071490729875246229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=1071490729875246229' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/1071490729875246229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/1071490729875246229'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2011/01/sharepoint-2010-adfs-20-and-roles.html' title='Sharepoint 2010, ADFS 2.0 and Roles'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-894341669454348306</id><published>2010-12-08T13:47:00.001-08:00</published><updated>2010-12-08T13:47:20.748-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Random'/><title type='text'>JQuery Templates for Visual Studio</title><content type='html'>&lt;p&gt;I found a good blog on using JQuery Templates. Reposting here so I can find it again easily if I need it. Hopefully it helps anyone else that may find this as well. &lt;/p&gt;  &lt;p&gt;&lt;a title="http://weblogs.asp.net/dwahlin/archive/2010/11/20/reducing-code-by-using-jquery-templates.aspx" href="http://weblogs.asp.net/dwahlin/archive/2010/11/20/reducing-code-by-using-jquery-templates.aspx"&gt;http://weblogs.asp.net/dwahlin/archive/2010/11/20/reducing-code-by-using-jquery-templates.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Additional info&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://api.jquery.com/category/plugins/templates"&gt;http://api.jquery.com/category/plugins/templates&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;You can &lt;a href="http://github.com/jquery/jquery-tmpl"&gt;download the jQuery Templates script here&lt;/a&gt; along with a sample application or reference one of the following Microsoft CDN scripts:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.js"&gt;http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.js&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"&gt;http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-894341669454348306?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/894341669454348306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=894341669454348306' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/894341669454348306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/894341669454348306'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2010/12/jquery-templates-for-visual-studio.html' title='JQuery Templates for Visual Studio'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-7160980748480672235</id><published>2010-10-21T11:14:00.001-07:00</published><updated>2010-10-21T11:15:23.825-07:00</updated><title type='text'>Generic object TryParse</title><content type='html'>&lt;p&gt;In my opinion whenever you need to parse a value you should always use the TryParse method to make your code more robust and able to handle errors better. The draw back to this is you and up writing a lot of if else statements. I got tired of doing this so was trying to find a more abstracted way to do this for all my values. I found this bit of code very handy. So far it has worked great! &lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; T GetValue&amp;lt;T&amp;gt;(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; obj)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;   &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (obj != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;   {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       Type type = &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(T);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       T &lt;span style="color: #0000ff"&gt;value&lt;/span&gt; = &lt;span style="color: #0000ff"&gt;default&lt;/span&gt;(T);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       var methodInfo = (from m &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; type.GetMethods(BindingFlags.Public | BindingFlags.Static)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                         &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; m.Name == &lt;span style="color: #006080"&gt;&amp;quot;TryParse&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                         select m).FirstOrDefault();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (methodInfo == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;           &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;default&lt;/span&gt;(T);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; result = methodInfo.Invoke(&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[] { obj, &lt;span style="color: #0000ff"&gt;value&lt;/span&gt; });&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ((result != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) &amp;amp;&amp;amp; ((&lt;span style="color: #0000ff"&gt;bool&lt;/span&gt;)result))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;           methodInfo = (from m &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; type.GetMethods(BindingFlags.Public | BindingFlags.Static)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                         &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; m.Name == &lt;span style="color: #006080"&gt;&amp;quot;Parse&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;                         select m).FirstOrDefault();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;           &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (methodInfo == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;               &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;default&lt;/span&gt;(T);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;           &lt;span style="color: #0000ff"&gt;value&lt;/span&gt; = (T)methodInfo.Invoke(&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt;[] { obj });&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;           &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; (T)&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;       }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;   }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;   &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;default&lt;/span&gt;(T);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-7160980748480672235?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/7160980748480672235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=7160980748480672235' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/7160980748480672235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/7160980748480672235'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2010/10/generic-object-tryparse.html' title='Generic object TryParse'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-4954514474433515015</id><published>2010-04-05T15:11:00.001-07:00</published><updated>2010-04-05T15:13:45.544-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Random'/><title type='text'>Hardening the TCP/IP Stack</title><content type='html'>&lt;p&gt;I had to spend some time today writing a registry file that would harden the TCP/IP stack. I did not want to manually update all the servers so figured I would just set up a registry file to do it for me. Below is the setting you can put in a .reg file to harden the stack. &lt;font color="#ff0000"&gt;&lt;strong&gt;REMINDER :&lt;/strong&gt; this comes with no warranty and you should always backup your registry before you make any changes.&lt;/font&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#ffffff"&gt;Windows Registry Editor Version 5.00 &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TcpIp\Parameters]        &lt;br /&gt;&amp;quot;SynAttackProtect&amp;quot;=dword:00000002         &lt;br /&gt;&amp;quot;TcpMaxPortsExhausted&amp;quot;=dword:00000001         &lt;br /&gt;&amp;quot;TcpMaxHalfOpen&amp;quot;=dword:000001f4         &lt;br /&gt;&amp;quot;TcpMaxHalfOpenRetried&amp;quot;=dword:00000190         &lt;br /&gt;&amp;quot;TcpMaxConnectResponseRetransmissions&amp;quot;=dword:00000002         &lt;br /&gt;&amp;quot;TcpMaxDataRetransmissions&amp;quot;=dword:00000002         &lt;br /&gt;&amp;quot;EnablePMTUDiscovery&amp;quot;=dword:00000000         &lt;br /&gt;&amp;quot;KeepAliveTime&amp;quot;=dword:000493e0 &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netbt\Parameter]        &lt;br /&gt;&amp;quot;NoNameReleaseOnDemand&amp;quot;=dword:00000001 &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;[HKLM\System\CurrentControlSet\Services\TcpIp\Parameters]        &lt;br /&gt;&amp;quot;EnableICMPRedirect&amp;quot;=dword:00000000 &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;[HKLM\System\CurrentControlSet\Services\Tcpip\Parameters]        &lt;br /&gt;&amp;quot;EnableDeadGWDetect&amp;quot;=dword:00000000 &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;[HKLM\System\CurrentControlSet\Services\AFD\Parameters]        &lt;br /&gt;&amp;quot;EnableDynamicBacklog&amp;quot;=dword:00000001         &lt;br /&gt;&amp;quot;MinimumDynamicBacklog&amp;quot;=dword:00000014         &lt;br /&gt;&amp;quot;MaximumDynamicBacklog&amp;quot;=dword:00004e20         &lt;br /&gt;&amp;quot;DynamicBacklogGrowthDelta&amp;quot;=dword:0000000a &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#ffffff"&gt;[HKLM\System\CurrentControlSet\Services\Tcpip\Parameters]        &lt;br /&gt;&amp;quot;DisableIPSourceRouting&amp;quot;=dword:00000001         &lt;br /&gt;&amp;quot;EnableMulticastForwarding&amp;quot;=dword:00000000         &lt;br /&gt;&amp;quot;IPEnableRouter&amp;quot;=dword:00000000         &lt;br /&gt;&amp;quot;EnableAddrMaskReply&amp;quot;=dword:00000000&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt; &lt;/blockquote&gt; &lt;span class="sbmLink"&gt;   &lt;table cellspacing="1" cellpadding="1"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td class="sbmText"&gt;Share this post : &lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to Social!" href="http://social.microsoft.com/en-us/action/create/s/E/?url=http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html&amp;amp;ttl=TCP/IP Stack Hardening" target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/social.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to MSDN!" href="http://social.msdn.microsoft.com/en-us/action/create/s/E/?url=http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html&amp;amp;ttl=TCP/IP Stack Hardening" target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/msdn.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to Technet!" href="http://social.technet.microsoft.com/en-us/action/create/s/E/?url=http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html&amp;amp;ttl=TCP/IP Stack Hardening" target="_blank"&gt;&lt;img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/technet.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html&amp;amp;;title=TCP/IP Stack Hardening" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to del.iri.ous!" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;amp;address=http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html&amp;amp;title=TCP/IP Stack Hardening" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to digg" href="http://digg.com/submit?phase=2&amp;amp;url=http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html&amp;amp;title=TCP/IP Stack Hardening" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to dotnetkicks" href="http://www.dotnetkicks.com/kick/?url=http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html&amp;amp;title=TCP/IP Stack Hardening" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/CropperCapture154.jpg" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to Facebook" href="http://www.facebook.com/sharer.php?u=http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html&amp;amp;t=TCP/IP Stack Hardening" target="_blank"&gt;&lt;img border="0" src="http://blogs.technet.com/photos/james/images/1765319/original.aspx" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to shadow" href="http://www.shadows.com/bookmark/saveLink.rails?page=http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html&amp;amp;title=TCP/IP Stack Hardening" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/shadows6.png" /&gt;&lt;/a&gt;&lt;/td&gt;          &lt;td&gt;&lt;a title="Post it to yahoo!" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html&amp;amp;t=TCP/IP Stack Hardening" target="_blank"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" /&gt;&lt;/a&gt;&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/span&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-4954514474433515015?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/4954514474433515015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=4954514474433515015' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4954514474433515015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4954514474433515015'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2010/04/hardening-tcpip-stack.html' title='Hardening the TCP/IP Stack'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-5626869721212888956</id><published>2009-07-13T17:09:00.001-07:00</published><updated>2009-07-13T17:09:42.454-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Silverlight 3 beta 1 and Virtual Earth part 2 (The Map)</title><content type='html'>&lt;div id="codeSnippetWrapper"&gt;In my &lt;a href="http://toadcode.blogspot.com/" target="_blank"&gt;previous post&lt;/a&gt; I covered getting GEO spatial data into SQL and creating a service Silverlight can use to get the data in a usable format. In this post we are going to talk about how to create a Silverlight application to overlay geo spatial data on the Virtual Earth map. First thing first. Download the &lt;a href="https://connect.microsoft.com/silverlightmapcontrolctp" target="_blank"&gt;Silverlight Virtual Earth&lt;/a&gt; map control. Once you have done that start a new Visual Studio 2008 Silverlight project and add a reference to the Microsoft.VirtualEarth.MapControl and copy the following code into the XAML of your default window or page. &lt;/div&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Grid&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;LayoutRoot&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Background&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;White&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;m:Map&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;MyMap&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ZoomLevel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;4&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Center&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;39.36830,-95.27340&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Grid&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;Row&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Grid&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Make sure you add this namespace as well for the VE add-in&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;xmlns:m=&lt;span style="color: #006080"&gt;&amp;quot;clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;That is all you have to do. If you run your application you should now have a VE map on it. Now lets get to the fun stuff. In your code behind for the page add a using statement to Microsoft.VirtualEarth.MapControl and add a service reference to the web service you created to provide the spatial data.&amp;#160; Here is what my initialization method looks like:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;InitializeComponent();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;SLSpatialTypesService.SpatialTypeServiceClient serviceClient = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; GovSage.SLSpatialTypesService.SpatialTypeServiceClient();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;serviceClient.GetCongDistsAsync();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;serviceClient.GetCongDistsCompleted += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler&amp;lt;GovSage.SLSpatialTypesService.GetCongDistsCompletedEventArgs&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    (serviceClient_GetCongDistsCompleted);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;As you can see all I am doing is instantiating my service and setting up an event callback for when the call completes. The real work happens when this call comes back.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; serviceClient_GetCongDistsCompleted(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, GovSage.SLSpatialTypesService.GetCongDistsCompletedEventArgs e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (KeyValuePair&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, ObservableCollection&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;&amp;gt; locations &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; e.Result)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;         MapPolyline polyline = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; MapPolyline();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;         polyline.Stroke = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SolidColorBrush(Colors.White);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;         polyline.StrokeThickness = 1;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;         polyline.Opacity = 0.5;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;         polyline.Locations = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; LocationCollection();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;         polyline.Name = locations.Key;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;         &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; location &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; locations.Value)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] latlong = location.Split(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;char&lt;/span&gt;[] {&lt;span style="color: #006080"&gt;','&lt;/span&gt;});&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;             Location thisLocation = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Location(Double.Parse(latlong[0]), Double.Parse(latlong[1]));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             polyline.Locations.Add(thisLocation);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;switch&lt;/span&gt; (MyMap.Children.Count)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; 1:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;                 polyline.Fill = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SolidColorBrush(Colors.Blue);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; 2:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;                 polyline.Fill = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SolidColorBrush(Colors.Green);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum28"&gt;  28:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; 3:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum29"&gt;  29:&lt;/span&gt;                 polyline.Fill = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SolidColorBrush(Colors.Purple);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum30"&gt;  30:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum31"&gt;  31:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; 4:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum32"&gt;  32:&lt;/span&gt;                 polyline.Fill = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SolidColorBrush(Colors.Red);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum33"&gt;  33:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum34"&gt;  34:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; 5:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum35"&gt;  35:&lt;/span&gt;                 polyline.Fill = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SolidColorBrush(Colors.Yellow);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum36"&gt;  36:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum37"&gt;  37:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; 6:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum38"&gt;  38:&lt;/span&gt;                 polyline.Fill = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SolidColorBrush(Colors.Brown);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum39"&gt;  39:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum40"&gt;  40:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; 7:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum41"&gt;  41:&lt;/span&gt;                 polyline.Fill = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SolidColorBrush(Colors.LightGray);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum42"&gt;  42:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum43"&gt;  43:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;default&lt;/span&gt;:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum44"&gt;  44:&lt;/span&gt;                 polyline.Fill = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SolidColorBrush(Colors.Cyan);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum45"&gt;  45:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum46"&gt;  46:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum47"&gt;  47:&lt;/span&gt;         polyline.MouseEnter += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; MouseEventHandler(polyline_MouseEnter);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum48"&gt;  48:&lt;/span&gt;         polyline.MouseLeave += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; MouseEventHandler(polyline_MouseLeave);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum49"&gt;  49:&lt;/span&gt;         MyMap.Children.Add(polyline);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum50"&gt;  50:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum51"&gt;  51:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;I get a KeyValuePair back from the web service. To create all my overlays I loop through each key value I get back. My key is my area name and the second value is an ObservableCollection of type string. In the first few lines (5-10) all I am doing is creating a new MapPolyline for each item and setting its properties and instantiating its LocationCollection. Then for each item in my ObservableCollection I loop and create a new location in my polyline. All I have to do is split the string value on the “,” and create a new location based on the latitude and longitude I am return and add it to the location collection. In my case I create 7 different MapPolyline objects each having about a hundred locations attached to them.&amp;#160; &lt;/p&gt;

&lt;p&gt;At this point I have created all the objects I need to overlay on my map. Once I leave the inner foreach statement I hit a case statement that simply looks at how many children my map has and sets the polyline fill color for that object to a certain color. This allows each overlay area to have a different color. &lt;/p&gt;

&lt;p&gt;Down at line 47 I start the code to add each MapPolyline to my map. Once you have added each as a child you should now be able to load your map and see your overlays (just make sure the latitude and longitude items you added for your locations actually matches the area you are expecting. If not your MapPolylines may get added to a completely different area of the map).&lt;/p&gt;

&lt;p&gt;My map now looks like this and as I move in and out my MapPolylines adjust as well.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://lh3.ggpht.com/_t_I1BLZTS2E/SluVdGof9lI/AAAAAAAAAD4/JNMVsPWWpcQ/s1600/image[13].png" width="557" height="423" /&gt;&amp;#160; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/_t_I1BLZTS2E/SlvMurPQl1I/AAAAAAAAAEA/IKbxhIZzccM/s1600-h/image%5B2%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_t_I1BLZTS2E/SlvMw65i-lI/AAAAAAAAAEE/htalolObvnE/image_thumb.png?imgmax=800" width="244" height="167" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;If your map scrolling is not smooth you need to do more reducing (reducing was talked about in part 1). &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-5626869721212888956?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/5626869721212888956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=5626869721212888956' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/5626869721212888956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/5626869721212888956'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2009/07/silverlight-3-beta-1-and-virtual-earth_13.html' title='Silverlight 3 beta 1 and Virtual Earth part 2 (The Map)'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_t_I1BLZTS2E/SluVdGof9lI/AAAAAAAAAD4/JNMVsPWWpcQ/s72-c/image[13].png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-6540435185888330194</id><published>2009-07-13T13:13:00.001-07:00</published><updated>2009-07-13T13:13:48.053-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Silverlight 3 beta 1 and Virtual Earth part 1 (GEO Data)</title><content type='html'>&lt;p&gt;I recently did some playing with Silverlight 3 beta 1 and the Virtual Earth (VE) CTP. I wanted to map out the congressional districts for Colorado on the VE map. It was a little tricky but not bad once I figured a few things out. &lt;/p&gt;  &lt;p&gt;First thing to figure out was where to get the geo mapping data to overlay on the VE CTP map. The site with a lot of this information is the &lt;a href="http://www.census.gov/geo/www/index.html" target="_blank"&gt;U.S. Census web sites&lt;/a&gt; (you can find all the Congressional district data &lt;a href="http://www.census.gov/geo/www/cob/cd110.html" target="_blank"&gt;here&lt;/a&gt;). I decided to download and work with the shape file (.shp). Once you have these downloaded the next trick is figuring out how to get this data into SQL Server 2008. The tool I used was &lt;a href="http://www.sharpgis.net/page/SQL-Server-2008-Spatial-Tools.aspx" target="_blank"&gt;Shape2SQL&lt;/a&gt; from SharpGIS. It works great and is pretty simple to use. There is also a &lt;a href="http://sqlspatialtools.codeplex.com/Wiki/View.aspx?title=Current%20Contents" target="_blank"&gt;CodePlex SQL Server spatial tools project&lt;/a&gt; that may have some helpful tools. &lt;/p&gt;  &lt;p&gt;Now that we have our spatial data imported into SQL we can start using it. The first thing to be aware of is that .Net 3.5 does not natively understand SQLGeometry types (seems silly but it is true). To over come this I simply added the Microsoft.SqlServer.Types assembly to my project. I created a web service my Silverlight application could use to query and get the needed spatial data. &lt;/p&gt;  &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; height: 273px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;     &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; [ServiceContract(Namespace = &lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; SpatialTypeService&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     [OperationContract]&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;&amp;gt; GetCongDists()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; connString = &lt;span style="color: #008000"&gt;// your string here&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;         &lt;span style="color: #008000"&gt;//Create string for SQL statement to find geometries within the map view   &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;         StringBuilder sb = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StringBuilder();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;         sb.Append(&lt;span style="color: #006080"&gt;&amp;quot;SELECT Name, [GEOM].Reduce(.002) FROM [Districts]&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;         &lt;span style="color: #008000"&gt;//Connect to database   &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         SqlConnection SQLConn = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SqlConnection(connString);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         SQLConn.Open();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;         &lt;span style="color: #008000"&gt;//Select all polygons that intersect the map extents   &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;         SqlCommand SQLCMD = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SqlCommand(sb.ToString(), SQLConn);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;         SqlDataReader dr = SQLCMD.ExecuteReader();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;         Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;,List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;&amp;gt; locations = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;,List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;&amp;gt;();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;while&lt;/span&gt; (dr.Read())&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;         {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;             List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; location = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;             SqlGeometry geo = (SqlGeometry)dr.GetValue(1);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;             &lt;span style="color: #008000"&gt;// We start at 1 because the STPointN array cannot get a zero past to it&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 1; i &amp;lt; geo.STNumPoints(); i++)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt;             {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; height: 34px; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;                 location.Add(geo.STPointN(i).STY.ToString() + &lt;span style="color: #006080"&gt;&amp;quot;,&amp;quot;&lt;/span&gt; + geo.STPointN(i).STX.ToString());&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt;             }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  33:&lt;/span&gt;             locations.Add(dr.GetValue(0).ToString(),location);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  34:&lt;/span&gt;         }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  35:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; locations;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  36:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  37:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Most of this code is just a standard WCF contract. Lets look at the couple key areas here that deal with our GEO data. First, notice at line 12 we have our SQL statement to select the data. &lt;/p&gt;

&lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;         sb.Append(&lt;span style="color: #006080"&gt;&amp;quot;SELECT Name, [GEOM].Reduce(.002) FROM [Districts]&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

&lt;p&gt;Here we are Selecting Name and GEOM data for all the districts we have. Notice the “Reduce(.002)” call we make. This Reduce function is key to keep performance of mapping this data fast. For Reduce you can pass in a number between 1 and 0. This call reduces the total number of mapping points SQL returns to us. The closer to 1 you get the less mapping points are returned. I used the Shape2SQL SQL Spatial tool to quickly play with the number and see what the returned mapping shape is (screen shapes below). The key here is to reduce as much as possible without changing the shape of what is returned. In my case .002 takes me from over a thousand points per zone to around 100 points. This makes zooming in and out on the VE CTP perform A LOT better. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/_t_I1BLZTS2E/SluVYvJjlWI/AAAAAAAAADo/3lPMJ2eKpbg/s1600-h/image%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" align="left" src="http://lh5.ggpht.com/_t_I1BLZTS2E/SluVZsdb_PI/AAAAAAAAADs/mIUkZN7GuUw/image_thumb%5B2%5D.png?imgmax=800" width="297" height="177" /&gt;&lt;/a&gt;Here is what my areas look like at .002:&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh3.ggpht.com/_t_I1BLZTS2E/SluVaiGZvSI/AAAAAAAAADw/z8U2F9dsSF4/s1600-h/image%5B9%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" align="left" src="http://lh5.ggpht.com/_t_I1BLZTS2E/SluVba9svKI/AAAAAAAAAD0/s49LnWX5aos/image_thumb%5B5%5D.png?imgmax=800" width="306" height="183" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Here is what it looks like at .1. You can see how my shapes have changed a lot and in my case to much. Depending on what you are trying to do, just play with the reduce function until you get the points as low as you can.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Now for the work we do to get all the values ready and in a form our Silverlight app can use (Lines 24 – 34).&lt;/p&gt;

&lt;div&gt;
  &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;
    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;,List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;&amp;gt; locations = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;,List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;&amp;gt;();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;while&lt;/span&gt; (dr.Read())&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; location = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    SqlGeometry geo = (SqlGeometry)dr.GetValue(1);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// We start at 1 because the STPointN array cannot get a zero past to it&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 1; i &amp;lt; geo.STNumPoints(); i++)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;        location.Add(geo.STPointN(i).STY.ToString() + &lt;span style="color: #006080"&gt;&amp;quot;,&amp;quot;&lt;/span&gt; + geo.STPointN(i).STX.ToString());&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    locations.Add(dr.GetValue(0).ToString(),location);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;I created a dictionary item to hold the name of each area and a list of its points. Once I run my select I loop through the datareader for each record and create a collection of all its points. To do this I load up the GEOM data as a SqlGeometry type. I can then see how many STNumPoints each GEOM object has and get the X and Y value for each point. I simply load that up as a string in the list that is ‘X,Y’ format. &lt;/p&gt;

&lt;p&gt;This will get you in a position for your Silverlight application to consume the data. In my next post I will cover what my Silverlight application is doing. &lt;/p&gt;

&lt;p&gt;Here is a screenshot of where we are going though:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh3.ggpht.com/_t_I1BLZTS2E/SluVdGof9lI/AAAAAAAAAD4/JNMVsPWWpcQ/s1600-h/image%5B13%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_t_I1BLZTS2E/SluVerXmtYI/AAAAAAAAAD8/yhRyX-m2mKY/image_thumb%5B7%5D.png?imgmax=800" width="467" height="359" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-6540435185888330194?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/6540435185888330194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=6540435185888330194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/6540435185888330194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/6540435185888330194'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2009/07/silverlight-3-beta-1-and-virtual-earth.html' title='Silverlight 3 beta 1 and Virtual Earth part 1 (GEO Data)'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_t_I1BLZTS2E/SluVZsdb_PI/AAAAAAAAADs/mIUkZN7GuUw/s72-c/image_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-4178973931568094094</id><published>2009-04-29T11:32:00.001-07:00</published><updated>2009-04-29T11:32:22.355-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Silverlight 3 beta 1 Errors</title><content type='html'>&lt;p&gt;I have been playing with Silver 3 beta 1 and ran into a couple errors that really stumped me for a bit. Here is how you fix them in case any one else runs into them as well.&lt;/p&gt;  &lt;p&gt;1- &lt;strong&gt;&lt;em&gt;Object reference not set&lt;/em&gt;&lt;/strong&gt; when adding a Silverlight WCF service: This is caused by your source control settings. I solved this issues by going to Tools –&amp;gt; Options –&amp;gt; Source Control and changing it from TFS to None. No idea why this causes the error but it did solve the issue for me. &lt;/p&gt;  &lt;p&gt;2- &lt;strong&gt;&lt;em&gt;Unable to find ‘DynamicTypeService’&lt;/em&gt;&lt;/strong&gt; error. This one was a little more work. In this folder C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE you will find a file called “Microsoft.VisualStudio.ServicesProxy.dll” this file needs to be removed (I just changed the extension to .old) before installing the Silverlight 3 beta 1 VS tools (which installs the SDK and the runtime). I of course had already installed all this so I uninstalled it all, renamed the file and installed it again (the installed with install the above dll again). Now everything is working. &lt;/p&gt;  &lt;p&gt;Hope this helps. Thanks to &lt;a href="http://www.itwriting.com/blog/665-more-silverlight-visual-studio-setup-hassles.html"&gt;Tim Anderson’s blog&lt;/a&gt; that got me going in the right direction on this. His issues were with Silverlight 2 beta 2 but the fixes are the same. Who knows why Microsoft felt the need to repeat this issue for the Silverlight 3 beta. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-4178973931568094094?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/4178973931568094094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=4178973931568094094' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4178973931568094094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4178973931568094094'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2009/04/silverlight-3-beta-1-errors.html' title='Silverlight 3 beta 1 Errors'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-2117905487229970372</id><published>2009-04-22T16:20:00.001-07:00</published><updated>2009-04-22T16:21:36.039-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Random'/><title type='text'>Sitecore – One man’s opinion</title><content type='html'>&lt;p&gt;I recently spent about 6 months building a web site in Sitecore 5.3.2. As this was my first time using Sitecore I wanted to put down some thoughts I have about the platform. While there was definitely some very frustrating aspects to Sitecore there are also so very slick and cool things about it. While the install I was working on was version 5.3.2 I took a trip to San Francisco to get certified in version 6.0.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;strong&gt;Learning Curve&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Sitecore is build on .Net, XPATH and heavy use of XSLTs. If you are familiar with these technologies the learning curve for Sitecore is not to bad. I had a development team of 5 developers offshore. The team was able to get up to speed on Sitecore in about a week. Really the trickiest part of Sitecore to learn is the administration UI and the use of templates, masters and standard values (these are all Sitecore objects). You really need to think through how you will use these objects. &lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;strong&gt;The UI&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;The UI for Sitecore is pretty interesting. It is all browser based. When you login to what they call the “desktop” interface it looks like you have a windows desktop sitting in your browser window, and sure enough this is how it acts too. There are a lot of tools available to you in this interface. All the tools work pretty well. The only area I have to complain about is the installation wizard. This tool lets you import packages from other Sitecore environments. This process moves Sitecore items (and even physical files) from one environment to another. The process works well with small packages, but (and this can be a big but) if your packages get large the process is really slow, time consuming and error prone. &lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;strong&gt;The API&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;The API is actually really robust. We were pleasantly surprised by how robust its API was. There was not anything we needed to do that we could not find an API for.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;strong&gt;XSLT&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;All the content data you create is stored in Sitecore in XML format. In my opinion using XSLT to transform XML data for UI display is pretty slick and a great way to do UI and content separation. You can make Sitecore API calls in your XSLTs using Sitecore’s built in XSLT extension into its API (the documentation for this though is week and you are normally left looking at standard code behind API calls and guessing how to create that call in an XSLT format). &lt;/p&gt;  &lt;p&gt;Overall the XSLT ability in Sitecore is impressive but you have to beware that when you have large Sitecore content trees the XPATH calls in your XSLTs to get your data can get slow really fast. When possible it is best to use Sitecore’s search engine to pull data from large content trees. XSLT extension are a great way to do this.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;strong&gt;Moving it, Testing it and Source Control&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;This is really the area I have the most complaint around Sitecore. The nature of using a lot of XSLTs makes unit testing hard to do. Sitecore does not make this any easier given how the XSLT pages are dependant on the Sitecore datacontext object. You can mock up an datacontext object for unit tests but it is really slow to instantiate. You are still then left to create your own XSLT unit test framework. In our case 90% of our UI was created using XSLTs. Sitecore also provides no build in approach to unit testing for its objects. So when you create a template there is no out of the box solution to unit testing it and making sure default values really do default correctly. &lt;/p&gt;  &lt;p&gt;Once you have created everything in your development environment and you are ready to move it to your test or production environment it can get interesting. You can create a package to move all the Sitecore objects and the physical files. This can be a large package an when trying to move from an offshore environment to an onshore environment can cause issues. I have also found Sitecore package installation to be unreliable (Sitecore objects will install corrupted sometimes).&lt;/p&gt;  &lt;p&gt;Sitecore also has no source control. Everything you create for sitecore (even xslt, aspx and ascx files) have a Sitecore item associated with them which is stored in the database. All the templates, masters, standard values, etc you create for your Sitecore site is all stored in the database. The only source control you have for these items is a database backup, and let me tell you now, you will need this. The Sitecore database likes to become corrupt. The UI is not sophisticated enough yet to stop you from doing something that will corrupt you database (easiest way this happens is you set up your template inheritance so as to create a circular reference. Once you do this most likely your only way back is to restore a backup).&amp;#160; &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-2117905487229970372?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/2117905487229970372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=2117905487229970372' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/2117905487229970372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/2117905487229970372'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2009/04/sitecore-one-mans-opinion.html' title='Sitecore – One man’s opinion'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-4197452231055907098</id><published>2008-09-18T16:25:00.001-07:00</published><updated>2008-09-18T16:25:11.647-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TFS'/><title type='text'>Recursive Copy in TFS  MSBuild</title><content type='html'>&lt;p&gt;In working with TFS I just discovered the &lt;a href="http://msdn.microsoft.com/en-us/library/ms164313.aspx"&gt;Well-Known Item Metadata&lt;/a&gt; (bad name in my opinion as I don't they they are really all that &amp;quot;Well-known&amp;quot;) which can be used in MSBuild. One of these is %(RecursiveDir) . &lt;/p&gt;  &lt;p&gt;From MSDN:&lt;/p&gt;  &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.83%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; height: 297px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;     &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;If the Include attribute contains the wildcard **, this metadata specifies the path to the file, beginning at the location of the wildcard. For more information on wildcards, see How to: Use Wildcards to Build All Files in a Directory. &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;This example has no RecursiveDir metadata, but if the following example was used to include this item, the item would contain a RecursiveDir value of MyProject\Source\. &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;MyItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;C:\**\Program.cs&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;If the following example was used to include this item, the RecursiveDir value of the item would remain MyProject\Source\. &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;MyItem&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;C:\**\Source\Program.cs&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This gives a lot of flexibility when using MSBuild. It allows you to create a ItemGroup element which can include and exclude files in a directory recursively and then copy those files recursively to another directory! &lt;/p&gt;

&lt;p&gt;This allowed me to do the following to copy the build out put of a web site (which naturally has a lot of sub-folders) easily up to the server.&lt;/p&gt;

&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;
  &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;
    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Target&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;AfterDropBuild&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Message&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;AfterDropBuild being fired&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Compile&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(DropLocation)\$(BuildNumber)\Mixed Platforms\Release\_PublishedWebsites\User Interface\**\*.*&amp;quot;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;             &lt;span style="color: #ff0000"&gt;Exclude&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(DropLocation)\$(BuildNumber)\Mixed Platforms\Release\_PublishedWebsites\User Interface\connectionStrings.config&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Copy&lt;/span&gt; &lt;span style="color: #ff0000"&gt;SourceFiles&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;@(Compile)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;DestinationFolder&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;\\ServerName\MyFolder\%(RecursiveDir)&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Copy&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Message&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Completed coping files&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Target&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;MSBuild takes awhile to learn all the tricks, but the more tricks I learn the more I like it. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-4197452231055907098?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/4197452231055907098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=4197452231055907098' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4197452231055907098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4197452231055907098'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/09/recursive-copy-in-tfs-msbuild.html' title='Recursive Copy in TFS  MSBuild'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-2420719292933238808</id><published>2008-08-25T15:27:00.001-07:00</published><updated>2008-08-25T15:27:51.203-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TFS'/><title type='text'>Custom TFS Task to Change WorkItem State</title><content type='html'>&lt;p&gt;I recently had to create a custom task to update the state all work items associated with a changeset were in. Here is the code I came up with to accomplish this. &lt;/p&gt;  &lt;p&gt;First we start of by creating a general class that includes a few properties. The properties will allow us to pass in variables to the task. LocalPath and BuildURI are variables which TFS build provides for you. I also included the using statements you need to have for this task. &lt;/p&gt;  &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;   &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.Build.Utilities;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.TeamFoundation.Client;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.TeamFoundation.VersionControl.Client;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.TeamFoundation.WorkItemTracking.Client;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; Microsoft.TeamFoundation.Build.Client;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; MyCustomStuff.TFS.Tasks&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; UpdateWorkItemStatus : Task&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// A value for each one of these properties must be supplied in the XML build file. &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// LocalPath and BUILDURI can use the MSBuild variables of $(TeamFoundationServerURL) and $(BuildURI)&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;         [Required]&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; LocalPath { get; set; }&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         [Required]&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; BuildURI { get; set; }&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;         [Required]&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; NewStatus { get; set; }&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;         &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// This is the status the work item must be in for the status to be updated. This prevents us from updating all &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// workitems that where checked in associated to a buid.&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; ConditionalStatus { get; set; }&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; Execute()&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;         {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;            &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;         }&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Now we are set up and ready to build out the task. What I wanted to do was connected to TFS and get a list of all the workitems associated with the build that was just run (this is why you have to pass in the Build URI). If you insert the follow code in the line 27 from above you get a working custom task. &lt;/p&gt;

&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;
  &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;try&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Get the TFS server&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     TeamFoundationServer server = TeamFoundationServerFactory.GetServer(LocalPath);&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Get the WorkItem store&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;     WorkItemStore wiStore = (WorkItemStore)server.GetService(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(WorkItemStore));&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//BuildStore buildServer = (IBuildServer)server.GetService(typeof(IBuildServer));&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     IBuildServer buildServer = (IBuildServer)server.GetService(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(IBuildServer));&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;     IBuildDetail build = buildServer.GetAllBuildDetails(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Uri(BuildURI, UriKind.Absolute));&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;     List&amp;lt;IWorkItemSummary&amp;gt; assocWorkItems = InformationNodeConverters.GetAssociatedWorkItems(build);&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;     EventLog.WriteEntry(&lt;span style="color: #006080"&gt;&amp;quot;UpdateWorkItemStatus&amp;quot;&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #006080"&gt;&amp;quot;Found {0} workitems for Build {1} : BuildURI = {2} LocalPath = {3}&amp;quot;&lt;/span&gt;,assocWorkItems.Count, build.BuildNumber, BuildURI,LocalPath), EventLogEntryType.Information));&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Loop through each work item and update the status&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (IWorkItemSummary wItem &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; assocWorkItems)&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;         WorkItem wi = wiStore.GetWorkItem(wItem.WorkItemId);&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Only update the work Item if no conditional status was provided or if the conditional status matches&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (ConditionalStatus == &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Empty || wi.State.ToLower().Trim() == ConditionalStatus.ToLower().Trim())&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;         {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;             EventLog.WriteEntry(&lt;span style="color: #006080"&gt;&amp;quot;UpdateWorkItemStatus&amp;quot;&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #006080"&gt;&amp;quot;WorkItem {0} was updated from {1} to {2}&amp;quot;&lt;/span&gt;, wItem.Id, wItem.Status, NewStatus), EventLogEntryType.Information);&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;             &lt;span style="color: #008000"&gt;// Update the state and add a note in the history stating the build process made this change.&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;             wi.History.Insert(0, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #006080"&gt;&amp;quot;Build process changed state from {0} to {1}&amp;quot;&lt;/span&gt;, ConditionalStatus, NewStatus));&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;             wi.State = NewStatus;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;             wi.Save();&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;         }&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt; }&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  33:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt; (Exception ex)&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  34:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  35:&lt;/span&gt;     EventLog.WriteEntry(&lt;span style="color: #006080"&gt;&amp;quot;UpdateWorkItemStatus&amp;quot;&lt;/span&gt;, ex.Message, EventLogEntryType.Error);&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  36:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  37:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;For this task I get the list of all workitems associated with the changeset and loop through that list. As I loop through I get the details for each workitem and than perform a check to see rather or not I should update the workitem. If the workitem's state matches the conditional state parameter that was passed in, than I update the workitem to the new state which was also passed in to my task. That is all there is to it. Now lets take a look at how you call it via your TFS build script. &lt;/p&gt;

&lt;p&gt;Once you build the above code and deploy it to your build server you can call that task from any TFS build which uses that build server. To call the task you have to make a couple additions to the XML in your TFS build. First you need to add a node that says you are using a new task:&lt;/p&gt;

&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;
  &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;&amp;lt;!-- This is the custom task that will update all associated work items to a new status --&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;UsingTask&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TaskName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;UpdateWorkItemStatus&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;AssemblyFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(MSBuildExtensionsPath)\MyCustomTFSTask.dll&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This allows the rest of your build process to now call a custom task of &amp;quot;UpdateWorkItemStatus.&amp;quot; The $(MSBuildExtensionsPath) is a global parameter in TFS build and is for the MSBuild folder under the Program Files directory. This location is a useful place to put custom target files (For example, your targets files could be installed at \Program Files\MSBuild\). Now all you need to do is call the task after the build is done. To do this you would think you could use the &amp;quot;AfterBuild&amp;quot; target but you cannot (at least I have never gotten it to work). You actually need to use the &amp;quot;TeamBuild&amp;quot; target. This target is fired off after the build has completed and can be called with the follow XML.&lt;/p&gt;

&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;
  &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Target&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;TeamBuild&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Condition&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot; '$(IsDesktopBuild)'!='true' &amp;quot;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;           &lt;span style="color: #ff0000"&gt;DependsOnTargets&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(TeamBuildDependsOn)&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Message&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;TeamBuild is firing!&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #008000"&gt;&amp;lt;!-- Now update all associated work items to the right status --&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;UpdateWorkItemStatus&lt;/span&gt; &lt;span style="color: #ff0000"&gt;NewStatus&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Sys Test&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;LocalPath&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(TeamFoundationServerUrl)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;BuildURI&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(BuildUri)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ConditionalStatus&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Dev Complete&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Target&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
This is where you declare the value of all your parameters. Now each time at team build fires off any associated workitem that is a match will be updated.   &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-2420719292933238808?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/2420719292933238808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=2420719292933238808' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/2420719292933238808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/2420719292933238808'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/08/custom-tfs-task-to-change-workitem.html' title='Custom TFS Task to Change WorkItem State'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-7855249199813349235</id><published>2008-07-21T10:16:00.001-07:00</published><updated>2008-07-21T10:16:17.904-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Silverlight Webcasts</title><content type='html'>&lt;p&gt;Here is a great &lt;a href="http://channel9.msdn.com/posts/mtaulty/"&gt;list of Silverlight webcasts&lt;/a&gt; to help get people started. Really great work from &lt;a href="http://mtaulty.com/communityserver/blogs/mike_taultys_blog/default.aspx"&gt;Mike Taulty&lt;/a&gt;!&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Hello-World/"&gt;&lt;b&gt;Silverlight - Hello World&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Anatomy-of-an-Application/"&gt;&lt;b&gt;Silverlight - Anatomy of an Application&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-The-VS-Environment/"&gt;&lt;b&gt;Silverlight - The VS Environment&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Content-Controls/"&gt;&lt;b&gt;Silverlight - Content Controls&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Built-In-Controls/"&gt;&lt;b&gt;Silverlight - Built-In Controls&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Width-Height-Margins-Padding-Alignment/"&gt;&lt;b&gt;Silverlight - Width, Height, Margins, Padding, Alignment&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-a-GridSplitter/"&gt;&lt;b&gt;Silverlight - Using a GridSplitter&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Grid-Layout/"&gt;&lt;b&gt;Silverlight - Grid Layout&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-StackPanel-Layout/"&gt;&lt;b&gt;Silverlight - StackPanel Layout&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Canvas-Layout/"&gt;&lt;b&gt;Silverlight - Canvas Layout&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Databinding-UI-to-NET-Classes/"&gt;&lt;b&gt;Silverlight - Databinding UI to .NET Classes&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Simple-Styles/"&gt;&lt;b&gt;Silverlight - Simple Styles&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Custom-Types-in-XAML/"&gt;&lt;b&gt;Silverlight - Custom Types in XAML&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Binding-with-Conversion/"&gt;&lt;b&gt;Silverlight - Binding with Conversion&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-List-Based-Data-Binding/"&gt;&lt;b&gt;Silverlight - List Based Data Binding&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Simple-User-Control/"&gt;&lt;b&gt;Silverlight - Simple User Control&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Templating-a-Button/"&gt;&lt;b&gt;Silverlight - Templating a Button&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Resources-from-XAPDLLSite-Of-Origin/"&gt;&lt;b&gt;Silverlight - Resources from XAP/DLL/Site Of Origin&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Animations--Storyboards/"&gt;&lt;b&gt;Silverlight - Animations &amp;amp; Storyboards&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Uploads-with-WebClient/"&gt;&lt;b&gt;Silverlight - Uploads with WebClient&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Downloads-with-WebClient/"&gt;&lt;b&gt;Silverlight - Downloads with WebClient&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Calling-HTTPS-Web-Services/"&gt;&lt;b&gt;Silverlight - Calling HTTPS Web Services&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Calling-Web-Services/"&gt;&lt;b&gt;Silverlight - Calling Web Services&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Making-Cross-Domain-Requests/"&gt;&lt;b&gt;Silverlight - Making Cross Domain Requests&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-HttpWebRequest/"&gt;&lt;b&gt;Silverlight - Using HttpWebRequest&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-File-Dialogs-and-User-Files/"&gt;&lt;b&gt;Silverlight - File Dialogs and User Files&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-Sockets/"&gt;&lt;b&gt;Silverlight - Using Sockets&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-Isolated-Storage/"&gt;&lt;b&gt;Silverlight - Using Isolated Storage&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-NET-Code-Modifying-HTML/"&gt;&lt;b&gt;Silverlight - .NET Code Modifying HTML&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-Isolated-Storage-Quotas/"&gt;&lt;b&gt;Silverlight - Using Isolated Storage Quotas&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Calling-JavaScript-from-NET/"&gt;&lt;b&gt;Silverlight - Calling JavaScript from .NET&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Evaluating-JavaScript-from-NET-Code/"&gt;&lt;b&gt;Silverlight - Evaluating JavaScript from .NET Code&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Handling-HTML-Events-in-NET-Code/"&gt;&lt;b&gt;Silverlight - Handling HTML Events in .NET Code&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Handling-NET-Events-in-JavaScript/"&gt;&lt;b&gt;Silverlight - Handling .NET Events in JavaScript&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Calling-NET-from-JavaScript/"&gt;&lt;b&gt;Silverlight - Calling .NET from JavaScript&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Displaying-a-Custom-Splash-Screen/"&gt;&lt;b&gt;Silverlight - Displaying a Custom Splash Screen&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Passing-Parameters-from-your-Web-Page/"&gt;&lt;b&gt;Silverlight - Passing Parameters from your Web Page&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Loading-Media-at-Runtime/"&gt;&lt;b&gt;Silverlight - Loading Media at Runtime&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Dynamically-Loading-AssembliesCode/"&gt;&lt;b&gt;Silverlight - Dynamically Loading Assemblies/Code&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-ReadingWriting-XML/"&gt;&lt;b&gt;Silverlight - Reading/Writing XML&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Using-Silverlight-Streaming/"&gt;&lt;b&gt;Silverlight - Multiple Threads with BackgroundWorker&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-InsertUpdateDelete-with-the-DataGrid/"&gt;&lt;b&gt;Silverlight - Insert/Update/Delete with the DataGrid&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Getting-Started-with-the-DataGrid/"&gt;&lt;b&gt;Silverlight - Getting Started with the DataGrid&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/mtaulty/Silverlight-Embedding-Custom-Fonts/"&gt;&lt;b&gt;Silverlight - Embedding Custom Fonts&lt;/b&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-7855249199813349235?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/7855249199813349235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=7855249199813349235' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/7855249199813349235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/7855249199813349235'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/07/silverlight-webcasts.html' title='Silverlight Webcasts'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-2940986108468756515</id><published>2008-06-23T09:41:00.001-07:00</published><updated>2008-06-23T09:44:14.199-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TFS'/><title type='text'>Copy Multiple Files via TFS build</title><content type='html'>&lt;p&gt;bI have recently been doing a lot of work with TFS and want to write about a few things I had to figure out how to do. As part of my build process I had a number of dlls I needed to copy out to my staging environment. To do this I overrode the AfterCompile target. In order to override this Target you have to import the Microsoft.Common.targets file.&lt;/p&gt;  &lt;p&gt;&amp;lt;Import Project=&amp;quot;$(MSBuildBinPath)\Microsoft.Common.targets&amp;quot; /&amp;gt;&lt;/p&gt;  &lt;pre class="code"&gt;In MSBuild you can call Copy which will move a file from one location to another location. The key word here is that it will move &amp;quot;a file&amp;quot;, it will not move &amp;quot;files.&amp;quot; So you can call something like this:&lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:7fca0158-02fc-4278-a005-9493c9c369ac" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="xml:nogutter:firstline[1]"&gt;&amp;lt;Copy SourceFiles="$(DeployStagePath)\my.dll"
          DestinationFolder="$(DeployPath)" /&amp;gt;&lt;/pre&gt;&lt;/div&gt;But you cannot use code like this to copy all dll files:&lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:ec2a6bb7-eddc-412f-8a29-c92e87c225df" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="xml"&gt;&amp;lt;Copy SourceFiles="$(DeployStagePath)\*.dll"
          DestinationFolder="$(DeployPath)" /&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/pre&gt;

&lt;p&gt;To copy all dlls in a folder you need to create a new item. Here is the code I used to do this.
  &lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:13008bf2-bd4c-484a-af1a-cf57d8cbca5c" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="xml"&gt;&amp;lt;Target Name="AfterCompile" DependsOnTargets="CopyFiles"&amp;gt; 
    &amp;lt;Message Text="The after build event sets up the compiled code for ClickOnce Deployment" Importance="high"/&amp;gt;

    &amp;lt;!-- Set up the items for doing a copy of a collection of files --&amp;gt;
    &amp;lt;CreateItem Include="$(DeployStagePath)\*.dll"&amp;gt;
      &amp;lt;Output TaskParameter="Include" ItemName="DLLsToCopy"/&amp;gt;
    &amp;lt;/CreateItem&amp;gt;

    &amp;lt;Copy SourceFiles="@(DLLsToCopy)" DestinationFolder="$(DeployPath)" /&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-2940986108468756515?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/2940986108468756515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=2940986108468756515' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/2940986108468756515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/2940986108468756515'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/06/copy-multiple-files-via-tfs-build.html' title='Copy Multiple Files via TFS build'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-8386886244578797735</id><published>2008-05-21T15:44:00.001-07:00</published><updated>2008-05-21T15:44:01.299-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><title type='text'>Silverlight Style at MIX</title><content type='html'>&lt;p&gt;This is a great recording from MIX that covers styling in Silverlight 2. I though it was great so I wanted to share it and save it for future reference.&lt;/p&gt; &lt;iframe src="http://visitmix.com/blogs/2008Sessions/564/player/" frameborder="0" width="320" scrolling="no" height="325"&gt;&lt;/iframe&gt;  &lt;br /&gt;&lt;a href="http://visitmix.com/blogs/2008Sessions/T20/"&gt;Creating Rich, Dynamic User Interfaces with Silverlight 2&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-8386886244578797735?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/8386886244578797735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=8386886244578797735' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/8386886244578797735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/8386886244578797735'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/05/silverlight-style-at-mix.html' title='Silverlight Style at MIX'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-7813598852886507860</id><published>2008-05-20T16:02:00.001-07:00</published><updated>2008-05-20T16:04:33.707-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MOSS'/><title type='text'>MOSS 2007 Templates</title><content type='html'>&lt;p&gt;I needed to have a quick reference guide to the different templates in MOSS 2007 and what each one is for. So here it is. &lt;/p&gt; &lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;   &lt;table style="width: 449pt; border-collapse: collapse" cellspacing="0" cellpadding="0" width="597" border="0"&gt;&lt;colgroup&gt;&lt;col style="width: 83pt; mso-width-source: userset; mso-width-alt: 4022" width="110" /&gt;&lt;col style="width: 79pt; mso-width-source: userset; mso-width-alt: 3840" width="105" /&gt;&lt;col style="width: 287pt; mso-width-source: userset; mso-width-alt: 13970" width="382" /&gt;&lt;/colgroup&gt;&lt;tbody&gt;       &lt;tr style="height: 15pt" height="20"&gt;         &lt;td class="xl65" style="border-right: medium none; border-top: medium none; font-weight: 700; font-size: 11pt; background: black; border-left: medium none; width: 83pt; color: white; border-bottom: white 1pt solid; font-family: calibri; height: 15pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: black none" width="110" height="20"&gt;Template Category&lt;/td&gt;          &lt;td class="xl65" style="border-right: medium none; border-top: medium none; font-weight: 700; font-size: 11pt; background: black; border-left: medium none; width: 79pt; color: white; border-bottom: white 1pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: black none" width="105"&gt;Template Name&lt;/td&gt;          &lt;td class="xl65" style="border-right: medium none; border-top: medium none; font-weight: 700; font-size: 11pt; background: black; border-left: medium none; width: 287pt; color: white; border-bottom: white 1pt solid; font-family: calibri; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: black none" width="382"&gt;Description&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 47.25pt; mso-height-source: userset" height="63"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #953735; color: white; font-family: calibri; height: 47.25pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" height="63"&gt;Collaboration&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Team Site&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site for teams to quickly organize, author, and share information. It provides a document library, and lists for managing announcements, calendar items, tasks, and discussions.&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&lt;/span&gt;&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 15pt" height="20"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #c0504d; color: white; font-family: calibri; height: 15pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" height="20"&gt;Collaboration&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Blank Site&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A blank site for you to customize based on your requirements.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 51.75pt" height="69"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #953735; color: white; font-family: calibri; height: 51.75pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" height="69"&gt;Collaboration&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Document Workspace&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site for colleagues to work together on a document. It provides a document library for storing the primary document and supporting files, a tasks list for assigning to-do items, and a links list for resources related to the document.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 39pt" height="52"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #c0504d; color: white; font-family: calibri; height: 39pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" height="52"&gt;Collaboration&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Wiki Site&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site for a community to brainstorm and share ideas. It provides Web pages that can be quickly edited to record information and then linked together through keywords&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 26.25pt" height="35"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #953735; color: white; font-family: calibri; height: 26.25pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" height="35"&gt;Collaboration&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="105"&gt;Blog&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site for a person or team to post ideas, observations, and expertise that site visitors can comment on.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 39pt" height="52"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #c0504d; color: white; font-family: calibri; height: 39pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" height="52"&gt;Meetings&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Basic Meeting Workspace&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site to plan, organize, and capture the results of a meeting. It provides lists for managing the agenda, meeting attendees, and documents.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 26.25pt" height="35"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #953735; color: white; font-family: calibri; height: 26.25pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" height="35"&gt;Meetings&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Blank Meeting Workspace&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A blank meeting site for you to customize based on your requirements.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 39pt" height="52"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #c0504d; color: white; font-family: calibri; height: 39pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" height="52"&gt;Meetings&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Decision Meeting Workspace&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site for meetings that track status or make decisions. It provides lists for creating tasks, storing documents, and recording decisions&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 39pt" height="52"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #953735; color: white; font-family: calibri; height: 39pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" height="52"&gt;Meetings&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Social Meeting Workspace&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site to plan social occasions. It provides lists for tracking attendees, providing directions, and storing pictures of the event.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 51.75pt" height="69"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #c0504d; color: white; font-family: calibri; height: 51.75pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" height="69"&gt;Meetings&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;MultiPage Meeting Workspace&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site to plan, organize, and capture the results of a meeting. It provides lists for managing the agenda and meeting attendees in addition to two blank pages for you to customize based on your requirements.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 26.25pt" height="35"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #953735; color: white; font-family: calibri; height: 26.25pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" height="35"&gt;Enterprise&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Document Center&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site to centrally manage documents in your enterprise&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 64.5pt" height="86"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #c0504d; color: white; font-family: calibri; height: 64.5pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" height="86"&gt;Enterprise&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Records Center&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;This template creates a site designed for records management. Records managers can configure the routing table to direct incoming files to specific locations. The site prevents records from being modified after they are added to the repository.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 39pt" height="52"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #953735; color: white; font-family: calibri; height: 39pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" height="52"&gt;Enterprise&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Site Directory&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site for listing and categorizing important sites in your organization. It includes different views for categorized sites, top sites, and a site map.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 51.75pt" height="69"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #c0504d; color: white; font-family: calibri; height: 51.75pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" height="69"&gt;Enterprise&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Report Center&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site for creating, managing, and delivering Web pages, dashboards, and key performance indicators that communicate metrics, goals, and business intelligence information.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 64.5pt" height="86"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #953735; color: white; font-family: calibri; height: 64.5pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" height="86"&gt;Enterprise&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Search Center With Tabs&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site for delivering the search experience. The welcome page includes a search box with two tabs: one for general searches, and another for searches for information about people. You can add and customize tabs to focus on other search scopes or result types.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 51.75pt" height="69"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #c0504d; color: white; font-family: calibri; height: 51.75pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" height="69"&gt;Enterprise&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;My Site Host&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site used for hosting personal sites (My Sites) and the public People Profile page. This template needs to be provisioned only once per Shared Service Provider, please consult the documentation for details.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 26.25pt" height="35"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #953735; color: white; font-family: calibri; height: 26.25pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" height="35"&gt;Enterprise&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Search Center&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A site for delivering the search experience. The site includes pages for search results and advanced searches.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 64.5pt" height="86"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #c0504d; color: white; font-family: calibri; height: 64.5pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" height="86"&gt;Publishing&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Collaboration Portal&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #c0504d; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #c0504d none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A starter site hierarchy for an intranet divisional portal. It includes a home page, a News site, a Site Directory, a Document Center, and a Search Center with Tabs. Typically, this site has nearly as many contributors as readers and is used to host team sites.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 77.25pt" height="103"&gt;         &lt;td class="xl66" style="font-weight: 700; font-size: 11pt; background: #953735; color: white; font-family: calibri; height: 77.25pt; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" height="103"&gt;Publishing&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 79pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="105"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;Publishing Portal&lt;/form&gt;&lt;/td&gt;          &lt;td class="xl67" style="font-weight: 400; font-size: 10pt; background: #953735; width: 287pt; color: white; font-family: arial; text-decoration: none; text-underline-style: none; text-line-through: none; mso-pattern: #953735 none" width="382"&gt;&lt;form id="aspnetForm" name="aspnetForm" action="ViewResource.aspx?resourceId=2417&amp;amp;" method="post"&gt;A starter site hierarchy for an Internet-facing site or a large intranet portal. This site can be customized easily with distinctive branding. It includes a home page, a sample press releases subsite, a Search Center, and a login page. Typically, this site has many more readers than contributors, and it is used to publish Web pages with approval workflows.&lt;/form&gt;&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/form&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-7813598852886507860?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/7813598852886507860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=7813598852886507860' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/7813598852886507860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/7813598852886507860'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/05/moss-2007-templates.html' title='MOSS 2007 Templates'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-4832438376736228571</id><published>2008-04-28T19:16:00.001-07:00</published><updated>2008-04-28T21:04:38.311-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><title type='text'>WPF Localization - LocBaml</title><content type='html'>&lt;p&gt;In my &lt;a href="http://toadcode.blogspot.com/2008/04/wpf-localization-resx-option.html"&gt;last post&lt;/a&gt; I talked about using resource files (resx) to localize your WPF application. This time it is about using LocBaml to localize your WPF application. The big difference in the two approaches is that LocBaml allows you to localize your application after the fact. That is, most applications you have to plan up front to do localization, but with LocBaml you can still localize your application after development. While lots of people will say this I don't really believe it. The reason this is not true in my opinion is because LocBaml only works if all your strings are sourced in XAML. This means that if you use strings that are located in a constant file or a resx file LocBaml&amp;#160; will not work to localize your application. Unless you are building a smaller application or you just happen to set up your architecture so all strings are sourced in XAML you are out of luck. So really when they say you can localize your application after the fact you really can only do it if you happened to conform your application to the requirements of LocBaml. On that note lets get into preparing the application with UIDs. &lt;/p&gt;  &lt;p&gt;In my previous example I had three labels in my application. The first label had its text defined in XAML. The other two used resx files to define their text. In this walk through we will update the first label so we can localize it as well. The first thing we want to take note of is the current XAML layout of our label. &lt;/p&gt;  &lt;p&gt;   &lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:680484b8-20bc-415b-b152-a23ccba3bd2a" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="xml"&gt;&amp;lt;Label Height="28" Margin="10,13,33,0" 
  Name="lblFromXAML" Content="Text from XAML" 
  VerticalAlignment="Top"&amp;gt;&amp;lt;/Label&amp;gt;&lt;/pre&gt;&lt;/div&gt;
You will notice nothing special about the XAML here. Now we will run the LocBaml commands. To do this we open a visual studio command prompt and run msbuild with the updateuid command switch (msbuild /t:updateuid wpflocalization.csproj). After running this command we get the follow results in the command windows.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh4.ggpht.com/GenZodd0/SBaeTMBBpZI/AAAAAAAAACI/AHnn6gTztvI/s1600-h/image%5B14%5D.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="304" alt="image" src="http://lh5.ggpht.com/GenZodd0/SBaeTcBBpaI/AAAAAAAAACQ/ym7zlbTONEE/image_thumb%5B10%5D.png?imgmax=800" width="587" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; Now if you look at the XAML that makes up the label you will see the addition of UID attribute. &lt;/p&gt;

&lt;p&gt;
  &lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:b017a570-1de4-420a-bccf-6786dbcfd501" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="xml"&gt;&amp;lt;Label x:Uid="lblFromXAML" Height="28" Margin="10,13,33,0" 
Name="lblFromXAML" Content="Text from XAML" 
 VerticalAlignment="Top"&amp;gt;&amp;lt;/Label&amp;gt;&lt;/pre&gt;&lt;/div&gt;
This UID attribute tags each localization part of the application and will allow the LocBaml utility to find each one of these areas for localization. Now when you build the application you will have a .resource.dll file in the en-US folder. It is now time to jump through hoop 1 (really hoop two because setting up UIDs should be hoop 1). You must get the SDK and build the LocBaml project to get the LocBaml.exe. Once you have done this it is time for hoop 2. Run LocBaml against the US resource dll using the following syntax: &lt;strong&gt;LocBaml.exe /parse en-US/WpfLocalization.resources.dll /out:UsText.csv. &lt;/strong&gt;This will export all the XAML fields marked with a UID to the csv file. The csv file that is created has&amp;#160; a few lines per UID item. &lt;a href="http://lthama.blu.livefilestore.com/y1pvyAhMT3mPp-Ymd_yk3n9CGq58ZJCjKvFW-br-kHQL8pWJJMT14RFIfX5RkYKMj2EDq57FJntq44u3_nxDSfuAzW8syyH7sPd/english.csv?download"&gt;Here is what the csv file looks like&lt;/a&gt;. Had enough yet? Sorry we are not done. You should notice that in the csv file only has the text for one of our three labels (lblFromXAML). The text that is the resource file is not pulled out into the csv file. This is because LocBaml only works when all strings are sourced in XAML (something you have to take into account at design time). Now you need to pass this csv file off to someone to translate. Now Hoop 3, it is time to run LocBaml again to create our de-DE resources.dll. Once that is done you can drop that dll into your resources directory and change your localization to de-DE and the new text should show up. &lt;/p&gt;

&lt;p&gt;If you could not tell there are a lot of hoops to get through doing localization this way. Personal, I think the process is pretty ridiculous. I have no idea why someone would do localization this way instead of using resx files. I see only cons to this approach and no advantages over the resx approach. If you have a different opinion I would really like to hear your thoughts. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-4832438376736228571?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/4832438376736228571/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=4832438376736228571' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4832438376736228571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4832438376736228571'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/04/wpf-localization-locbaml.html' title='WPF Localization - LocBaml'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/GenZodd0/SBaeTcBBpaI/AAAAAAAAACQ/ym7zlbTONEE/s72-c/image_thumb%5B10%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-7159627531651974823</id><published>2008-04-26T19:02:00.001-07:00</published><updated>2008-04-27T15:14:22.224-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><title type='text'>WPF Localization - RESX Option</title><content type='html'>&lt;p&gt;About a year ago I was building a WPF project in .Net 3.0 and Visual Studio 2005. I wanted to revisit this subject and see what has changed in .Net 3.5 and Visual Studio 2008. I will make a few of these posts to try and cover all the different options (RESX option, LocBaml option, Resource Dictionary Option). In this blog I will focus on using a resx file to localize an application. &lt;/p&gt;  &lt;p&gt;To show how the resx option is done I created a WPF form with three labels on it. The first label has is text set inline in XAML, the second has it text set via code behind from the resx file and the third has its text set via XAML accessing the resx file. &lt;/p&gt;  &lt;p&gt;The first thing that needs to happen to setup a project for localization is a small change to the project file. To make this change you will need to open the project file in notepad (or some other generic editor). In the first PropertyGroup section you need to add the follow XML node &amp;lt;UICulture&amp;gt;en-US&amp;lt;/UICulture&amp;gt;. So the project file node would look like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/GenZodd0/SBPex8BBpTI/AAAAAAAAABU/7k6EPgH_3AI/s1600-h/image%5B19%5D.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="image" src="http://lh5.ggpht.com/GenZodd0/SBPeyMBBpUI/AAAAAAAAABg/SCFAXzDCVF8/image_thumb%5B11%5D.png?imgmax=800" width="227" align="left" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Adding this to the project file config will cause the IDE to create a resource.dll when you compile. Now we need to create our resx file. I like to create a Resources folder to keep my resx files in (You will have to create a resx file for each language you want to have). I created three labels in my XAML to show how this will work. &lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:5102dda6-85d9-4bad-bbfa-0fc3a9bc735f" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="xml"&gt;&amp;lt;Window x:Class="WpfLocalization.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300"    
    xmlns:properties="clr-namespace:WpfLocalization.Resources"&amp;gt;
    &amp;lt;Grid&amp;gt;
        &amp;lt;Label Height="28" Margin="10,13,33,0" 
               Name="lblFromXAML" Content="Text from XAML" 
               VerticalAlignment="Top"&amp;gt;&amp;lt;/Label&amp;gt;
        &amp;lt;Label Height="28" Margin="10,43,33,0" Name="lblFromResource" 
               VerticalAlignment="Top"&amp;gt;Label&amp;lt;/Label&amp;gt;
        &amp;lt;Label Height="28" Margin="10,71,33,0" Name="lblXAMLResource" 
               VerticalAlignment="Top"
               Content="{x:Static properties:UIStrings.lblXAMLResource}"&amp;gt;&amp;lt;/Label&amp;gt;
    &amp;lt;/Grid&amp;gt;
&amp;lt;/Window&amp;gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The first label is just used to show that text in the XAML does not change when we change the culture. The second label will be changed in code using the following:&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:8888e48e-3b62-4c8e-a445-6c775d549036" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="c#"&gt;public Window1()
{
    //UIStrings.Culture = new System.Globalization.CultureInfo("de-DE");
    InitializeComponent();
    
    lblFromResource.Content = UIStrings.lblFromResourcesText;
}&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Pretty simple code. You will notice the third label has a binding in the content to do this. In my opinion this is the best way to do this as all your UI display is isolated to the XAML. However, I realize that in an enterprise application you will probably need code to decided what text is displayed (this could be accomplished using a trigger in&amp;#160; your style but that discussion is for another time). In order to do this binding though you have to include the xmlns import to your resx file. You will note that I imported the clr-namespace of WpfLocalization.Resources which is the namespace of my resx file. I can then bind to the static resource of properties:UIStrings.lblXAMLResource which pulls the text for my lblXAMLResource label (I gave my resource string and my label the same name).&amp;#160; When I run the application here is what I get.&lt;a href="http://lh6.ggpht.com/GenZodd0/SBPeycBBpVI/AAAAAAAAABo/0wW1xYb276E/s1600-h/image%5B13%5D.png"&gt;&lt;img height="120" alt="image" src="http://lh3.ggpht.com/GenZodd0/SBPeysBBpWI/AAAAAAAAABw/DMvMicnsiCY/image_thumb%5B7%5D.png?imgmax=800" width="240" align="right" /&gt;&lt;/a&gt; Now I can copy my current resx file of UIStrings.resx and make a new resx file called UIStrings.de-DE.resx. I can then edit the text in this new resx file for my German text. The next time I build the compiler will create a secondary resource.dll file for de_DE. If I un-comment the line of code that is commented out above (this code changes the culture form the default of US to de-DE which is Germany) and run the application again I get different text as the resx resource that is used is for my de-DE culture. &lt;a href="http://lh4.ggpht.com/GenZodd0/SBPey8BBpXI/AAAAAAAAAB4/uAmYOXYLZIs/s1600-h/image%5B18%5D.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="122" alt="image" src="http://lh4.ggpht.com/GenZodd0/SBPey8BBpYI/AAAAAAAAACA/N0CjC3Ib6BY/image_thumb%5B10%5D.png?imgmax=800" width="253" align="right" border="0" /&gt;&lt;/a&gt; I have &lt;a href="http://lthama.blu.livefilestore.com/y1pvyAhMT3mPp9NR0p6O27-fld_kRcXVPAYhOclmk85aU0banKLHsnNlnX-xLUEz6fwKjKGVR08n2gW5euGqbWVUmV_FJyuhvYr/WpfLocalization.zip?download"&gt;uploaded the source code&lt;/a&gt; for this example as well if you would like to see the entire solution. &lt;/p&gt;

&lt;p&gt;You will notice that at the top of the resx editor you have the ability to select rather or not the values in the resx are internal or public. This is new to .Net 3.5 and Visual Studio 2008. In Visual Studio 2005 you could not make these values public. They were always private and there for not accessible to the XAML file via the binding method or accessible to other projects in your solution. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-7159627531651974823?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/7159627531651974823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=7159627531651974823' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/7159627531651974823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/7159627531651974823'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/04/wpf-localization-resx-option.html' title='WPF Localization - RESX Option'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/GenZodd0/SBPeyMBBpUI/AAAAAAAAABg/SCFAXzDCVF8/s72-c/image_thumb%5B11%5D.png?imgmax=800' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-4317427764311145871</id><published>2008-04-24T18:50:00.001-07:00</published><updated>2008-04-24T18:53:18.349-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interop'/><title type='text'>Excel XIRR and C#</title><content type='html'>&lt;p&gt;I have spend that last couple days trying to figure out how to run and Excel XIRR function in a C# application. This process has been more painful that I thought it would have been when started. To save others (or myself the pain in the future if I have to do it again) I thought I would right a post about this (as post about XIRR in C# have been hard to come by). &lt;/p&gt;  &lt;p&gt;Lets start with the easy part first. In order to make this call you need to use the Microsoft.Office.Interop.Excel dll. When you use this dll take note of what version of the dll you are using. If you are using a version less then 12 (at the time of this writing 12 was the highest version) you will not have an XIRR function call. This does not mean you cannot still do XIRR though. As of version 12 (a.k.a Office 2007) the XIRR function is a built in function to Excel. Prior version need an add-in to use this function. Even if you have version 12 of the interop though it does not mean you will be able to use the function. The ability to use the function is determined by the version of Office install on the machine hosting the application. So if your interop dll version is 12 but the &lt;strong&gt;&lt;u&gt;host machine only has version 11&lt;/u&gt;&lt;/strong&gt; installed you cannot directly call the XIRR function even though the Interop dll gives you that method. If however the host machine &lt;strong&gt;does&lt;/strong&gt; have office 12 installed you can call the XIRR function directly. &lt;/p&gt;  &lt;p&gt;Ok lets get into the details of doing it. First add the Microsoft.Office.Interop.Excel.dll into your &lt;a href="http://msdn2.microsoft.com/en-us/library/wkze6zky(VS.80).aspx"&gt;project references&lt;/a&gt; (It is best to import the latest version of the dll that you have).&amp;#160; Now create your excel object as in the code below:&lt;/p&gt;  &lt;p&gt;   &lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:868531f8-0a4d-47fc-bcbd-04e0c6024c24" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="c#"&gt;// value to store the results
double xirrValue;

// create the new excel interop object 
ApplicationClass xlApp = new ApplicationClass();&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Now we get to the tricky part (or at least it was for me). There are really two things we are going to check here. First we need to check what version of office is installed. If the version of office is greater than 11 the call is much easier. If the version of office is less then 11 we have more work to do.&lt;/p&gt;

&lt;p&gt;Since versions of office before 12 don't include the XIRR function we have to register the &lt;a href="http://www.cpearson.com/excel/ATP.htm"&gt;Analysis tool box add-in&lt;/a&gt;. To register the add-in we make the xlApp.RegisterXLL call in the code below. Once the add-in has been register we can make a call to the XIRR macro using the Run() method. &lt;/p&gt;

&lt;p&gt;Now there is one last issue to get by. The Run() method take something like 30 optional parameters. Now if you were doing this in VB.net this would not be an issue as you can just not pass in those extra optional parameters. However, for C# you have to pass something in for each parameter. You may think you can pass in null for these extra parameters but you would be wrong. You have to pass in System.Reflection.Missing.Value (thanks to &lt;a href="http://blogs.msdn.com/gabhan_berry/archive/2008/02/06/excel-s-optional-parameters-and-missing-value-a-c-workaround.aspx"&gt;Gabhan Berry&lt;/a&gt; for setting me straight on this).

  &lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:0bdfc10f-ebe5-4652-bd57-b29f2119dd9d" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="c#:firstline[1]"&gt;// See what version of Excel is installed
if (Decimal.Parse(xlApp.Version) &amp;gt; 11)
{
    xirrValue = xlApp.WorksheetFunction.Xirr(_cash.ToArray(), _dates.ToArray(), 1);
}
else
{
    xlApp.RegisterXLL(xlApp.Path + @"\Library\Analysis\ANALYS32.XLL");
    xirrValue = (double)xlApp.Run("XIRR", _cash.ToArray(), _dates.ToArray(), 1,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value,
        System.Reflection.Missing.Value);
}&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;The rest of the code example above shows you what else needs to be done to get you there. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-4317427764311145871?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/4317427764311145871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=4317427764311145871' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4317427764311145871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/4317427764311145871'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/04/excel-xirr-and-c.html' title='Excel XIRR and C#'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-8540087201119937540</id><published>2008-02-28T12:45:00.001-08:00</published><updated>2008-02-28T12:45:11.690-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Utilities'/><title type='text'>Unit Test Object Properties</title><content type='html'>&lt;p&gt;Unit testing of entities is something that never gets done very well for a number of reasons, the objects are pretty simplistic, developers get board righting that type of code, etc. It seems that one area unit tests of this type of business object fails is in testing their properties. The test covers setting and retrieving the properties but what about Business Objects with CRUD behavior? What about testing Data Access layer save functionality. Just because the save method does not error on you does not mean the save works. To really have a good unit test you need to save the object and then get the object again and compare all the properties to make sure each property was saved as expected. &lt;/p&gt;  &lt;p&gt;To test each property I often see developers writing code that does a one to one compare on the two objects (the object they tried to save and the object that was saved). This gets boring really quickly and can explain why a lot of the time you do not see full code coverage. To help make this easier I recently wrote&amp;#160; a simple piece of code to handle all this property comparison. With the code below you can simply pass it two objects of the same type and it will do a property compare on each object to make sure each matching property has the same value. &lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:87ad115c-4281-4ab0-94ac-52288e6e2a52" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="c#:firstline[1]"&gt;public void CompareObjectProperties(Object newOjbect, Object dbObject)
{
    PropertyInfo[] propInfo = newOjbect.GetType().GetProperties();

    foreach (PropertyInfo prop in propInfo)
    {
        PropertyInfo dbPropinfo = dbObject.GetType().GetProperty(prop.Name);
        string newProp = prop.GetValue(newOjbect, null).ToString();
        string dbProp = dbPropinfo.GetValue(dbObject, null).ToString();

        // Make sure each value was saved to the database correctly
        Assert.AreEqual(newProp, dbProp, "The value on the object did not match the value saved to the second object");
    }
}&lt;/pre&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-8540087201119937540?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/8540087201119937540/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=8540087201119937540' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/8540087201119937540'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/8540087201119937540'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/02/unit-test-object-properties.html' title='Unit Test Object Properties'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-2476906959496909958</id><published>2008-02-19T14:17:00.001-08:00</published><updated>2008-02-19T14:17:20.682-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><title type='text'>WPF Improvements on the way</title><content type='html'>&lt;p&gt;Found this information today on &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/02/19/net-3-5-client-product-roadmap.aspx"&gt;Scott Gu's blog&lt;/a&gt;. All great news about WPF improvements that are on their way.&lt;/p&gt;  &lt;h5&gt;&lt;u&gt;WPF Performance Improvements&lt;/u&gt;&lt;/h5&gt;  &lt;p&gt;This summer we are also planning to release a servicing update to WPF that includes a bunch of performance optimizations that improve its text, graphics, media and data stack. These include:&lt;/p&gt;  &lt;p&gt;- Moving the DropShadow and Blur bitmap effects, which are currently software rendered, to be hardware accelerated (making them many times faster). The APIs for these effects will stay the same as they are today (which means you do not need to change any code nor recompile your apps to take advantage of these improvements).&lt;/p&gt;  &lt;p&gt;- Text scenarios, especially when used in Visual and DrawingBrush scenarios, will be substantially faster. The APIs for these scenarios also stay the same (which means you do not need to change any code nor recompile to take advantage of the performance improvements).&lt;/p&gt;  &lt;p&gt;- Media and video performance scenarios will also be much faster (also no need to change any code nor recompile to take advantage of the improvements).&lt;/p&gt;  &lt;p&gt;- We&amp;#8217;ll be including a new WriteableBitmap API that enables real-time bitmap updates from a software surface. We&amp;#8217;ll also be adding support for a powerful new effects API that enables you to build richer graphics scenarios.&lt;/p&gt;  &lt;p&gt;- We&amp;#8217;ll also be including new data scalability improvements that can be leveraged for data editing scenarios. These include container recycling and data virtualization support that make it easier to build richer data visualization controls.&lt;/p&gt;  &lt;h5&gt;&lt;u&gt;WPF Control Improvements&lt;/u&gt;&lt;/h5&gt;  &lt;p&gt;Later this year we are also planning to release a number of new controls for WPF.&amp;#160; Included in the list we are working on are DataGrid, Ribbon, and Calendar/DatePicker controls.&lt;/p&gt;  &lt;h5&gt;&lt;u&gt;VS 2008 WPF Designer Improvements&lt;/u&gt;&lt;/h5&gt;  &lt;p&gt;We are also planning to release a servicing update of VS 2008 that includes a number of feature additions to its WPF designer. These include event tab support within the property grid for control events, toolbox support within source mode, and a variety of other common asks and improvements.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-2476906959496909958?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/2476906959496909958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=2476906959496909958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/2476906959496909958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/2476906959496909958'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/02/wpf-improvements-on-way.html' title='WPF Improvements on the way'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-8902199530529279802</id><published>2008-02-14T08:37:00.001-08:00</published><updated>2008-02-28T11:13:57.910-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><title type='text'>WPF Validation</title><content type='html'>&lt;p&gt;I recently had to build out a validation solution for a WPF project I was working on. For those of you that have not worked with WPF (you are missing out) validation works differently. At first I was unsure about the way validation works in WPF and it seemed a little incomplete. I still believe it is incomplete, mainly because there is no built in way to do complete form validation unless you implement a custom solutions. This brings us to the point of this post. I recently wrote up an example of a few different ways to do complete form validation using WPF. I created a Validation manager that allows me to do this. The validation manager utilizes the creation of custom validation rules. You can download the whole paper and the example solution &lt;a href="http://www.babbitts.net/LinkClick.aspx?link=WPFValidationExample.zip&amp;amp;tabid=212&amp;amp;mid=13103"&gt;here&lt;/a&gt;. The paper includes validation approaches other developers have done as well. &lt;/p&gt;&lt;p&gt;The validation manager that is used in this approach allows you to handle validation at the form level and allows you to have your validation logic separated from your business objects. This is one thing the other approaches do not let you have. The validation manager is also not coupled at all with the DataContext of the page so it gives you more flexibility. The &lt;a href="http://www.codeproject.com/WPF/wpfvalidation.asp"&gt;IDataError approach&lt;/a&gt; Paul Stovell uses can be helpful but is tightly coupled with the DataContext. There is also one other very nice feature the Validation Manager I created gives you. It gives you the ability to invalidate a field on the page programmatically. Even if all the custom validation rules that are bound to in pass you can still use the Validation manager to invalidate the field and put an error message on it. This gives you great extensibility to build out a validation framework and use the validation manager to handle invalidating whatever field needs to be invalidated. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-8902199530529279802?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/8902199530529279802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=8902199530529279802' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/8902199530529279802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/8902199530529279802'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/02/wpf-validation.html' title='WPF Validation'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-6890403564650423756</id><published>2008-02-12T13:15:00.001-08:00</published><updated>2008-02-12T13:15:57.150-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><title type='text'>CollectionView Filter</title><content type='html'>&lt;p&gt;For those of you who have worked with data collections in WPF if you have probably learned how helpful a &lt;a href="http://msdn2.microsoft.com/en-us/library/system.windows.data.collectionview.aspx"&gt;CollectionView&lt;/a&gt; can be. CollectionViews let you filter, group and sort a collection of data without any requiring of the data. Setting a CollectionView up to filter or group data is actually pretty easy. Here is an example of how you would setup a Collection into a CollectionView to be filtered.&lt;/p&gt;  &lt;p&gt;   &lt;div class="wlWriterSmartContent" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:d71be150-823d-4dbb-9c50-dd66f1d65537" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre name="code" class="c#"&gt;ListCollectionView _view; 

public Window1() 

{ 
     InitializeComponent(); 

     string[] myValues = new string[] { "Red Car", "Red Truck", "Blue Car", "Yellow Truck" }; 
     _view = new ListCollectionView(myValues); 
     this.DataContext = _view; 
} 

private void FilterTrucks(Object sender, RoutedEventArgs args) 
{ 

	if (_view.CanFilter &amp;amp;&amp;amp; (ShowTrucks.IsChecked == true)) 
		_view.Filter = new Predicate&amp;lt;object&amp;gt;(IsValueTruck); 
	else 

	{ 
		 // Remove the filter 
		 _view.Filter = null; 
	} 

} 

public bool IsValueTruck(Object value) 

{ 
     return (value.ToString().Contains("Truck")); 
} 



&lt;/pre&gt;&lt;/div&gt;
 &lt;/p&gt;

&lt;p&gt;&lt;img height="322" alt="" src="http://blufiles.storage.msn.com/y1pJoVTpNItOD9bzc7YSx3dxsCg_fM0WHBvVlRxORRnS5c4i2iHDFPQCilG0bLeAHDsc8alDC-u9kk" width="326" align="left" /&gt;&lt;/p&gt;

&lt;p&gt;You can see that when the &amp;quot;Show only Trucks&amp;quot; checkbox is check the list is automatically filtered to show only items that are trucks. You do not need to write any code that refreshes the UI this is all handled for you by the WPF binding and the ListCollectionView. You can try changing the ListCollectionView to just a CollectionView. If you do this you will see that the UI does not refresh the list when the check box is selected. This is because CollectionView itself does not handle the UI level view update. You can use &lt;a href="http://sandyvalley.spaces.live.com/blog/cns!AB1484B25F28E501!444.entry"&gt;ListCollectionView&lt;/a&gt;, &lt;a href="http://sandyvalley.spaces.live.com/blog/cns!AB1484B25F28E501!461.entry?_c=BlogPart"&gt;CollectionViewSource&lt;/a&gt; or &lt;a href="http://sandyvalley.spaces.live.com/blog/cns!AB1484B25F28E501!508.entry"&gt;BindingListCollectionView&lt;/a&gt; (this type is used for binding and filtering ADO.net objects like datasets) to filter and bind to lists. We have covered &lt;a href="http://sandyvalley.spaces.live.com/blog/cns!AB1484B25F28E501!444.entry"&gt;ListCollectionView&lt;/a&gt; binding and filter. In future posts I will cover the other types as well as how to set up grouping and sorting.&lt;img height="317" alt="" src="http://blufiles.storage.msn.com/y1pJoVTpNItOD-W8-IgG5Z_e4GopsXOiux8FaS8bN4RMicGxbf_Thv2xP6XKzAs0ZuJ8o6UtJr2_fA" width="328" align="left" /&gt;&lt;/p&gt;
&lt;iframe style="border-right: #dde5e9 1px solid; padding-right: 0px; border-top: #dde5e9 1px solid; padding-left: 0px; padding-bottom: 0px; margin: 3px; border-left: #dde5e9 1px solid; width: 240px; padding-top: 0px; border-bottom: #dde5e9 1px solid; height: 66px; background-color: #ffffff" marginwidth="0" marginheight="0" src="http://cid-ab1484b25f28e501.skydrive.live.com/embedrowdetail.aspx/Public/CollectionViewFilterExample.zip" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-6890403564650423756?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/6890403564650423756/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=6890403564650423756' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/6890403564650423756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/6890403564650423756'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/02/collectionview-filter.html' title='CollectionView Filter'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8684086013521169566.post-1683663907974229051</id><published>2008-02-11T13:49:00.001-08:00</published><updated>2008-02-12T13:21:53.640-08:00</updated><title type='text'>New Code Site</title><content type='html'>&lt;p&gt;I have been creating a lot of coding examples on my personal live spaces account. I have recently come to the realization that spaces just does not give me enough flexibility to really create good examples. It is also mixed in with all my other thoughts on life. Because of that I have decided to create a new blog dedicated to thoughts on code. I plan on uploading different code samples here that will be on different topics such as WPF, Silverlight, LINQ and more. It is really for my own enjoyment and to give me a place to store examples I create on how to do things. Hopefully it will benefit others out there as well. I will be spending time porting previous examples from my spaces account to here. Part of this port will include layout the examples as well as including links to the source code for all projects. &lt;/p&gt;  &lt;p&gt;I hope you all enjoy!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8684086013521169566-1683663907974229051?l=toadcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://toadcode.blogspot.com/feeds/1683663907974229051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8684086013521169566&amp;postID=1683663907974229051' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/1683663907974229051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8684086013521169566/posts/default/1683663907974229051'/><link rel='alternate' type='text/html' href='http://toadcode.blogspot.com/2008/02/public-void-test-string-test.html' title='New Code Site'/><author><name>The Toad</name><uri>http://www.blogger.com/profile/05518398381728309131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
