<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PeterKellner.net &#187; VS2010</title>
	<atom:link href="http://peterkellner.net/category/vs2010/feed/" rel="self" type="application/rss+xml" />
	<link>http://peterkellner.net</link>
	<description>Microsoft Focused, JavaScript,HTML5 (ExtJS, SenchaTouch &#38; Windows 8 Metro)</description>
	<lastBuildDate>Fri, 11 May 2012 16:43:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Building a Simple Window Service Application in Visual Studio 2010 That Runs, Sleeps and Stops</title>
		<link>http://peterkellner.net/2012/03/26/building-a-simple-window-service-application-in-visual-studio-2010-that-runs-sleeps-and-stops/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-a-simple-window-service-application-in-visual-studio-2010-that-runs-sleeps-and-stops</link>
		<comments>http://peterkellner.net/2012/03/26/building-a-simple-window-service-application-in-visual-studio-2010-that-runs-sleeps-and-stops/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 18:24:46 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2012/03/26/building-a-simple-window-service-application-in-visual-studio-2010-that-runs-sleeps-and-stops/</guid>
		<description><![CDATA[Introduction
The goal is to create a simple Service in Windows 7 (or other similar OS’s) with Visual Studio 2010 that simply starts, sleeps for 15 seconds, then stops.&#160; I realize this is not that useful, but basically, it covers the case of building a service that actually does something and when finished stops.&#160; In my [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>The goal is to create a simple <a href="http://en.wikipedia.org/wiki/Windows_service">Service</a> in <a href="http://windows.microsoft.com/en-us/windows7/products/home">Windows 7</a> (or other similar OS’s) with <a href="http://www.microsoft.com/visualstudio/en-us">Visual Studio 2010</a> that simply starts, sleeps for 15 seconds, then stops.&#160; I realize this is not that useful, but basically, it covers the case of building a service that actually does something and when finished stops.&#160; In my personal case, my thread has a while(true) loop which keeps looking for new work and only completes when certain conditions are met (like a fatal error that is non recoverable).</p>
<p>Microsoft has given us a pretty good set of docs and walk through.&#160; You can find them all here:&#160; <a href="http://msdn.microsoft.com/en-us/library/y817hyb6.aspx">http://msdn.microsoft.com/en-us/library/y817hyb6.aspx</a></p>
<p>&#160;</p>
<h2>The Steps</h2>
<p>Create a new Visual Studio Project of type <a href="http://en.wikipedia.org/wiki/Windows_service">“Windows Service”</a></p>
<p>&#160;</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image16.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image_thumb15.png" width="383" height="299" /></a></p>
<p>Once the project is created, make sure you have the design surface up for Service1 [Design] and right click on it and say “Add Installer”.</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image17.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image_thumb16.png" width="458" height="189" /></a></p>
<p>Now, you’ll get to “gear” icons that you can set properties for.&#160; They are “serviceProcessInstaller1” and “serviceInstaller1” as follows:</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image18.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image_thumb17.png" width="410" height="283" /></a></p>
<p>Select “serviceProcessInstaller1” and in it’s properties window change the account to “LocalSystem”.&#160; You should have a screen that looks like the following:</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image19.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image_thumb18.png" width="329" height="227" /></a></p>
<p>Then, on the other gear “serviceInstaller”, change the nanes as follows.&#160; I’m naming my service “MyDoNothingService”.</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image20.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image_thumb19.png" width="415" height="338" /></a></p>
<p>Now, rebuild your project and you’ll get an exe file in your /bin/Debug folder.&#160; Open that folder with the Visual Studio Command Prompt (elevated as admin).&#160; To install the service, enter the command:</p>
<p><strong>InstallUtil WindowsServiceCreateSample.exe</strong></p>
<p>&#160;</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image21.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image_thumb20.png" width="603" height="79" /></a></p>
<p>You should get some messages that end with “The Commit phase completed successfully”, then “The Transaction install has completed”.</p>
<p>Now, you should see that you have the service in your services panel (you can get there by going to control panel / Administrative / Services or simple run “services” from your start button.</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image22.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image_thumb21.png" width="390" height="142" /></a></p>
<p>(sorry for the rename here to MyServiceTest, but I got distracted and had to come back and rename the project)</p>
<p>So, now we want to add something to this project.&#160; Let’s just add to the OnStart event of Service1.cs something that starts a thread that sleeps for 15 seconds, then stops the thread.&#160; Very simple code as follows:</p>
<pre class="csharpcode">  <span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> OnStart(<span class="kwrd">string</span>[] args)
        {
            <span class="kwrd">new</span> Thread(()
                      =&gt;
            {
                Thread.Sleep(15000); <span class="rem">// sleep 15 seconds</span>
                <span class="kwrd">this</span>.Stop();
            }).Start();
        }</pre>
<p>
<style type="text/css">
.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; }</style>
<p>Now, before we can install the service, we first need to uninstall it.&#160; Very easy, just add a /u to the end of your install command.</p>
<p><strong>InstallUtil WindowsServiceCreateSample.exe /u</strong></p>
<p>You should be greeted with “The uninstall has completed.”.</p>
<p>Now, when you try and reinstall, sadly, you might get this error: “<strong>Error 1001. The specified service has been marked for deletion”.&#160; </strong>If you do, thanks to a post by <a href="http://www.laxdal.org/node/30">Mr. Laxdel</a>, all you have to do is exit your services dialog and restart the service.</p>
<p>Assuming you left the default autoLog set to true as follows:</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image23.png"><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://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image_thumb22.png" width="436" height="272" /></a></p>
<p>In your event viewer, you should see you service starting and stopping as follows:</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image24.png"><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://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/image_thumb23.png" width="593" height="193" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<h2>Conclusions</h2>
<p>That was pretty straight forward.&#160; Hopefully, you can follow along and generate the same thing yourself.&#160; Here is the source code attached for a visual studio 2010 project if for some reason you have trouble recreating it yourself.&#160; HTH’s!</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:2e502815-6df7-416f-bba2-da664c6304ef" class="wlWriterEditableSmartContent">
<p>Visual Studio 2010 Project <a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2012/03/WindowsServiceCreateSample.zip" target="_blank">Project</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2012/03/26/building-a-simple-window-service-application-in-visual-studio-2010-that-runs-sleeps-and-stops/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft ASP.NET presentations at Silicon Valley Code Camp on 10/8 and 10/9</title>
		<link>http://peterkellner.net/2011/10/02/microsoft-asp-net-presentations-at-silicon-valley-code-camp-on-108-and-109/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=microsoft-asp-net-presentations-at-silicon-valley-code-camp-on-108-and-109</link>
		<comments>http://peterkellner.net/2011/10/02/microsoft-asp-net-presentations-at-silicon-valley-code-camp-on-108-and-109/#comments</comments>
		<pubDate>Sun, 02 Oct 2011 22:01:19 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[asp.net]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2011/10/02/microsoft-asp-net-presentations-at-silicon-valley-code-camp-on-108-and-109/</guid>
		<description><![CDATA[&#160;
SV Code Camp is happening next weekend with well over 200 sessions.&#160; The conference is really technology agnostic and try hard to keep it that way, but I am an ASP.NET guy these days so I think it reasonable I take my Code Camp Coordinator hat off for the moment and put on my ASP.NET [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p><a href="http://www.siliconvalley-codecamp.com/">SV Code Camp</a> is happening next weekend with well over 200 sessions.&#160; The conference is really technology agnostic and try hard to keep it that way, but I am an ASP.NET guy these days so I think it reasonable I take my Code Camp Coordinator hat off for the moment and put on my ASP.NET hat.&#160; As an ASP.NET Microsoft MVP, I feel I’m in a good position to give a tour of some sessions in ASP.NET and throw in my own 2 cents.&#160; Below are a list of these sessions in no particular order.</p>
<p>&#160;</p>
<h3><a href="http://www.siliconvalley-codecamp.com/Sessions.aspx?OnlyOne=true&amp;id=687">Demystifying ASP.NET MVC, $(Lino).MVC{getknowledge()}</a></h3>
<p><strong>Sunday, October 9th 9:45AM</strong></p>
<p>MVC (Model View Controller) is one of the hottest patterns around building web sites these days no matter what the technology. When Microsoft first introduced Web programming to Visual Studio, they did it such that almost anyone who had done windows programming (VB or other) could quickly come up to speed and build a web site. Personally, this what sucked me into web programming. Drag a button, drag a textbox, double click on the button and add some code to set the text box and WHAM, you have a web site. Unfortunately, as things get more complicated, this model does not scale so well. <a href="http://www.asp.net/mvc">ASP.NET&#8217;s MVC implementation</a> does scale, it takes a little bit of flipping your mind around if you are Web Forms programmer, but definitely worth learning about and seeing if it&#8217;s right for you.</p>
<p><a href="http://www.siliconvalley-codecamp.com/Speakers.aspx?AttendeeId=529">Lino Tadros</a> is one of my favorite presenters and I&#8217;m sure will give you a much better understanding of MVC and how it fits into the ASP.NET programming model. I strongly recommend this one. Lino is the CEO for one of the top Application development and training companies in the world that partners with <a href="http://www.microsoft.com/en-us/default.aspx">Microsoft</a>, <a href="http://falafel.com/default.aspx">Falafel Software</a>. In other words, GO TO THIS SESSION!</p>
<p>&#160;</p>
<h3><a href="http://www.siliconvalley-codecamp.com/Sessions.aspx?OnlyOne=true&amp;id=823">Pragmatic JavaScript, jQuery &amp; Ajax with ASP.NET</a></h3>
<p>Saturday, October 9th 1:45PM</p>
<p><a href="http://www.siliconvalley-codecamp.com/Speakers.aspx?AttendeeId=6788">Damian Edwards</a> is a Program Manager on the Microsoft ASP.NET team.&#160; That’s right, he is flying here from Redmond just to present to us.&#160; He’s also an awesome presenter and we are extremely lucky to have him at Code Camp!&#160;&#160; Damien will tak about using JQuery while building sites with the Microsoft ASP.NET framework.&#160; Something Damien knows very very well.&#160; For those who don’t know, Damien is also leading the next generation efforts around ASP.NET WebForms which is the technology 90% of who use ASP.NET use (it’s what the <a href="http://www.siliconvalley-codecamp.com/">silicon valley code camp</a> web site is built with).</p>
<p>DON’T MISS THIS PRESENTATION!</p>
<p>&#160;</p>
<p> <a href="http://www.siliconvalley-codecamp.com/Sessions.aspx?OnlyOne=true&amp;id=627"><br />
<h3><a href="http://www.siliconvalley-codecamp.com/Sessions.aspx?OnlyOne=true&amp;id=627">WebMatrix In Depth</a></h3>
<p> </a>
<p>Saturday, October 9th&#160; 5:00PM</p>
<p><a href="http://www.siliconvalley-codecamp.com/Speakers.aspx?AttendeeId=6011">John Sheehan</a>, one of the best guys I know at explaining complex things is presenting this session on WebMatrix.&#160; I’m not sure everyone would agree with me, but for those people that really don’t like the heavy weight feeling of building web applications with Visual Studio, <a href="http://www.asp.net/webmatrix">WebMatrix</a> will make you feel right at home. It’s much lighter weight and also gives tons of punch.&#160; Come see John and ask him a million questions!&#160; He loves that.</p>
<p>&#160;</p>
<p>All the sessions Tagged ASP.NET can be found here:&#160; <a title="http://www.siliconvalley-codecamp.com/Sessions.aspx?sortby=title&amp;by=category&amp;tag=3" href="http://www.siliconvalley-codecamp.com/Sessions.aspx?sortby=title&amp;by=category&amp;tag=3">http://www.siliconvalley-codecamp.com/Sessions.aspx?sortby=title&amp;by=category&amp;tag=3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2011/10/02/microsoft-asp-net-presentations-at-silicon-valley-code-camp-on-108-and-109/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>With Visual Studio 2011, How To Add a Second Project To a Solution</title>
		<link>http://peterkellner.net/2011/06/06/with-visual-studio-2011-how-to-add-a-second-project-to-a-solution/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=with-visual-studio-2011-how-to-add-a-second-project-to-a-solution</link>
		<comments>http://peterkellner.net/2011/06/06/with-visual-studio-2011-how-to-add-a-second-project-to-a-solution/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 16:54:48 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2011/06/06/with-visual-studio-2011-how-to-add-a-second-project-to-a-solution/</guid>
		<description><![CDATA[&#160;
Say you have an existing Microsoft Windows Forms Application and you want to create a class library for it to reference.&#160; For some reason, I’ve been stuck with this problem for a while now and I accidentally found the “unintuitive” button by accident of how to do this. My expectation was that when I created [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p>Say you have an existing <a href="http://www.microsoft.com/">Microsoft</a> Windows Forms Application and you want to create a class library for it to reference.&#160; For some reason, I’ve been stuck with this problem for a while now and I accidentally found the “unintuitive” button by accident of how to do this. My expectation was that when I created a new solution in Visual <a href="http://www.microsoft.com/visualstudio/en-us">Studio 2010</a>, that it would show 1 project in the solution and then to add more projects, I’d right mouse button on the solution and say “Add New Project”.&#160; Sadly, the solution explorer does not show me my solution, just the one project I have in it, regardless of whether I opened it directly (for which I think it creates it’s own solution) or I opened from my newly minted solution file.</p>
<p>That is, here is what I get when I create an empty solution, then add one project to it (no solution showing!)</p>
<p>&#160;</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2011/06/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 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://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2011/06/image_thumb.png" width="244" height="168" /></a></p>
<p>  <span id="more-1499"></span>
<p>So, I just discovered that when you go and “create a new project”, you get a dropdown in the “Solution Name” that says either “Add to Solution” or “Create new solution”.&#160; Cleary, I want the first one.</p>
<p>&#160;</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2011/06/image1.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 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://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2011/06/image_thumb1.png" width="244" height="101" /></a></p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2011/06/image2.png"><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://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2011/06/image_thumb2.png" width="563" height="405" /></a></p>
<p>&#160;</p>
<p>Now, my solution is back and I can add more projects to it as I would expect.</p>
<p>&#160;</p>
<p><a href="http://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2011/06/image3.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 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://PetersBlogCDN.s3.amazonaws.com/wp/wp/wp-content/uploads/2011/06/image_thumb3.png" width="244" height="179" /></a></p>
<p>&#160;</p>
<p>This is not a big deal, but it did have me confused for a while so I thought I’d blog about it.</p>
<p>HTH’s.</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2011/06/06/with-visual-studio-2011-how-to-add-a-second-project-to-a-solution/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How To Gracefully Stop and Windows Azure Deployment From Visual Studio 2010</title>
		<link>http://peterkellner.net/2011/03/09/how-to-gracefully-stop-and-windows-azure-deployment-from-visual-studio-2010/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-gracefully-stop-and-windows-azure-deployment-from-visual-studio-2010</link>
		<comments>http://peterkellner.net/2011/03/09/how-to-gracefully-stop-and-windows-azure-deployment-from-visual-studio-2010/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 17:00:16 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Azure Web Role]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2011/03/09/how-to-gracefully-stop-and-windows-azure-deployment-from-visual-studio-2010/</guid>
		<description><![CDATA[The way I do Windows Azure development is that I have OneClick Deployment setup on my Azure host.&#160; This means I can simply and quickly update what I have on my Azure WebRole and test it without going through the 10 to 20 minute deployment process.&#160; Sometimes, when I’m tired, I accidentally press the “Debug” [...]]]></description>
			<content:encoded><![CDATA[<p>The way I do <a href="http://www.microsoft.com/windowsazure/">Windows Azure</a> development is that I have <a href="http://social.technet.microsoft.com/Forums/en/windowsazuredata/thread/aedbfdd4-0092-4b10-a84f-ba816438ed54">OneClick Deployment</a> setup on my Azure host.&#160; This means I can simply and quickly update what I have on my Azure WebRole and test it without going through the 10 to 20 minute deployment process.&#160; Sometimes, when I’m tired, I accidentally press the “Debug” or “Run” button on my <a href="http://www.microsoft.com/visualstudio/en-us/products/2010-editions">Visual Studio 2010</a> cloud project.&#160; This launches a 2 or 3 minute process that I have trouble killing.</p>
<p>Today, I accidentally figured out a way to stop it.&#160; Simply go to the web project and right mouse button on your project and say “Publish”. You will be immediately presented with an option to stop the deployment!</p>
<p>That’s it.&#160; Simple, but pretty undiscoverable IMHO.</p>
<p>&#160;</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/How-To-Gracefully-Stop-and-Windows-Azure_7C9D/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 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://peterkellner.net/FilesForWebDownload/How-To-Gracefully-Stop-and-Windows-Azure_7C9D/image_thumb.png" width="244" height="95" /></a></p>
<p>&#160;</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/How-To-Gracefully-Stop-and-Windows-Azure_7C9D/SNAGHTMLc6db08a.png"><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="SNAGHTMLc6db08a" border="0" alt="SNAGHTMLc6db08a" src="http://peterkellner.net/FilesForWebDownload/How-To-Gracefully-Stop-and-Windows-Azure_7C9D/SNAGHTMLc6db08a_thumb.png" width="287" height="369" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2011/03/09/how-to-gracefully-stop-and-windows-azure-deployment-from-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Simple MultiThreading Pattern For C# With No Statics.  Shows Compressing A File With GZip</title>
		<link>http://peterkellner.net/2010/12/04/simple-multithreading-pattern-for-c-sharp-with-no-statics-and-gzip-compression/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=simple-multithreading-pattern-for-c-sharp-with-no-statics-and-gzip-compression</link>
		<comments>http://peterkellner.net/2010/12/04/simple-multithreading-pattern-for-c-sharp-with-no-statics-and-gzip-compression/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 15:09:03 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[threading]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2010/12/04/simple-multithreading-pattern-for-c-sharp-with-no-statics-and-gzip-compression/</guid>
		<description><![CDATA[Background
This post shows a very simple technique for processing a gzip compression on a background thread using c# with Visual Studio 2010.&#160; What is unique here is we are using no statics to do it.&#160; I’m not totally against using statics, but in general, it is best to avoid them.&#160; I’ve heard the notorious Ward [...]]]></description>
			<content:encoded><![CDATA[<h2>Background</h2>
<p>This post shows a very simple technique for processing a <a href="http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx">gzip</a> compression on a background <a href="http://msdn.microsoft.com/en-us/library/aa645740(VS.71).aspx">thread</a> using <a href="http://msdn.microsoft.com/en-us/vcsharp/default.aspx">c#</a> with <a href="http://msdn.microsoft.com/en-us/vstudio/default.aspx">Visual Studio 2010</a>.&#160; What is unique here is we are using no statics to do it.&#160; I’m not totally against using statics, but in general, it is best to avoid them.&#160; I’ve heard the notorious <a href="http://www.neverindoubtnet.blogspot.com/">Ward Bell</a> say <a href="http://msdn.microsoft.com/en-us/library/98f28cdx.aspx">statics</a> are evil and have had many cases where they have bitten me.&#160; Since I heard Ward say this, I’ve been trying to avoid them where I can.</p>
<p>&#160;</p>
<h2>The Simple Problem</h2>
<p>The problem is to simply compress a file to bytes and return to us the compressed, uncompressed and byte array of the result.&#160; We can pass parameters into a thread, however we can not return them (when I say thread, I mean the anonymous method that processes our data).</p>
<p>  <span id="more-1418"></span><br />
<h2>Some Code</h2>
<p>So, to that end, Let’s create a main method as below.&#160; Notice that it creates a very simple anonymous method which executes the code cryptoCopress.CompressFile(…), then simply starts that thread.&#160; Once the thread starts, it simply waits for the thread to end by looping every 50 milliseconds on the thread.IsAlive method.&#160; Finally, when it returns, it simply looks at the cryptCompress object for the results.&#160; No Statics!</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:dd5555c2-7bcc-4715-9cc2-b94a7ef4604b" class="wlWriterEditableSmartContent">
<div>Code:<a href="http://peterkellner.net/FilesForWebDownload/A-Simple-MultiThreading-Pattern-For-C_6021/MultiThreadingInCSharpSimple.zip" target="_self">MultiThreadingInCSharpSimple.zip</a></div>
</p>
</div>
<p>&#160;</p>
<div id="codeSnippetWrapper">
<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: &#39;Courier New&#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"><span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[] args){    var cryptCompress =        <span style="color: #0000ff">new</span> CryptCompress();    var thread =        <span style="color: #0000ff">new</span> Thread(            () =&gt;            cryptCompress.CompressFile                (<span style="color: #006080">@&quot;G:\NoBackup\ext-3.2.1\ext-all-debug-w-comments.js&quot;</span>));    thread.Start();

    <span style="color: #0000ff">int</span> cnt = 0;    <span style="color: #0000ff">while</span> (thread.IsAlive)    {        cnt++;        Console.WriteLine(<span style="color: #006080">&quot;Waiting... &quot;</span> + cnt);        Thread.Sleep(50);    }    Console.WriteLine(<span style="color: #006080">&quot;Before Compression KBytes: {0}&quot;</span>,                        cryptCompress.BeforeCompressionBytes/1000);    Console.WriteLine(<span style="color: #006080">&quot;After Compression KBytes: {0}&quot;</span>,                        cryptCompress.AfterCompressionBytes/1000);}</pre>
<p></div>
<p>Now, Lets look at the CryptCompress class.&#160; Notice that it’s basically got one public method (CompressFile) and 3 public properties that will be used to hold the return values.&#160; This way, the main method that started the thread can get the results.&#160; Again, notice that there is no word static any place in this project.</p>
<div id="codeSnippetWrapper">
<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: &#39;Courier New&#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"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> CryptCompress{<span style="color: #0000ff">public</span> <span style="color: #0000ff">byte</span>[] CompressedBytes { get; set; }<span style="color: #0000ff">public</span> <span style="color: #0000ff">long</span> BeforeCompressionBytes { get; set; }<span style="color: #0000ff">public</span> <span style="color: #0000ff">long</span> AfterCompressionBytes { get; set; }

<span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> CompressFile(<span style="color: #0000ff">string</span> fileName){    <span style="color: #0000ff">using</span> (var fileStream =         <span style="color: #0000ff">new</span> FileStream(fileName, FileMode.Open, FileAccess.Read))    {        var uncompressedBytes = <span style="color: #0000ff">new</span> <span style="color: #0000ff">byte</span>[fileStream.Length];        fileStream.Read(uncompressedBytes, 0,             (<span style="color: #0000ff">int</span>) fileStream.Length);        CompressedBytes = CompressGzip(uncompressedBytes);        BeforeCompressionBytes = fileStream.Length;        AfterCompressionBytes = CompressedBytes.Length;        fileStream.Close();    }}

<span style="color: #008000">/// &lt;summary&gt;</span><span style="color: #008000">/// Take a simple stream of uncompressed bytes and compress them</span><span style="color: #008000">/// &lt;/summary&gt;</span><span style="color: #008000">/// &lt;param name=&quot;uncompressedBytes&quot;&gt;&lt;/param&gt;</span><span style="color: #008000">/// &lt;returns&gt;&lt;/returns&gt;</span><span style="color: #0000ff">public</span> <span style="color: #0000ff">byte</span>[] CompressGzip(<span style="color: #0000ff">byte</span>[] uncompressedBytes){    <span style="color: #0000ff">using</span> (var memory = <span style="color: #0000ff">new</span> MemoryStream())    {        <span style="color: #0000ff">using</span>             (var gZipStream =                 <span style="color: #0000ff">new</span> GZipStream(memory, CompressionMode.Compress, <span style="color: #0000ff">true</span>))        {            gZipStream.Write                (uncompressedBytes, 0, uncompressedBytes.Length);        }        <span style="color: #0000ff">return</span> memory.ToArray();    }}}</pre>
</div>
<p>&#160;</p>
<h2>The Results</h2>
<p>When we run this, notice that it takes 3 iterations (or 150 milliseconds) to complete. I’m only compressing a small file so no surprise.&#160; The file is actually 2.7 Megabytes and compress to .7 Megabytes.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/A-Simple-MultiThreading-Pattern-For-C_6021/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 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://peterkellner.net/FilesForWebDownload/A-Simple-MultiThreading-Pattern-For-C_6021/image_thumb.png" width="244" height="116" /></a></p>
<p>&#160;</p>
<p>That’s it for now! Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/12/04/simple-multithreading-pattern-for-c-sharp-with-no-statics-and-gzip-compression/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A VS2010 Project Made From Post: How to: Host a WCF Service in a Managed Windows Service</title>
		<link>http://peterkellner.net/2010/06/18/wcf-service-in-managed-windows-service-vs2010-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wcf-service-in-managed-windows-service-vs2010-2</link>
		<comments>http://peterkellner.net/2010/06/18/wcf-service-in-managed-windows-service-vs2010-2/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 14:37:33 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[ASP.NET 4.0]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[Windows Service]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2010/06/18/wcf-service-in-managed-windows-service-vs2010-2/</guid>
		<description><![CDATA[MSDN has a very nice article on how to create a windows service that hosts a Windows Communication Foundation (WCF) service.&#160; It explains all the details of doing this in a step by step fashion.&#160; One thing that I often find missing from these articles is the actual Visual Studio project that I can download [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/library/ms733069.aspx" target="_blank">MSDN has a very nice article</a> on how to create a windows service that hosts a <a href="http://msdn.microsoft.com/en-us/netframework/aa663324.aspx" target="_blank">Windows Communication Foundation (WCF)</a> service.&#160; It explains all the details of doing this in a step by step fashion.&#160; One thing that I often find missing from these articles is the actual Visual Studio project that I can download and play with.&#160; What I usually do is put that together myself (which I’m sure is the author’s intent).</p>
<p>To save anyone some time who wants to do the same thing, I’ve created a VS2010 project from the example, added a very simple Windows C# console application that consumes the service, as well as made some small changes in a very nice Windows Presentation Foundation (WPF) <a href="http://code.google.com/p/wpf-mvvm-calculator/" target="_blank">calculator project</a> so that the calculator does it operations inside the windows service rather than in the calculator itself.</p>
<p>In this article, I’ve attached the source code (with my small changes and additions) for you to work with and change as you like.</p>
<p> <span id="more-1332"></span>
<p>First, here is the project: </p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:d3a970ab-d487-417a-bf52-fd64c206e6d2" class="wlWriterEditableSmartContent">
<p>Visual Studio 2010 Project <a href="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/WCFServiceInManagedWindowsService_3.zip" target="_blank">Project Zip Here</a></p>
</div>
<p>Now, let’s talk about the details</p>
<p>&#160;</p>
<h2>The Visual Studio 2010 Solution Itself</h2>
<p><a href="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_11.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_thumb_9.png" width="490" height="381" /></a> </p>
<p>There are three projects in this solution.&#160; The service itself which is called WCFServiceInmanagedWindowsService, Console Application and Calculator.</p>
<p>&#160;</p>
<h3>WCFServiceInManagedWindowsService Project</h3>
<p>&#160;</p>
<p>This project is really what is taken from the <a href="http://msdn.microsoft.com/en-us/library/ms733069.aspx" target="_blank">MSDN article</a>. It’s got almost no change and is primarily created by following the directions in the article.&#160; There are a couple batch files added for creating and deleting the service itself in the root of that project directory, but that’s about it.&#160; All the code is in a file called service.cs.</p>
<p>To Add the service, go to the “Service Reference”/”Add Service” Dialog and enter the address of the service (you can find it in the app.config file).</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_12.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_thumb_10.png" width="408" height="337" /></a> </p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_thumb_11.png" width="395" height="85" /></a> </p>
<p><a title="http://localhost:8000/ServiceModelSamples/service" href="http://localhost:8000/ServiceModelSamples/service">http://localhost:8000/ServiceModelSamples/service</a></p>
<p>Notice that the methods exposed are Add/Divide/Multiple and Subtract.</p>
<p>To start the actual service, after rebuilding the project, execute the bat file InstallService.bat in the root directory.&#160; Make sure you build the release version because this script installs the service from the release directory. Once started, you will see it in the services application as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_14.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_thumb_12.png" width="354" height="178" /></a> </p>
<p>Then, start the service by running the command: “net start WCFWindowsServiceSample”&#160; If you get the error: <em>“No connection could be made because the target machine actively refused it 127.0.0.1:8000”,</em> this likely means you did not start your service.</p>
<p>&#160;</p>
<h3>The Console Application</h3>
<p>The Console application is new and very simple. All you have to do is create a new windows c# console project, use the “Add Service” DialWCFWindowsServiceSampleog and point it at&#160; ( <a title="http://localhost:8000/ServiceModelSamples/service" href="http://localhost:8000/ServiceModelSamples/service">http://localhost:8000/ServiceModelSamples/service</a> ) as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_15.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_thumb_13.png" width="288" height="317" /></a> </p>
<p>Now, you can simply write a console app with the following code and you will be calling the service correctly.&#160; Here is the code:</p>
<p>&#160;</p>
<div id="codeSnippetWrapper">
<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: &#39;Courier New&#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"><span style="color: #0000ff">class</span> Program    {        <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[] args)        {            var calculatorClient = <span style="color: #0000ff">new</span> CalculatorClient();

            var answer = calculatorClient.Add(5, 4);            Console.WriteLine(<span style="color: #006080">&quot;Answer to Adding 5 + 4: {0}&quot;</span>, answer);            Console.ReadKey();

        }    }</pre>
<p></div>
<p>And, when we run it, now surprise, we get 9!</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_16.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_thumb_14.png" width="244" height="120" /></a> </p>
<p>…</p>
<h3>The Calculator Application</h3>
<p>Just to show a real life use of the service, I grabbed the codeplex project <a title="http://code.google.com/p/wpf-mvvm-calculator/" href="http://code.google.com/p/wpf-mvvm-calculator/">http://code.google.com/p/wpf-mvvm-calculator/</a>.</p>
<p><a href="http://code.google.com/p/wpf-mvvm-calculator/"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_17.png" width="372" height="157" /></a> </p>
<p>Then, modifying a small section of code inside (after adding the service reference of course, just like we did in the above console project, we now have a calculator that adds by calling a service for the answer.&#160; Here is the modified code:</p>
<div id="codeSnippetWrapper">
<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: &#39;Courier New&#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"><span style="color: #0000ff">try</span>           {               <span style="color: #008000">// Establish the connection to the Service</span>               var calculatorClient = <span style="color: #0000ff">new</span> CalculatorClient();               var firstOperand = Convert.ToDouble(FirstOperand);               var secondOperand = Convert.ToDouble(SecondOperand);

               var stopwatch = <span style="color: #0000ff">new</span> Stopwatch();               stopwatch.Start();

               <span style="color: #0000ff">switch</span> (Operation)               {                   <span style="color: #0000ff">case</span> (<span style="color: #006080">&quot;+&quot;</span>):                       result = calculatorClient.Add(firstOperand, secondOperand).ToString();                       <span style="color: #0000ff">break</span>;

                   <span style="color: #0000ff">case</span> (<span style="color: #006080">&quot;-&quot;</span>):                       result = calculatorClient.Subtract(firstOperand, secondOperand).ToString();                       <span style="color: #0000ff">break</span>;

                   <span style="color: #0000ff">case</span> (<span style="color: #006080">&quot;*&quot;</span>):                       result = calculatorClient.Multiply(firstOperand, secondOperand).ToString();                       <span style="color: #0000ff">break</span>;

                   <span style="color: #0000ff">case</span> (<span style="color: #006080">&quot;/&quot;</span>):                       result = calculatorClient.Divide(firstOperand, secondOperand).ToString();                       <span style="color: #0000ff">break</span>;               }

               stopwatch.Stop();</pre>
<p></div>
<p>And, when we run the calculator, it looks like this:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_18.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AVS2010ProjectMadeFromPostHowtoHostaWCFS_C58D/image_thumb_15.png" width="333" height="232" /></a>&#160;</p>
<p>&#160;</p>
<h2>Conclusions</h2>
<p>In this post, we simply implemented the source as a <a href="http://www.microsoft.com/visualstudio/en-us">Visual Studio 2010</a> project from the MSDN article on how to build a windows service using WCF.&#160; It’s been pointed out that we are better off using named pipes for this kind of application for better performance, but our purpose here was just to elaborate on the existing application.</p>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/06/18/wcf-service-in-managed-windows-service-vs2010-2/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Using Visual Studio 2010&#8217;s Debugger PIN Feature</title>
		<link>http://peterkellner.net/2010/05/14/visualstudio2010-debugging-pin-variables-watch/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=visualstudio2010-debugging-pin-variables-watch</link>
		<comments>http://peterkellner.net/2010/05/14/visualstudio2010-debugging-pin-variables-watch/#comments</comments>
		<pubDate>Sat, 15 May 2010 04:57:26 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2010/05/14/visualstudio2010-debugging-pin-variables-watch/</guid>
		<description><![CDATA[One of the very cool new features in Visual Studio 2010 is the ability to “Pin” a variable you are watching, right in the place you want to see it.&#160; It’s always been a hassle to have to add a “Watch” and keep track of it among all your other watch variables.&#160; I guess I [...]]]></description>
			<content:encoded><![CDATA[<p>One of the very cool new features in Visual Studio 2010 is the ability to “Pin” a variable you are watching, right in the place you want to see it.&#160; It’s always been a hassle to have to add a “Watch” and keep track of it among all your other watch variables.&#160; I guess I shouldn’t really complain because I’ve always really like the debug capabilities in Visual Studio, but I have to say, this new “Pin” is really nice.</p>
<p> <span id="more-1317"></span>
<p>&#160;</p>
<p>So, let me explain by example.&#160; </p>
<p>At the moment, I’m debugging the Silicon Valley Code Camp web site project and I’m checking a boolean I set called DoValidation.&#160; I’m trying to figure out why it is changing, but first I have to figure out when.&#160; So, I set a break point on the line as shown below:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/UsingVisualStudio2010sDebuggerPINFeature_134A7/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/UsingVisualStudio2010sDebuggerPINFeature_134A7/image_thumb.png" width="444" height="203" /></a> </p>
<p>Now, I hover over the variable I want to pin and press the little pin icon shown here:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/UsingVisualStudio2010sDebuggerPINFeature_134A7/image_3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/UsingVisualStudio2010sDebuggerPINFeature_134A7/image_thumb_3.png" width="443" height="198" /></a> </p>
<p>I then see the following with my little watch window right in line with my code.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/UsingVisualStudio2010sDebuggerPINFeature_134A7/image_4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/UsingVisualStudio2010sDebuggerPINFeature_134A7/image_thumb_4.png" width="447" height="144" /></a> </p>
<p>I can even click the little chevron under the pin and add a comment as I show next.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/UsingVisualStudio2010sDebuggerPINFeature_134A7/image_5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/UsingVisualStudio2010sDebuggerPINFeature_134A7/image_thumb_5.png" width="468" height="193" /></a> </p>
<p>The nice thing is that this stays here just like your break point until you close it.&#160; A very convenient feature.</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/05/14/visualstudio2010-debugging-pin-variables-watch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Authentication and Authorization Using RIA Services (Article 7 of 7)</title>
		<link>http://peterkellner.net/2010/01/25/authentication-and-authorization-using-ria-services-article-7-of-7/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authentication-and-authorization-using-ria-services-article-7-of-7</link>
		<comments>http://peterkellner.net/2010/01/25/authentication-and-authorization-using-ria-services-article-7-of-7/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 23:25:12 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[RIA Service Presentation]]></category>
		<category><![CDATA[RIA Services Bay.Net Presentation]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2010/01/25/authentication-and-authorization-using-ria-services-article-7-of-7/</guid>
		<description><![CDATA[



&#160;
Title Of Each Article
Video Included With Each Post


Part 1
Introduction To RIA Services In Silverlight (This Article)
7 Minutes


Part 2
Basic RIA Services And DataGrid With&#160; VS 2010 Tooling
14 Minutes


Part 3
Adding A DataGrid With Connect The Dots DataBinding in VS 2010
13 Minutes


Part 4
Adding a Navigation Page to a Silverlight Business Application Template
11 Minutes


Part 5
Adding Speakers Page Template With [...]]]></description>
			<content:encoded><![CDATA[<p>
<table width="90%">
<tbody>
<tr>
<td width="70">&nbsp;</td>
<td>Title Of Each Article</td>
<td width="150" style="width: 100px;">Video Included With Each Post</td>
</tr>
<tr>
<td width="70">Part 1</td>
<td><a href="http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/">Introduction To RIA Services In Silverlight (This Article)</a></td>
<td width="150" style="width: 100px;">7 Minutes</td>
</tr>
<tr>
<td width="70">Part 2</td>
<td><a href="http://peterkellner.net/2010/01/25/basic-ria-services-and-datagrid-with-vs-2010-tooling-article-2-of-7/">Basic RIA Services And DataGrid With&nbsp; VS 2010 Tooling</a></td>
<td width="150" style="width: 100px;">14 Minutes</td>
</tr>
<tr>
<td width="70">Part 3</td>
<td><a href="http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/">Adding A DataGrid With Connect The Dots DataBinding in VS 2010</a></td>
<td width="150" style="width: 100px;">13 Minutes</td>
</tr>
<tr>
<td width="70">Part 4</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-a-navigation-page-to-a-silverlight-business-application-template-article-4-of-7/">Adding a Navigation Page to a Silverlight Business Application Template</a></td>
<td width="150" style="width: 100px;">11 Minutes</td>
</tr>
<tr>
<td width="70">Part 5</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-speakers-page-template-with-converters-in-visual-studio-2010-beta2-article-5-of-7/">Adding Speakers Page Template With Converters In Visual Studio 2010 Beta2</a></td>
<td width="150" style="width: 100px;">11 Minutes</td>
</tr>
<tr>
<td width="70">Part 6</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-a-sessions-page-that-includes-a-query-parameter-in-silverlight-vs2010-article-6-of-7/">Adding A Sessions Page That Includes a Query Parameter In Silverlight VS2010 Beta2</a></td>
<td width="150" style="width: 100px;">10 Minutes</td>
</tr>
<tr>
<td width="70">Part 7</td>
<td><a href="http://peterkellner.net/2010/01/25/authentication-and-authorization-using-ria-services-article-7-of-7/">Basic Authentication and Authorization In RIA Services</a></td>
<td width="150" style="width: 100px;">5 Minutes</td>
</tr>
</tbody>
</table>
<p> 
<br /><img src="http://video.peterkellner.net/video/RIAServicesBayNet20090120/P7_AuthenticationAndAuthorization_Thumb.jpg" alt="media" /><br />

<p>This article is very short.&#160; In the actual presentation, there was not much time to talk about this so a brief overview was done.&#160; Basically, it’s all standard WCF stuff.&#160; The idea is that the Silverlight Business Template adds logging in and supports Authentication just like an asp.net application does.&#160; It uses the DomainDataSource to do the bridging between the silverlight clientside app, and the web application.&#160; Authorization is built into the login module also so that you can assign attributes to your domainservice classes to restrict access.</p>
<p> <span id="more-484"></span>
<p>That is, if you only want people who are logged in able to access one of your methods, you simply tag it as follows with the [RequiresAuthentication] attribute.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AuthenticationandAuthorizationUsingRIASe_E1CB/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AuthenticationandAuthorizationUsingRIASe_E1CB/image_thumb.png" width="694" height="222" /></a></p>
<p>If you only want a certain logged in user role to be able to access a certain method, you tag it as follows</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AuthenticationandAuthorizationUsingRIASe_E1CB/image_3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AuthenticationandAuthorizationUsingRIASe_E1CB/image_thumb_3.png" width="710" height="151" /></a></p>
<p>This of course solve the server side only.&#160; On the client side, you need to call methods that are exposed through the domain data.&#160; <a title="http://www.silverlightshow.net/items/Silverlight-3-with-Ria-Authentication-service.aspx" href="http://www.silverlightshow.net/items/Silverlight-3-with-Ria-Authentication-service.aspx">http://www.silverlightshow.net/items/Silverlight-3-with-Ria-Authentication-service.aspx</a> discusses much of this on the client side.</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/01/25/authentication-and-authorization-using-ria-services-article-7-of-7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<enclosure url="http://video.peterkellner.net/video/RIAServicesBayNet20090120/P7_AuthenticationAndAuthorization.flv" length="1" type="video/x-flv"/>
	</item>
		<item>
		<title>Adding A Sessions Page That Includes a Query Parameter In Silverlight VS2010 Beta2 (Article 6 of 7)</title>
		<link>http://peterkellner.net/2010/01/25/adding-a-sessions-page-that-includes-a-query-parameter-in-silverlight-vs2010-article-6-of-7/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=adding-a-sessions-page-that-includes-a-query-parameter-in-silverlight-vs2010-article-6-of-7</link>
		<comments>http://peterkellner.net/2010/01/25/adding-a-sessions-page-that-includes-a-query-parameter-in-silverlight-vs2010-article-6-of-7/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 23:22:47 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2010/01/25/adding-a-sessions-page-that-includes-a-query-parameter-in-silverlight-vs2010-article-6-of-7/</guid>
		<description><![CDATA[&#160;



&#160;
Title Of Each Article
Video Included With Each Post


Part 1
Introduction To RIA Services In Silverlight (This Article)
7 Minutes


Part 2
Basic RIA Services And DataGrid With&#160; VS 2010 Tooling
14 Minutes


Part 3
Adding A DataGrid With Connect The Dots DataBinding in VS 2010
13 Minutes


Part 4
Adding a Navigation Page to a Silverlight Business Application Template
11 Minutes


Part 5
Adding Speakers Page Template With [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<table width="90%">
<tbody>
<tr>
<td width="70">&#160;</td>
<td>Title Of Each Article</td>
<td style="width: 100px" width="150">Video Included With Each Post</td>
</tr>
<tr>
<td width="70">Part 1</td>
<td><a href="http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/">Introduction To RIA Services In Silverlight (This Article)</a></td>
<td style="width: 100px" width="150">7 Minutes</td>
</tr>
<tr>
<td width="70">Part 2</td>
<td><a href="http://peterkellner.net/2010/01/25/basic-ria-services-and-datagrid-with-vs-2010-tooling-article-2-of-7/">Basic RIA Services And DataGrid With&#160; VS 2010 Tooling</a></td>
<td style="width: 100px" width="150">14 Minutes</td>
</tr>
<tr>
<td width="70">Part 3</td>
<td><a href="http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/">Adding A DataGrid With Connect The Dots DataBinding in VS 2010</a></td>
<td style="width: 100px" width="150">13 Minutes</td>
</tr>
<tr>
<td width="70">Part 4</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-a-navigation-page-to-a-silverlight-business-application-template-article-4-of-7/">Adding a Navigation Page to a Silverlight Business Application Template</a></td>
<td style="width: 100px" width="150">11 Minutes</td>
</tr>
<tr>
<td width="70">Part 5</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-speakers-page-template-with-converters-in-visual-studio-2010-beta2-article-5-of-7/">Adding Speakers Page Template With Converters In Visual Studio 2010 Beta2</a></td>
<td style="width: 100px" width="150">11 Minutes</td>
</tr>
<tr>
<td width="70">Part 6</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-a-sessions-page-that-includes-a-query-parameter-in-silverlight-vs2010-article-6-of-7/">Adding A Sessions Page That Includes a Query Parameter In Silverlight VS2010 Beta2</a></td>
<td style="width: 100px" width="150">10 Minutes</td>
</tr>
<tr>
<td width="70">Part 7</td>
<td><a href="http://peterkellner.net/2010/01/25/authentication-and-authorization-using-ria-services-article-7-of-7/">Basic Authentication and Authorization In RIA Services</a></td>
<td style="width: 100px" width="150">5 Minutes</td>
</tr>
</tbody>
</table>
<br /><img src="http://video.peterkellner.net/video/RIAServicesBayNet20090120/P6_AddingSessionsPageWithRequestParam_Thumb.jpg" alt="media" /><br />

<p>In this section, we will talk about what happens when the users presses the “Sessions” hyperlink from the speakers page.&#160; If you remember from the last article, we used a special converter on the Speakers.xaml page and bound that to the hyperlink titled sessions as shown below.</p>
<p> <span id="more-482"></span>
<p>&#160;</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingASessionsPageThatIncludesaQueryPar_DF36/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingASessionsPageThatIncludesaQueryPar_DF36/image_thumb.png" width="376" height="323" /></a></p>
<p>&#160;</p>
<p>When this link is clicked, the navigation created is as follows:</p>
<pre class="csharpcode">&#160;</pre>
<pre class="csharpcode"><a href="http://localhost:9951/Presentation1TestPage.aspx#/Sessions?SpeakerId=903">http://localhost:9951/Presentation1TestPage.aspx#/Sessions?SpeakerId=903</a></pre>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}</p>
<p>.csharpcode pre { margin: 0em; }</p>
<p>.csharpcode .rem { color: #008000; }</p>
<p>.csharpcode .kwrd { color: #0000ff; }</p>
<p>.csharpcode .str { color: #006080; }</p>
<p>.csharpcode .op { color: #0000c0; }</p>
<p>.csharpcode .preproc { color: #cc6633; }</p>
<p>.csharpcode .asp { background-color: #ffff00; }</p>
<p>.csharpcode .html { color: #800000; }</p>
<p>.csharpcode .attr { color: #ff0000; }</p>
<p>.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}</p>
<p>.csharpcode .lnum { color: #606060; }
</style>
<div class="csharpcode">
<pre class="alt"><span class="rem">// Executes when the user navigates to this page.</span></pre>
<pre><span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> OnNavigatedTo(NavigationEventArgs e)</pre>
<pre class="alt">{</pre>
<pre>    <span class="rem">//Handle SpeakerId</span></pre>
<pre class="alt">    var qs = NavigationContext.QueryString;</pre>
<pre>    <span class="kwrd">if</span> (qs.ContainsKey(<span class="str">"SpeakerId"</span>))</pre>
<pre class="alt">    {</pre>
<pre>        <span class="kwrd">this</span>.sessionsOverviewDomainDataSource.FilterDescriptors =</pre>
<pre class="alt">            <span class="kwrd">new</span> FilterDescriptorCollection();</pre>
<pre>        <span class="kwrd">this</span>.sessionsOverviewDomainDataSource.FilterDescriptors.Add(</pre>
<pre class="alt">              <span class="kwrd">new</span> FilterDescriptor(<span class="str">"AttendeeId"</span>,</pre>
<pre>                  FilterOperator.IsEqualTo, qs[<span class="str">"SpeakerId"</span>]));</pre>
<pre class="alt">    }</pre>
<pre>}</pre>
</div>
<p>This simply adds a filter to the current DomainDataSource that filters the column AttendeeId with the passed in query parameter SpeakerId.</p>
<p>&#160;</p>
<p>The resulting page looks as follows assuming <a href="http://www.siliconvalley-codecamp.com/Sessions.aspx?ForceSortBySessionTime=true&amp;id=151">Peter Kellner’s Session link</a> was clicked.</p>
<p>&#160;</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingASessionsPageThatIncludesaQueryPar_DF36/image_3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingASessionsPageThatIncludesaQueryPar_DF36/image_thumb_3.png" width="523" height="207" /></a></p>
<p>&#160;</p>
<p>The video referenced in this article goes into building this page in more details, but fundamentally, the major point is just the query parameter.</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/01/25/adding-a-sessions-page-that-includes-a-query-parameter-in-silverlight-vs2010-article-6-of-7/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<enclosure url="http://video.peterkellner.net/video/RIAServicesBayNet20090120/P6_AddingSessionsPageWithRequestParam.flv" length="1" type="video/x-flv"/>
	</item>
		<item>
		<title>Adding A DataGrid With Connect The Dots DataBinding in VS 2010 (Article 3 of 7)</title>
		<link>http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7</link>
		<comments>http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 19:41:20 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[ASP.NET 2.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/?p=461</guid>
		<description><![CDATA[ 



&#160;
Title Of Each Article
Video Included With Each Post


Part 1
Introduction To RIA Services In Silverlight (This Article)
7 Minutes


Part 2
Basic RIA Services And DataGrid With&#160; VS 2010 Tooling
14 Minutes


Part 3
Adding A DataGrid With Connect The Dots DataBinding in VS 2010
13 Minutes


Part 4
Adding a Navigation Page to a Silverlight Business Application Template
11 Minutes


Part 5
Adding Speakers Page Template [...]]]></description>
			<content:encoded><![CDATA[<p> <br />
<table width="90%">
<tbody>
<tr>
<td width="70">&nbsp;</td>
<td>Title Of Each Article</td>
<td style="width: 100px" width="150">Video Included With Each Post</td>
</tr>
<tr>
<td width="70">Part 1</td>
<td><a href="http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/">Introduction To RIA Services In Silverlight (This Article)</a></td>
<td style="width: 100px" width="150">7 Minutes</td>
</tr>
<tr>
<td width="70">Part 2</td>
<td><a href="http://peterkellner.net/2010/01/25/basic-ria-services-and-datagrid-with-vs-2010-tooling-article-2-of-7/">Basic RIA Services And DataGrid With&nbsp; VS 2010 Tooling</a></td>
<td style="width: 100px" width="150">14 Minutes</td>
</tr>
<tr>
<td width="70">Part 3</td>
<td><a href="http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/">Adding A DataGrid With Connect The Dots DataBinding in VS 2010</a></td>
<td style="width: 100px" width="150">13 Minutes</td>
</tr>
<tr>
<td width="70">Part 4</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-a-navigation-page-to-a-silverlight-business-application-template-article-4-of-7/">Adding a Navigation Page to a Silverlight Business Application Template</a></td>
<td style="width: 100px" width="150">11 Minutes</td>
</tr>
<tr>
<td width="70">Part 5</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-speakers-page-template-with-converters-in-visual-studio-2010-beta2-article-5-of-7/">Adding Speakers Page Template With Converters In Visual Studio 2010 Beta2</a></td>
<td style="width: 100px" width="150">11 Minutes</td>
</tr>
<tr>
<td width="70">Part 6</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-a-sessions-page-that-includes-a-query-parameter-in-silverlight-vs2010-article-6-of-7/">Adding A Sessions Page That Includes a Query Parameter In Silverlight VS2010 Beta2</a></td>
<td style="width: 100px" width="150">10 Minutes</td>
</tr>
<tr>
<td width="70">Part 7</td>
<td><a href="http://peterkellner.net/2010/01/25/authentication-and-authorization-using-ria-services-article-7-of-7/">Basic Authentication and Authorization In RIA Services</a></td>
<td style="width: 100px" width="150">5 Minutes</td>
</tr>
</tbody>
</table>
<p> 
<br /><img src="http://video.peterkellner.net//video/RIAServicesBayNet20090120/P3_DataGridWithVSToolingBusyIndicatorAndPaging_Thumb.jpg" alt="media" /><br />

<p> 
<p>In this article, we will use the the Visual Studio 2010 Beta2 Tooling to create a Sessions DataGrid.&nbsp; We will add a Pager to it as well as a Silverlight busy indicator which will show while the data is loading.&nbsp; In Article 1, we build a simple DataGrid with code behind, in this article, it will all be declarative in XAML built with the Visual Studio 2010 designer.</p>
<p><span id="more-461"></span>
<p>First thing we need to do is add a new Silverlight Navigation Page to the Silverlight project (not the web project) in the Views folder.</p>
<p>&nbsp;<a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb.png" width="433" height="183"></a></p>
<p>Then, copy the code from the Home Page to get the top two default sections that appear on every page as follows:</p>
<p>&nbsp;<a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_3.png" width="437" height="163"></a></p>
<p>And the actual code:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --><br />
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}</p>
<p>.csharpcode pre { margin: 0em; }</p>
<p>.csharpcode .rem { color: #008000; }</p>
<p>.csharpcode .kwrd { color: #0000ff; }</p>
<p>.csharpcode .str { color: #006080; }</p>
<p>.csharpcode .op { color: #0000c0; }</p>
<p>.csharpcode .preproc { color: #cc6633; }</p>
<p>.csharpcode .asp { background-color: #ffff00; }</p>
<p>.csharpcode .html { color: #800000; }</p>
<p>.csharpcode .attr { color: #ff0000; }</p>
<p>.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}</p>
<p>.csharpcode .lnum { color: #606060; }
</style>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">StackPanel</span> <span class="attr">x:Name</span><span class="kwrd">="ContentStackPanel"</span>
            <span class="attr">Style</span><span class="kwrd">="{StaticResource ContentStackPanelStyle}"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">x:Name</span><span class="kwrd">="HeaderText"</span> <span class="attr">Style</span><span class="kwrd">="{StaticResource HeaderTextStyle}"</span>
               <span class="attr">Text</span><span class="kwrd">="{Binding Path=ApplicationStrings.HomePageTitle,
               Source={StaticResource ResourceWrapper}}"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">x:Name</span><span class="kwrd">="ContentText"</span> <span class="attr">Style</span><span class="kwrd">="{StaticResource ContentTextStyle}"</span>
               <span class="attr">Text</span><span class="kwrd">="Home page content"</span><span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">Image</span> <span class="attr">Height</span><span class="kwrd">="393"</span> <span class="attr">Name</span><span class="kwrd">="image1"</span> <span class="attr">Stretch</span><span class="kwrd">="Uniform"</span> <span class="attr">Width</span><span class="kwrd">="467"</span>
               <span class="attr">Source</span><span class="kwrd">="/Presentation1;component/Images/IMG_1504.JPG"</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">StackPanel</span><span class="kwrd">&gt;</span></pre>
<p>Change text to “Speaker page content” and change the resource string to ApplicationString.SpeakerPageTitle and update the ApplicationStrings.resx file as follows:</p>
<p>&nbsp;<a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_4.png" width="405" height="286"></a></p>
<p>Then, drag a DataGrid to the Speaker.xaml design surface (after removing the image tag which was the picture on the home page we copied over).</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_5.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_5.png" width="549" height="213"></a></p>
<p>Now, we do what Microsoft calls “Connect the Dots DataBinding”.&nbsp; That is, we go to the Data Sources Tab</p>
<p>&nbsp;<a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_6.png" width="352" height="168"></a></p>
<p>Drag the SpeakersShort2009 box (shown in yellow below) to the DataGrid showing on the design surface.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_7.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_7.png" width="348" height="149"></a></p>
<p>That automatically creates a bunch of xaml including the RIA Domain DataSource, which includes a reference to the correct query method and the correct Domain Context.&nbsp; Very nice!</p>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}</p>
<p>.csharpcode pre { margin: 0em; }</p>
<p>.csharpcode .rem { color: #008000; }</p>
<p>.csharpcode .kwrd { color: #0000ff; }</p>
<p>.csharpcode .str { color: #006080; }</p>
<p>.csharpcode .op { color: #0000c0; }</p>
<p>.csharpcode .preproc { color: #cc6633; }</p>
<p>.csharpcode .asp { background-color: #ffff00; }</p>
<p>.csharpcode .html { color: #800000; }</p>
<p>.csharpcode .attr { color: #ff0000; }</p>
<p>.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}</p>
<p>.csharpcode .lnum { color: #606060; }
</style>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">riaControls:DomainDataSource</span> <span class="attr">AutoLoad</span><span class="kwrd">="True"</span> <span class="attr">Height</span><span class="kwrd">="0"</span>
                                      <span class="attr">LoadedData</span><span class="kwrd">="speakersShort2009DomainDataSource_LoadedData"</span>
                                      <span class="attr">Name</span><span class="kwrd">="speakersShort2009DomainDataSource"</span>
                                      <span class="attr">QueryName</span><span class="kwrd">="GetSpeakersShort2009Query"</span> <span class="attr">Width</span><span class="kwrd">="0"</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">riaControls:DomainDataSource.DomainContext</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">my:DomainServiceSVCC</span> <span class="kwrd">/&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">riaControls:DomainDataSource.DomainContext</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">riaControls:DomainDataSource</span><span class="kwrd">&gt;</span></pre>
<p>
<pre class="csharpcode"><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_8.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_8.png" width="599" height="195"></a></pre>
<pre class="csharpcode"></pre>
<p><!--.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; } -->Now, we do the same thing with the DataPager (which may have to add to the toolbox with “Choose Items” That gives us some xaml that looks like the following.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_9.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_9.png" width="423" height="287"></a></p>
<p>&nbsp;</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_10.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_10.png" width="419" height="246"></a></p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">data:DataPager</span> <span class="attr">Height</span><span class="kwrd">="26"</span>
                <span class="attr">HorizontalAlignment</span><span class="kwrd">="Left"</span> <span class="attr">Margin</span><span class="kwrd">="720,325,0,0"</span>
                <span class="attr">Name</span><span class="kwrd">="dataPager1"</span> <span class="attr">VerticalAlignment</span><span class="kwrd">="Top"</span>
                <span class="attr">Width</span><span class="kwrd">="200"</span>
                <span class="attr">PageSize</span><span class="kwrd">="10"</span><span class="kwrd">/&gt;</span></pre>
<pre class="csharpcode"><span class="kwrd"></span>&nbsp;</pre>
<p><!--.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; } --></p>
<p>Notice that I put PageSize in.&nbsp; That does not happen by default, and in my presentation, I forgot this and for a while could not figure out why the paging was not working.&nbsp; Try and not make the same mistake!</p>
<p>Then, drag the same DataSource as we dragged to the DataGrid and drop it on the Paging control as follows:</p>
<p>&nbsp;<a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_11.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_11.png" width="412" height="135"></a></p>
<p>That automatically binds the DataPager to the same DomainDataSource as the DataGrid’s DomainDataSource.&nbsp; Here is the XAML created.</p>
<pre class="csharpcode"> <span class="kwrd">&lt;</span><span class="html">data:DataPager</span> <span class="attr">Height</span><span class="kwrd">="26"</span> <span class="attr">Name</span><span class="kwrd">="dataPager1"</span> <span class="attr">Width</span><span class="kwrd">="200"</span>
   <span class="attr">Source</span><span class="kwrd">="{Binding ElementName=speakersShort2009DomainDataSource, Path=Data}"</span> <span class="kwrd">/&gt;</span></pre>
<pre class="csharpcode"></pre>
<p><!--.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; } -->The next thing is to use the new “Reset-All” for styling.&nbsp; It’s very simple.&nbsp; Right click on the design surface and simply click “Layout/Reset” as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_12.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_12.png" width="244" height="176"></a></p>
<p>Now, when we run this, we get:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_13.png" width="380" height="366"></a></p>
<p>Finally, to put a “Busy Indicator” control on the page, we simply drag out the busy Indicator onto the design surface. It likely will not be in your toolbox, so like the DataPager, you will need to add it to the toolbar as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_14.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_14.png" width="396" height="252"></a></p>
<p>Then, drag it from the toolbox right onto the DataGrid as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_15.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_15.png" width="297" height="314"></a></p>
<p>Then, once it’s on the DataGrid (and in the XAML), you need to right click on it and change some of it’s properties.</p>
<p>First, set the “IsBusy” property by checking the checkbox, then resize the control itself so it shows the text and is a pleasant size.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_16.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_16.png" width="428" height="280"></a></p>
<p>The next step is a little more tricky.&nbsp; You need to find the property in the BusyIndicator called DataContext. Right click on that as follows and press “Apply Data Binding”.</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_17.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_17.png" width="428" height="257"></a></p>
<p>Now, you are setting the Source so first select “ElementName”, then chose speakersShort2009DomainDataSource as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_18.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_18.png" width="431" height="296"></a></p>
<p>Then, go to the “Path:” and set the property “DomainContext” and the method to “IsLoading” as follows:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_19.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_19.png" width="436" height="254"></a></p>
<p>What this has done is created a binding expression using a very nice Visual Studio 2010 Tool.&nbsp; It’s assigned that binding expression to the DataContext of the DomainDataSource.</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">riaControls:DomainDataSource</span> <span class="attr">AutoLoad</span><span class="kwrd">="True"</span> <span class="attr">Height</span><span class="kwrd">="0"</span>
         <span class="attr">LoadedData</span><span class="kwrd">="speakersShort2009DomainDataSource_LoadedData_2"</span>
                              <span class="attr">Name</span><span class="kwrd">="speakersShort2009DomainDataSource"</span>
                              <span class="attr">QueryName</span><span class="kwrd">="GetSpeakersShort2009Query"</span> <span class="attr">Width</span><span class="kwrd">="0"</span>
   <span class="attr">DataContext</span><span class="kwrd">="{Binding ElementName=speakersShort2009DomainDataSource, Path=DomainContext.IsLoading}"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">riaControls:DomainDataSource.DomainContext</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">my:DomainServiceSVCC</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">riaControls:DomainDataSource.DomainContext</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">riaControls:DomainDataSource</span><span class="kwrd">&gt;</span></pre>
<p><!--.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; } -->Now, when we finally run our program, we first get the busy indicator as the data is being asynchrously loaded which looks like this:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_20.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_20.png" width="514" height="180"></a></p>
<p>Then, when the data finally loads, looks like the following:</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_21.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/AddingDataGridWithVS2010ToolingArticle3o_E48C/image_thumb_21.png" width="523" height="449"></a></p>
<p>Notice the paging control at the bottom, and notice the BusyIndicator has gone away.</p>
<p>That’s it for this article.&nbsp; In the next article, we will style this page as well as add Converts to show the Speakers picture and add a hyperlink to the sessions associated with each speaker.</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	<enclosure url="http://video.peterkellner.net//video/RIAServicesBayNet20090120/P3_DataGridWithVSToolingBusyIndicatorAndPaging.flv" length="1" type="video/x-flv"/>
	</item>
		<item>
		<title>Introduction To Using RIA Services In Silverlight (Article 1 of 7)</title>
		<link>http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=riaservices-silverlight-4-tutorial-svcc-part1of7-introduction</link>
		<comments>http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 19:12:09 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Speaking]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[VS2010]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://peterkellner.net/?p=405</guid>
		<description><![CDATA[This series of video presentations goes through the process of building a Speaker and Sessions Viewer for Silicon Valley Code Camp’s data using Silverlight 4 and RIA Services (Using Visual Studio 2010 Beta 2).&#160; It starts with a brief introduction of RIA Services and is followed by screen casts and blog posts the parallel each [...]]]></description>
			<content:encoded><![CDATA[<p>This series of video presentations goes through the process of building a Speaker and Sessions Viewer for Silicon Valley Code Camp’s data using <a href="http://blogs.msdn.com/brada/">Silverlight 4</a> and <a href="http://silverlight.net/getstarted/riaservices/">RIA Services</a> (Using Visual Studio 2010 Beta 2).&#160; It starts with a brief introduction of RIA Services and is followed by screen casts and blog posts the parallel each screen cast.</p>
<p>The actual <a href="http://peterkellner.net/2010/01/13/baynet-presentation-riaservices/">presentation</a> was done at the Microsoft office in San Francisco. </p>
<p> <span id="more-405"></span><br />
<table width="90%">
<tbody>
<tr>
<td width="70">&#160;</td>
<td>Title Of Each Article</td>
<td style="width: 100px" width="150">Video Included With Each Post</td>
</tr>
<tr>
<td width="70">Part 1</td>
<td><a href="http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/">Introduction To RIA Services In Silverlight (This Article)</a></td>
<td style="width: 100px" width="150">7 Minutes</td>
</tr>
<tr>
<td width="70">Part 2</td>
<td><a href="http://peterkellner.net/2010/01/25/basic-ria-services-and-datagrid-with-vs-2010-tooling-article-2-of-7/">Basic RIA Services And DataGrid With&#160; VS 2010 Tooling</a></td>
<td style="width: 100px" width="150">14 Minutes</td>
</tr>
<tr>
<td width="70">Part 3</td>
<td><a href="http://peterkellner.net/2010/01/23/adding-a-datagrid-with-connect-the-dots-databinding-in-vs-2010-article-3-of-7/">Adding A DataGrid With Connect The Dots DataBinding in VS 2010</a></td>
<td style="width: 100px" width="150">13 Minutes</td>
</tr>
<tr>
<td width="70">Part 4</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-a-navigation-page-to-a-silverlight-business-application-template-article-4-of-7/">Adding a Navigation Page to a Silverlight Business Application Template</a></td>
<td style="width: 100px" width="150">11 Minutes</td>
</tr>
<tr>
<td width="70">Part 5</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-speakers-page-template-with-converters-in-visual-studio-2010-beta2-article-5-of-7/">Adding Speakers Page Template With Converters In Visual Studio 2010 Beta2</a></td>
<td style="width: 100px" width="150">11 Minutes</td>
</tr>
<tr>
<td width="70">Part 6</td>
<td><a href="http://peterkellner.net/2010/01/25/adding-a-sessions-page-that-includes-a-query-parameter-in-silverlight-vs2010-article-6-of-7/">Adding A Sessions Page That Includes a Query Parameter In Silverlight VS2010 Beta2</a></td>
<td style="width: 100px" width="150">10 Minutes</td>
</tr>
<tr>
<td width="70">Part 7</td>
<td><a href="http://peterkellner.net/2010/01/25/authentication-and-authorization-using-ria-services-article-7-of-7/">Basic Authentication and Authorization In RIA Services</a></td>
<td style="width: 100px" width="150">5 Minutes</td>
</tr>
</tbody>
</table>
<p> 
<br /><img src="http://video.peterkellner.net/video/RIAServicesBayNet20090120/P1_Intro_Thumb.jpg" alt="media" /><br />

<p>I’ve heavily borrowed from Brad Abrams <a href="http://blogs.msdn.com/brada/archive/2009/11/19/pdc09-talk-building-amazing-business-applications-with-silverlight-4-ria-services-and-visual-studio-2010.aspx">PDC09 presentation</a> here and am very thankful for the help.&#160; I’m personally very excited about the opportunities <a href="http://silverlight.net/getstarted/riaservices/">RIA Services</a> gives us as developers to efficiently build powerful multi tier applications without compromise.</p>
<p>I’d recommend going to Brad Abrams PDC09 presentation mentioned above to get a better understanding of what Microsoft was thinking and its plans for RIA Services. The way I see it is RIA Services is built on the WCF Stack.&#160; It basically is a technology that let’s the developer create both client and server code at the same time.&#160; It essentially removes the middle layer form a development perspective, but keeps it there in a very physical way using all the power of WCF.&#160; For example, you create you logic on the server side and that code automatically gets migrated to the client for simplicity of calling.</p>
<p>For those interested where the motivation came from to to this, it’s an interesting story.&#160; Last week, <a href="http://blog.brandewinder.com/">Mathias Brandewinder</a>, the organizer of our local Bay.Net San Francisco user group emailed and asked if I could fill in last minute for the upcoming (actually today’s) bay.net meeting and, could I talk about RIA Services.&#160; Well, 2 years or so ago, I did a quite extensive Silverlight 1.1 project for Leverage Software using the first beta of the .CLR release of Silverlight (C#).&#160; I have to say, it was an awful experience.&#160; So, now at <a href="http://www.silverlight.net/">Silverlight</a> 4.0, RIA Services, I’m back and very excited. </p>
<p>By way of people that have helped me in the last week to get this far, just to name a few:&#160; <a href="http://blogs.msdn.com/brunoterkaly/default.aspx">Bruno Terkaly</a>, offering to do whatever he could and giving me tech tips, <a href="http://blogs.msdn.com/synergist/">Michael Scherotter</a> in “going to town” as he says to make the Speaker’s page look really nice in a live meeting, <a href="http://victorgaudioso.wordpress.com/">Victor Gaudioso</a> in taking time on his busy weekend to call me&#160; and offer help, <a href="http://blogs.msdn.com/brada/archive/2010/01/17/great-ria-services-overview-in-dr-dobbs.aspx">Brad Abrams</a> putting up with my list of naive questions and patiently responding, a slew of <a href="http://aspinsiders.com/default.aspx">ASPInsiders</a> who pointed me at an excellent place to host the videos, and <a href="http://hackingsilverlight.blogspot.com/">David Kelly</a> for giving me a nicely styled Silverlight player to show the videos on this blog.</p>
<p>I’m sitting in the mall below the <a href="http://www.microsoft.com/about/companyinformation/usaoffices/northwest/sanfrancisco.mspx">Microsoft Office in San Francisco</a> where the presentation will be in about 2 hours.&#160; Hopefully, I’ll finish all seven articles and get them posted to the internet very soon.&#160; I did the videos as just practice for my presentation.&#160; They are not polished or edited.&#160; I’m taking the chance of posting them in the hopes that they help someone struggling with all the new features like I have been during the last week.</p>
<p>Finally, this demo is built on live <a href="http://www.siliconvalley-codecamp.com/">Silicon Valley Code Camp</a> Data that has been collected over the past 4 years.&#160; I can’t really publish that database along with the completed solution before I clean and randomize the attendee data.&#160; Meanwhile, I will post the project code but it will not work until I’ve had a chance to clean up the database.&#160; My thinking is that it’s all positive and better to release the code now rather than wait until I have the database cleaned up.</p>
<p>Below is what the end result of what we are building will look like (if you make it through all the articles and videos).</p>
<p><a href="http://peterkellner.net/FilesForWebDownload/UsingRIAServicesWithVisualStudio2010Beta_94F1/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://peterkellner.net/FilesForWebDownload/UsingRIAServicesWithVisualStudio2010Beta_94F1/image_thumb.png" width="414" height="494" /></a></p>
<p>Attached here is source that you can build with Visual Studio 2010 Beta 2 and it will work with No Database.&#160; The Domain Class is heavily modified from what is presented, but it will allow you to actually run and play with real data. </p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:f125b32d-a630-4c3b-838b-1dc56760eeb7" class="wlWriterSmartContent">
<p><a href="http://peterkellner.net/FilesForWebDownload/UsingRIAServicesWithVisualStudio2010Beta_94F1/RIAService_BayNet_NoDatabase.zip" target="_blank">Solution Zip File</a></p>
</p></div>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:758c6f86-44c4-4139-b6fe-133a4e6f71b4" class="wlWriterSmartContent">
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:758c6f86-44c4-4139-b6fe-133a4e6f71b4" class="wlWriterSmartContent"></div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2010/01/20/riaservices-silverlight-4-tutorial-svcc-part1of7-introduction/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<enclosure url="http://video.peterkellner.net/video/RIAServicesBayNet20090120/P1_Intro.flv" length="1" type="video/x-flv"/>
	</item>
		<item>
		<title>Book Review &#8211; Programming Entity Framework (EF) by Julie Lerman</title>
		<link>http://peterkellner.net/2009/12/14/programming-entity-framework-bookreview/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=programming-entity-framework-bookreview</link>
		<comments>http://peterkellner.net/2009/12/14/programming-entity-framework-bookreview/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 17:36:53 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[Book Reviews]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/12/14/programming-entity-framework-bookreview/</guid>
		<description><![CDATA[&#160;
You all know that I’ve blogged quite a bit about LINQ2SQL.&#160; That technology has saved me a huge amount of programming effort verses using ado.net directly.&#160; We all know that LINQ2SQL is really just a stepping stone to Entity Framework (EF), though Microsoft doesn’t quite say that.&#160; I’m sure, based on how many people are [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p>You all know that I’ve blogged quite a bit about LINQ2SQL.&#160; That technology has saved me a huge amount of programming effort verses using ado.net directly.&#160; We all know that LINQ2SQL is really just a stepping stone to <a href="http://msdn.microsoft.com/en-us/library/aa697427(VS.80).aspx">Entity Framework</a> (EF), though Microsoft doesn’t quite say that.&#160; I’m sure, based on how many people are using LINQ2SQL, it will live on and be supported for quite sometime.&#160; Personally, I’ve been waiting for EF to become more mature and then, I assume I’ll start all my new projects with it (EF) and slowly migrate my old ones from LINQ2SQL to EF.&#160; So, time for me to start taking EF more seriously.&#160; It’s baked into the upcoming <a href="http://www.microsoft.com/net/">.net</a> 4.0 and <a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx">Visual Studio 2010</a> beta 2.&#160; It’s obviously not done, but from what I’ve seen, when .net 4.0 releases, EF will be ready for prime time.</p>
<p>Now, for the review:</p>
<p> <span id="more-396"></span>
<p><a href="http://thedatafarm.com/blog/">Julie</a> does a great job of introducing Entity Framework and explaining where it fits in, and why you should consider using it.&#160; I was already sold, but now I understand better why.&#160; She then does an excellent job of going through the basics of EF, telling you how to use it, describing the model and all the details necessary to begin using it.&#160; One of the nice features of this book, is it goes beyond the theoretical, and talks about specific implementations.&#160; That is, WCF, WPF, etc.</p>
<p>We all need to get more comfortable with EF and this book is a great starting place.&#160; <a href="http://thedatafarm.com/blog/">Julie Lerman</a> is clearly the person to learn this from.&#160; I strongly recommend it.</p>
<p>&#160;</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><img src="http://ecx.images-amazon.com/images/I/41inTvXhKKL._SL75_.jpg" /> </td>
<td valign="top"><a href="http://www.amazon.com/Programming-Entity-Framework-Julia-Lerman/dp/059652028X%3FSubscriptionId%3D0JTCV5ZMHMF7ZYTXGFR2%26tag%3Dpetkelsblo-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D059652028X">Programming Entity Framework</a> </td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/12/14/programming-entity-framework-bookreview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PLINQ for Managing Multiple Threads</title>
		<link>http://peterkellner.net/2009/12/02/plinq-in-vs2010-at-pdc09/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=plinq-in-vs2010-at-pdc09</link>
		<comments>http://peterkellner.net/2009/12/02/plinq-in-vs2010-at-pdc09/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 20:05:17 +0000</pubDate>
		<dc:creator>Peter Kellner</dc:creator>
				<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[PLINQ]]></category>
		<category><![CDATA[VS2010]]></category>

		<guid isPermaLink="false">http://peterkellner.net/2009/12/02/plinq-in-vs2010-at-pdc09/</guid>
		<description><![CDATA[I’m currently watching an online video (400 level, very high) from PDC while flying home from Chicago (and blogging about it).&#160; One of the common patterns I often implement is to write some code that does a bunch of “Thread.Start” type stuff and “Thread.IsAlive”.
http://microsoftpdc.com/Sessions/FT21
With PLINQ, this can be avoided with clean error free code (as [...]]]></description>
			<content:encoded><![CDATA[<p>I’m currently watching an online video (400 level, very high) from <a href="http://microsoftpdc.com/">PDC</a> while flying home from Chicago (and blogging about it).&#160; One of the common patterns I often implement is to write some code that does a bunch of “Thread.Start” type stuff and “Thread.IsAlive”.</p>
<p><a title="http://microsoftpdc.com/Sessions/FT21" href="http://microsoftpdc.com/Sessions/FT21">http://microsoftpdc.com/Sessions/FT21</a></p>
<p>With <a href="http://msdn.microsoft.com/en-us/library/dd460688(VS.100).aspx">PLINQ</a>, this can be avoided with clean error free code (as long as my method is thread safe).&#160; Here is some simple code that demonstrates this.</p>
<p> <span id="more-388"></span>
<p>var result =    <br />source.AsParallel().Where    <br />&#160; (x =&gt; [some condition]).Select(x =&gt; [something]);</p>
<p></p>
<style type="text/css">
<p>.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; }</style>
<p>My understanding is that this will just do my [something] in parallel using as many threads as can be allocated, and when one finishes, the next will just start.</p>
<p>Very Cool, Very Clean!</p>
<p>Another good article is here:&#160; <a title="http://www.danielmoth.com/Blog/2009/01/plinq.html" href="http://www.danielmoth.com/Blog/2009/01/plinq.html">http://www.danielmoth.com/Blog/2009/01/plinq.html</a>&#160;</p>
<p>uh oh, they are telling me to turn off all electronic devices, time to land.</p>
]]></content:encoded>
			<wfw:commentRss>http://peterkellner.net/2009/12/02/plinq-in-vs2010-at-pdc09/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 35/44 queries in 0.014 seconds using disk: basic
Content Delivery Network via Amazon Web Services: S3: PetersBlogCDN.s3.amazonaws.com

Served from: peterkellner.net @ 2012-05-23 00:50:33 -->
