<?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"
	>

<channel>
	<title>robburke.NET &#187; Tech</title>
	<atom:link href="http://robburke.net/category/tech/feed" rel="self" type="application/rss+xml" />
	<link>http://robburke.net</link>
	<description>[.NET&#124;UX&#124;Photography&#124;Moose]</description>
	<pubDate>Wed, 02 Jul 2008 21:40:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Whither AI?</title>
		<link>http://robburke.net/2008/06/30/whither-ai/</link>
		<comments>http://robburke.net/2008/06/30/whither-ai/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 00:56:46 +0000</pubDate>
		<dc:creator>Rob Burke</dc:creator>
		
		<category><![CDATA[Artificial Intelligence]]></category>

		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://robburke.net/?p=116</guid>
		<description><![CDATA[I was asked a few weeks ago about why Artificial Intelligence over the past few decades has been such a &#8220;failure&#8221;, meaning mostly that it isn&#8217;t seen to be living up to its great expectations.
James Gaskin at NetworkWorld gives a well-referenced response very similar to the one I gave back then, which went like this:
Essentially, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="border: 0pt none; float: right;" src="http://www.robburke.net/images/RobotTeddyBear.jpg" alt="I didn't like this movie." width="116" height="175" />I was asked a few weeks ago about why Artificial Intelligence over the past few decades has been such a &#8220;failure&#8221;, meaning mostly that it isn&#8217;t seen to be living up to its great expectations.</p>
<p><a title="James Gaskin on AI" href="http://www.networkworld.com/research/2008/062308-artificial-intelligence.html?nwwpkg=slideshows">James Gaskin at NetworkWorld gives a well-referenced response</a> very similar to the one I gave back then, which went like this:</p>
<p>Essentially, whenever some field of AI achieves a result, the successful work is given a name (intelligent search, [something] recognition, adaptive [something], smart [something], etc.), it leaves the lab, has an impact on industry / research / our lives, and &#8220;Artificial Intelligence&#8221; remains loosely defined as &#8220;the tough cognition problems we haven&#8217;t solved yet.&#8221;</p>
<p>Mind you, even defined in that way, <a href="http://web.media.mit.edu/~minsky/">Marvin Minsky</a> would probably still agree that the creators of AI really need to get a hustle on.</p>
]]></content:encoded>
			<wfw:commentRss>http://robburke.net/2008/06/30/whither-ai/feed/</wfw:commentRss>
		</item>
		<item>
		<title>XAML and Obfuscation</title>
		<link>http://robburke.net/2008/06/17/xaml-and-obfuscation/</link>
		<comments>http://robburke.net/2008/06/17/xaml-and-obfuscation/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 20:00:06 +0000</pubDate>
		<dc:creator>Rob Burke</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Tech]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[obfuscation]]></category>

		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://robburke.net/?p=114</guid>
		<description><![CDATA[I normally don&#8217;t cross-link WPF articles unless super-excited because I figure all of us in the WPF-o-sphere are reading each other&#8217;s blogs.  But I was particularly interested on Rudi Grobler&#8217;s recent look into XAML obfuscation because I&#8217;ve encountered obfuscation issues from a couple of sides in a recent project, and look forward to hearing further [...]]]></description>
			<content:encoded><![CDATA[<p>I normally don&#8217;t cross-link WPF articles unless super-excited because I figure all of us in the WPF-o-sphere are reading each other&#8217;s blogs.  But I was particularly interested on <a href="http://dotnet.org.za/rudi/archive/2008/06/17/protecting-my-intellectual-property-xaml.aspx">Rudi Grobler&#8217;s recent look into XAML obfuscation</a> because I&#8217;ve encountered obfuscation issues from a couple of sides in a recent project, and look forward to hearing further discussion on the topic.</p>
<p>To sum up, XAML obfuscation is a bit of a quagmire.  I haven&#8217;t found a tool (let alone a build pipeline) that would make it easy to obfuscate production XAML code, which some consulting clients certainly would prefer.  I&#8217;ll be interested in the results of Rudi&#8217;s investigation.</p>
<p>The other side of the coin is that because WPF apps are hard to obfuscate, studying code in order to learn (rather than to &#8220;liberate&#8221; is also possible.)  I have really valued using tools like <a href="http://www.aisto.com/roeder/dotnet/">Reflector</a> to learn good WPF practices from the experts.  <a href="http://robburke.net/2008/02/07/learn-wpf-by-example-a-recipe/">As I mentioned before</a>, Expression Blend, which is a WPF app itself, has been a real inspiration because the Blend team has solved some really hard problems while building Blend.</p>
]]></content:encoded>
			<wfw:commentRss>http://robburke.net/2008/06/17/xaml-and-obfuscation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WPF for Developers and Lead Designers Course Launch</title>
		<link>http://robburke.net/2008/05/27/wpf-for-developers-and-lead-designers-course/</link>
		<comments>http://robburke.net/2008/05/27/wpf-for-developers-and-lead-designers-course/#comments</comments>
		<pubDate>Tue, 27 May 2008 15:54:42 +0000</pubDate>
		<dc:creator>Rob Burke</dc:creator>
		
		<category><![CDATA[Canada]]></category>

		<category><![CDATA[Location-based]]></category>

		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Tech]]></category>

		<category><![CDATA[Tech Events]]></category>

		<category><![CDATA[Visualization]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://robburke.net/?p=113</guid>
		<description><![CDATA[I&#8217;m excited to be launching a WPF training course through Toronto-based consultancy ObjectSharp.  The course is called &#8220;Windows Presentation Foundation for Developers and Lead Designers,&#8221; and, as the title suggests, it offers a hands-on experience designed to give developers and lead designers the knowledge, background, tips and references they&#8217;ll need to build smart client [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="border: 0pt none; float: right;" src="http://www.robburke.net/images/WPFLogo.jpg" alt="" width="200" height="33" />I&#8217;m excited to be launching a WPF training course through Toronto-based consultancy <a href="http://www.objectsharp.com/training/coursedetail.aspx?id=8010">ObjectSharp</a>.  The course is called &#8220;<a href="http://www.objectsharp.com/training/coursedetail.aspx?id=8010">Windows Presentation Foundation for Developers and Lead Designers</a>,&#8221; and, as the title suggests, it offers a hands-on experience designed to give developers and lead designers the knowledge, background, tips and references they&#8217;ll need to build smart client applications using the Windows Presentation Foundation.</p>
<p>After <a href="http://robburke.net/2008/04/11/mate-this-is-the-future/">enjoying the process</a> of training a team of developers and designers to use WPF, this course is the result of turning that material into a course that we could offer here.</p>
<p>My goal is to give participants in the course the base knowledge and pointers they need to build WPF apps.  I&#8217;ll also position WPF relative to other presentation layer technologies (such as WPF&#8217;s little brother Silverlight), and demonstrate practices that have been useful to me in development I&#8217;ve done for my clients.</p>
<p>The inaugural course offering is scheduled for <strong>August 11th-13th</strong>.  [corrected 17 June] If you&#8217;re interested in taking part, please find <a href="http://www.objectsharp.com/training/coursedetail.aspx?id=8010">more information about the course on ObjectSharp&#8217;s site</a>.  Also, if August 13th is too long for you to wait, or you&#8217;re interested in an on-site course, please contact <a href="http://robburke.net/contact">me</a>, or <a href="mailto:training@objectsharp.com">Julie James</a>, ObjectSharp&#8217;s Training Manager.</p>
]]></content:encoded>
			<wfw:commentRss>http://robburke.net/2008/05/27/wpf-for-developers-and-lead-designers-course/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WPF Line-Of-Business App Links</title>
		<link>http://robburke.net/2008/05/15/wpf-line-of-business-app-links/</link>
		<comments>http://robburke.net/2008/05/15/wpf-line-of-business-app-links/#comments</comments>
		<pubDate>Thu, 15 May 2008 20:59:42 +0000</pubDate>
		<dc:creator>Rob Burke</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[Tech]]></category>

		<category><![CDATA[Tech Events]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[coding guidelines]]></category>

		<category><![CDATA[DevTeach]]></category>

		<category><![CDATA[line of business]]></category>

		<category><![CDATA[LOB]]></category>

		<category><![CDATA[Prism]]></category>

		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://robburke.net/?p=110</guid>
		<description><![CDATA[Some WPF Line-of-Business App follow-up after my presentation at DevTeach today:

Great Snippets: Great code snippets I have installed into my Visual Studio for WPF development are the Dr Wpf and Nerd+Art snippet packs.
WPF Coding Conventions: The coding guidelines I use for WPF are a riff on Paul Stovell&#8217;s XAML and WPF Coding Guidelines.
Application Quality Guide: [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="border: 0pt none; float: right;" src="http://www.robburke.net/images/DevTeach.jpg" alt="" width="137" height="82" /><em>Some WPF Line-of-Business App follow-up after my presentation at DevTeach today:<br />
</em></p>
<p><strong>Great Snippets:</strong> Great code snippets I have installed into my Visual Studio for WPF development are the <a href="http://drwpf.com/blog/Home/tabid/36/EntryID/22/Default.aspx">Dr Wpf</a> and <a href="http://www.blendables.com/files/folders/nerd_43_art/entry387.aspx">Nerd+Art</a> snippet packs.</p>
<p><strong>WPF Coding Conventions: </strong>The coding guidelines I use for WPF are a riff on <a href="http://www.paulstovell.com/blog/xaml-and-wpf-coding-guidelines">Paul Stovell&#8217;s XAML and WPF Coding Guidelines</a>.</p>
<p><strong>Application Quality Guide: </strong>There&#8217;s a WPF Application Quality Guide in the works.  <a href="http://windowsclient.net/wpf/white-papers/wpf-app-quality-guide.aspx">More information at WindowsClient.net</a>.</p>
<p><strong>Avalon Healthcare Demo: </strong>Still my favourite WPF Line-of-Business App Demo.  <a href="http://wpf.netfx3.com/files/folders/applications/entry6608.aspx">Code available here</a>.</p>
<p><strong>Prism: </strong>Think CAB (or SCSF) for WPF, re-built from the ground up to learn from past Composite UI frameworks.  There are drops available on Codeplex.  <a href="http://www.softinsight.com/bnoyes/2008/04/29/PrismCompositeWPFGuidance.aspx">Brian Noyes, a contributor, has a great summary here</a>.</p>
<p><strong>WPF/Silverlight shared code:</strong> Someone asked about sharing code between WPF and Silverlight.  While I think it&#8217;s more <em>skills</em> than <em>code</em> that you&#8217;ll actually be sharing, here&#8217;s <a href="http://blogs.msdn.com/delay/archive/2008/05/04/ivalueconverter-the-swiss-army-knife-of-bindings-propertyviewer-sample-is-a-wpf-silverlight-visualization-and-debugging-aid.aspx">a good example in Delay&#8217;s blog of actual code being re-used</a> bewteen the two frameworks.</p>
<p>hope that helps,<br />
Rob</p>
]]></content:encoded>
			<wfw:commentRss>http://robburke.net/2008/05/15/wpf-line-of-business-app-links/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Minority Report or Iron Man?</title>
		<link>http://robburke.net/2008/05/14/minority-report-or-iron-man/</link>
		<comments>http://robburke.net/2008/05/14/minority-report-or-iron-man/#comments</comments>
		<pubDate>Thu, 15 May 2008 04:06:12 +0000</pubDate>
		<dc:creator>Rob Burke</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Photography]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[Tech]]></category>

		<category><![CDATA[Visualization]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[.NET 3.5 SP1]]></category>

		<category><![CDATA[futuristic interfaces]]></category>

		<category><![CDATA[Shader Effects]]></category>

		<guid isPermaLink="false">http://robburke.net/?p=109</guid>
		<description><![CDATA[For my money, this Channel 9 Video is so impressive, I think this is the closest we&#8217;ve come to enabling a creative team to invent and then implement a futuristic interface like the ones imagined for blockbusters like Minority Report and Iron Man.*

* minus the holography bits. although maybe some awesome researcher could come up [...]]]></description>
			<content:encoded><![CDATA[<p>For my money, this Channel 9 Video is so impressive, I think this is <a href="http://channel9.msdn.com/ShowPost.aspx?PostID=403854">the closest we&#8217;ve come to enabling a creative team to invent and then <em>implement </em>a futuristic interface like the ones imagined for blockbusters like Minority Report and Iron Man</a>.*</p>
<p><a href="http://channel9.msdn.com/ShowPost.aspx?PostID=403854"><img src="http://www.robburke.net/images/DavidTeitlebaumChannel9.jpg" alt="" width="366" height="371" /></a></p>
<p>* minus the holography bits. although maybe some awesome researcher could come up with a way to render these hybrid WPF/DX UIs onto a hologram.</p>
<p>** if you just want the cool demos, do as the Channel 9 page suggests - fast forward the video to about 5 or 6 minutes along.</p>
<p>*** who&#8217;s in?</p>
]]></content:encoded>
			<wfw:commentRss>http://robburke.net/2008/05/14/minority-report-or-iron-man/feed/</wfw:commentRss>
		</item>
		<item>
		<title>End-to-End Custom WPF Shader Example</title>
		<link>http://robburke.net/2008/05/14/end-to-end-custom-wpf-shader-example/</link>
		<comments>http://robburke.net/2008/05/14/end-to-end-custom-wpf-shader-example/#comments</comments>
		<pubDate>Wed, 14 May 2008 05:00:20 +0000</pubDate>
		<dc:creator>Rob Burke</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Tech]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[Effects]]></category>

		<category><![CDATA[LolCat]]></category>

		<category><![CDATA[Pixel Shaders]]></category>

		<guid isPermaLink="false">http://robburke.net/?p=108</guid>
		<description><![CDATA[Greg is in the middle of writing a great explanation of how to build custom WPF 3.5 SP1 pixel shader effects on his blog.  He helped me re-create his sample ColorComplementEffect, so I thought I&#8217;d offer a sample solution containing an end-to-end custom WPF Pixel Shader Effect using the .NET 3.5 SP1 Beta bits.
Download [...]]]></description>
			<content:encoded><![CDATA[<p>Greg is in the middle of writing a <a href="http://blogs.msdn.com/greg_schechter/archive/2008/05/12/introduction-to-writing-effects.aspx">great explanation of how to build custom WPF 3.5 SP1 pixel shader effects</a> on his blog.  He helped me re-create his sample ColorComplementEffect, so I thought I&#8217;d offer a sample solution containing an end-to-end custom WPF Pixel Shader Effect using the .NET 3.5 SP1 Beta bits.</p>
<p><a title="WPF Shader Workshop" href="http://www.robburke.net/links/WpfShaderWorkshop_SP1Beta.zip">Download it here</a>.</p>
<p><img style="border: 0pt none ;" src="http://www.robburke.net/images/WpfPixelShaderSample1.jpg" alt="WPF Pixel Shader Effect" width="500" height="188" /></p>
<p>Some notes:</p>
<ul>
<li>This solution requires that you have Visual Studio 2008 and the <a href="http://blogs.msdn.com/tims/archive/2008/05/12/introducing-the-third-major-release-of-windows-presentation-foundation.aspx">.NET 3.5 SP1 Beta</a> installed.</li>
<li>This also requires that you have the <a href="http://msdn.microsoft.com/en-us/directx/aa937788.aspx">DXSDK</a> installed on your PC (I am out-of-date and using the August 2007 flavor)</li>
<li>In my .sln, a Pre-build Event Command invokes fxc.exe to compile ColorComplementShader.fx into ColorComplementShader.ps.  The Pre-build command requires you to have the DXSDK_DIR environment variable set (see previous note - installing the DXSDK should set this automatically for you)</li>
<li>The picshure is from teh awesum <a href="http://icanhascheezburger.com">icanhascheezburger.com</a></li>
</ul>
<p>Next step&#8230; databound shader parameters <img src='http://robburke.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong><a title="WPF Shader Workshop" href="http://www.robburke.net/links/WpfShaderWorkshop_SP1Beta.zip">Download sample solution</a></strong>.</p>
<p>[<strong>14 May 08 Update: </strong><a href="http://blogs.msdn.com/greg_schechter/archive/2008/05/13/a-simple-effect-sample-project-and-clickonce-application.aspx">Greg has posted an end-to-end shader sample</a> with 3 sample shaders!]</p>
]]></content:encoded>
			<wfw:commentRss>http://robburke.net/2008/05/14/end-to-end-custom-wpf-shader-example/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bring on the 3rd major release of WPF (3.5 SP1 Beta is ready!)</title>
		<link>http://robburke.net/2008/05/12/bring-on-the-3rd-major-release-of-wpf-35-sp1-beta-is-ready/</link>
		<comments>http://robburke.net/2008/05/12/bring-on-the-3rd-major-release-of-wpf-35-sp1-beta-is-ready/#comments</comments>
		<pubDate>Mon, 12 May 2008 17:25:10 +0000</pubDate>
		<dc:creator>Rob Burke</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Tech]]></category>

		<category><![CDATA[Tech Events]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[.NET 3.5 SP1]]></category>

		<guid isPermaLink="false">http://robburke.net/?p=106</guid>
		<description><![CDATA[A &#8220;Week of WPF&#8221; begins on Channel 9 with the announcement that the third major release of WPF (3.5 SP1) has gone beta!
Tim Sneath&#8217;s blog entry has fantastic detail about what&#8217;s coming in this release and all the download/update details (Silverlighters developing using 2.0 Beta: see caveat below).
Folks attending my &#8220;WPF for Line Of Business [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="border: 0pt none; float: right;" src="http://www.robburke.net/images/WPFLogo.jpg" alt="" width="200" height="33" />A &#8220;Week of WPF&#8221; begins on Channel 9 with the announcement that the third major release of WPF (3.5 SP1) has gone beta!</p>
<p><a href="http://blogs.msdn.com/tims/archive/2008/05/12/introducing-the-third-major-release-of-windows-presentation-foundation.aspx">Tim Sneath&#8217;s blog entry has fantastic detail</a> about what&#8217;s coming in this release and all the download/update details <strong>(Silverlighters developing using 2.0 Beta: see caveat below)</strong>.</p>
<p>Folks attending my &#8220;WPF for Line Of Business apps&#8221; presentation on Thursday will be happy to hear about the new WPF controls, like the DataGrid, Ribbon and WebBrowser.  (Silverlight, it seems, has been a good influence on big brother WPF.)  They&#8217;ll also value the performance improvements, the new &#8220;Client Profile&#8221; that can reduce the size of the .NET framework required for deployment, and the little-but-very-useful things like support for string formatting for data-bound text.</p>
<p>Me, I am also utterly stoked about the shader support, the D3DImage, and improvements to WriteableBitmap.  <a href="http://blogs.msdn.com/greg%5Fschechter/">Greg Schechter</a> is walking us through the details on his blog.</p>
<p>I am going to check this stuff out this week and promise to demo what I can at my DevTeach presentation on Thursday!</p>
<p><strong>Important caveat: </strong>When Visual Studio 2008 SP1 and .NET 3.5 SP1 Betas went live last week, I didn&#8217;t update my dev box because the SP1 Beta release is incompatible with Silverlight 2 Beta 1 development.  This will be resolved for Silverlight 2 Beta 2, which is imminent - so I&#8217;m going to make the update, get a VPC ready for Silverlight development, and start playing with WPF development on my main box now.</p>
]]></content:encoded>
			<wfw:commentRss>http://robburke.net/2008/05/12/bring-on-the-3rd-major-release-of-wpf-35-sp1-beta-is-ready/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WPF Commanding - When do Commands re-evaluate their CanExecute method?</title>
		<link>http://robburke.net/2008/04/23/wpf-command-pattern-when-does-it-query-canexecute/</link>
		<comments>http://robburke.net/2008/04/23/wpf-command-pattern-when-does-it-query-canexecute/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 13:30:23 +0000</pubDate>
		<dc:creator>Rob Burke</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Tech]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[Command Pattern]]></category>

		<category><![CDATA[Commanding]]></category>

		<guid isPermaLink="false">http://robburke.net/?p=105</guid>
		<description><![CDATA[I had been merrily using WPF&#8217;s built-in support for the Command Pattern for ages (see Commanding Overview, MSDN Docs, and article on implementing the command pattern in WPF, Jeff Druyt)&#8230; when suddenly it occured to me that I had no idea what triggered WPF to determine whether or not a command can be executed.
Let me [...]]]></description>
			<content:encoded><![CDATA[<p>I had been merrily using WPF&#8217;s built-in support for the Command Pattern for ages (see <a href="http://msdn2.microsoft.com/en-us/library/ms752308.aspx">Commanding Overview</a>, MSDN Docs, and <a href="http://www.microsoft.com/belux/msdn/nl/community/columns/jdruyts/wpf_commandpattern.mspx">article on implementing the command pattern in WPF</a>, Jeff Druyt)&#8230; when suddenly it occured to me that I had no idea <em>what </em>triggered WPF to determine whether or not a command can be executed.</p>
<p>Let me explain by reduction to an absurd example:</p>
<p>Say I have a command that can only execute when</p>
<p style="padding-left: 30px;"><strong><span style="color: #2b91af;">DateTime</span>.Now.Second % 2 == 0</strong><strong>.</strong></p>
<p>I construct this command by home-brewing a static RoutedCommand instance:</p>
<div style="background: white none repeat scroll 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">
<p style="margin: 0px;"><span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">Commands</span></p>
<p style="margin: 0px;">{</p>
<p style="margin: 0px; padding-left: 30px;"><span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: #2b91af;">RoutedCommand</span> MyCommand { <span style="color: blue;">get</span> { <span style="color: blue;">return</span> m_MyCommand; } }</p>
<p style="margin: 0px; padding-left: 30px;">
<p style="margin: 0px; padding-left: 30px;"><span style="color: blue;">private</span> <span style="color: blue;">static</span> <span style="color: #2b91af;">RoutedCommand</span> m_MyCommand = <span style="color: blue;">new</span> <span style="color: #2b91af;">RoutedCommand</span></p>
<p style="margin: 0px; padding-left: 30px;">(</p>
<p style="margin: 0px; padding-left: 30px;"><span style="color: #a31515;"> &#8220;Execute My Command&#8221;</span>,</p>
<p style="margin: 0px; padding-left: 30px;"><span style="color: blue;"> typeof</span>(<span style="color: #2b91af;">Commands</span>),</p>
<p style="margin: 0px; padding-left: 30px;"><span style="color: blue;"> new</span> <span style="color: #2b91af;">InputGestureCollection</span>()</p>
<p style="margin: 0px; padding-left: 30px;">{</p>
<p style="margin: 0px; padding-left: 30px;"><span style="color: blue;"> new</span> <span style="color: #2b91af;">KeyGesture</span>(<span style="color: #2b91af;">Key</span>.C, <span style="color: #2b91af;">ModifierKeys</span>.Alt)</p>
<p style="margin: 0px; padding-left: 30px;">}</p>
<p style="margin: 0px; padding-left: 30px;">);</p>
<p style="margin: 0px;">}</p>
</div>
<p>And then I add a Command Binding for that command to my Window, and assign the command to a Button:</p>
<p>&lt;Window x:Class=&#8221;TestCommands.Window1&#8243;&#8230;&gt;<br />
<strong>&lt;Window.CommandBindings&gt;<br />
&lt;CommandBinding<br />
Command=&#8221;{x:Static local:Commands.MyCommand}&#8221;<br />
Executed=&#8221;MyCommandExecuted&#8221;<br />
CanExecute=&#8221;MyCommandCanExecute&#8221;<br />
/&gt;<br />
&lt;/Window.CommandBindings&gt;<br />
</strong>&#8230;<br />
&lt;Button Width=&#8221;200&#8243; Height=&#8221;200&#8243;<br />
<strong> Command=&#8221;{x:Static local:Commands.MyCommand}&#8221;<br />
</strong> Content=&#8221;{Binding Path=IsEnabled}&#8221;<br />
/&gt;<br />
&#8230;<br />
&lt;/Window&gt;</p>
<p>By nature of WPF&#8217;s awesomeness and WPF Commanding in general, the above Button&#8217;s IsEnabled property should automatically be set to true or false based on whether or not the command can or can&#8217;t be executed.</p>
<p>Speaking of which, let&#8217;s set up my Command&#8217;s absurd logic in the CodeBehind by implementing its Execute and CanExecute event handlers:</p>
<p><!-- {\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;\red163\green21\blue21;}??\fs20         \cf3 private\cf0  \cf3 void\cf0  MyCommandCanExecute(\cf3 object\cf0  sender, \cf4 CanExecuteRoutedEventArgs\cf0  e)\par ??        \{\par ??            \cf4 DateTime\cf0  now = \cf4 DateTime\cf0 .Now;\par ??            \cf3 if\cf0  (CanExecuteOutput != \cf3 null\cf0 )\par ??            \{\par ??                CanExecuteOutput.Text = \cf5 "MyCommand CanExecute determined at "\cf0  + now.ToLongTimeString() + \cf5 " (and "\cf0  + now.Millisecond + \cf5 "ms)"\cf0 ;\par ??            \}\par ??            e.CanExecute = \cf4 DateTime\cf0 .Now.Second % 2 == 0;\par ??        \}\par ??\par ??        \cf3 private\cf0  \cf3 void\cf0  MyCommandExecuted(\cf3 object\cf0  sender, \cf4 ExecutedRoutedEventArgs\cf0  e)\par ??        \{\par ??            TextOutput.Text = \cf5 "MyCommand executed at "\cf0  + \cf4 DateTime\cf0 .Now.ToLongTimeString();\par ??        \}\par ??} --></p>
<div style="background: white none repeat scroll 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">
<p style="margin: 0px;"><span style="color: blue;">private</span> <span style="color: blue;">void</span> MyCommandCanExecute(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">CanExecuteRoutedEventArgs</span> e)</p>
<p style="margin: 0px;">{</p>
<p style="margin: 0px;"><span style="color: #2b91af;"> DateTime</span> now = <span style="color: #2b91af;">DateTime</span>.Now;</p>
<p style="margin: 0px;"><span style="color: blue;"> if</span> (CanExecuteOutput != <span style="color: blue;">null</span>)</p>
<p style="margin: 0px;">{</p>
<p style="margin: 0px;">CanExecuteOutput.Text = <span style="color: #a31515;">&#8220;MyCommand CanExecute determined at &#8220;</span> +</p>
<p style="margin: 0px;">now.ToLongTimeString() + <span style="color: #a31515;">&#8221; (and &#8220;</span> + now.Millisecond + <span style="color: #a31515;">&#8220;ms)&#8221;</span>;</p>
<p style="margin: 0px;">}</p>
<p style="margin: 0px;">e.CanExecute = <span style="color: #2b91af;">DateTime</span>.Now.Second % 2 == 0;</p>
<p style="margin: 0px;">}</p>
<p style="margin: 0px;">
<p style="margin: 0px;">
<p style="margin: 0px;"><span style="color: blue;">private</span> <span style="color: blue;">void</span> MyCommandExecuted(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">ExecutedRoutedEventArgs</span> e)</p>
<p style="margin: 0px;">{</p>
<p style="margin: 0px;">TextOutput.Text = <span style="color: #a31515;">&#8220;MyCommand executed at &#8220;</span> + <span style="color: #2b91af;">DateTime</span>.Now.ToLongTimeString();</p>
<p style="margin: 0px;">}</p>
<p style="margin: 0px;">
</div>
<p>So, my example is absurd but I bet you see my point by now: WPF is meant to automatically set the <strong>IsEnabled</strong> Property on that button to true or false, based on the results of the CanExecute method.  But in this case, the results of CanExecute are a function only of time, and thus change repeatedly and independently of &#8220;obvious&#8221; application events.  So&#8230; <strong><em>how does the Commanding system know when to query CanExecute and consequently enable/disable the button once a second?</em></strong></p>
<p>In this case, without further intervention, it <em>doesn&#8217;t</em>.  It seems that when events are raised on the Window (a mouse button click, etc.), CanExecute is re-evaluated. (I don&#8217;t know the details and wish I did.)  But, without further programmatic or user intervention, the button will <strong>not </strong>automatically change its IsEnabled state once a second.</p>
<p>This led me back to the MSDN docs, where I discovered the aptly-named InvalidateRequerySuggested event.  To coerce - er, suggest - that WPF should query CanExecute, I set up the following DispatcherTimer:</p>
<p><!-- {\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20             m_DispatcherTimer = \cf3 new\cf0  \cf4 DispatcherTimer\cf0 ()\par ??            \{\par ??                Interval = \cf4 TimeSpan\cf0 .FromSeconds(0.25),\par ??                IsEnabled = \cf3 true\par ??\cf0             \};\par ??            m_DispatcherTimer.Tick += \cf3 delegate\par ??\cf0             \{\par ??                \cf4 CommandManager\cf0 .InvalidateRequerySuggested();\par ??            \};\par ??} --></p>
<div style="background: white none repeat scroll 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">
<p style="margin: 0px;">m_DispatcherTimer = <span style="color: blue;">new</span> <span style="color: #2b91af;">DispatcherTimer</span>()</p>
<p style="margin: 0px;">{</p>
<p style="margin: 0px;">Interval = <span style="color: #2b91af;">TimeSpan</span>.FromSeconds(0.25),</p>
<p style="margin: 0px;">IsEnabled = <span style="color: blue;">true</span></p>
<p style="margin: 0px;">};</p>
<p style="margin: 0px;">m_DispatcherTimer.Tick += <span style="color: blue;">delegate</span></p>
<p style="margin: 0px;">{</p>
<p style="margin: 0px;"><span style="color: #2b91af;"> CommandManager</span>.InvalidateRequerySuggested();</p>
<p style="margin: 0px;">};</p>
</div>
<p>Now, the IsEnabled property of the Button blinks on and off as the Command&#8217;s ability to be executed changes with the passing seconds.</p>
<p>Only then did I discover there&#8217;s an <a href="http://msdn2.microsoft.com/en-us/library/ms771552.aspx">MSDN Docs sample called &#8220;Disable Command Source Via Dispatcher Timer Sample&#8221;</a> which is remarkably similar.</p>
<p>There you have it. Now go forth and command WPF&#8217;s Commanding.  I&#8217;m sure you can all execute on that request &lt;g&gt;</p>
<p>P.S. Code for this sample is <a href="http://robburke.net/links/TestWPFCommands.zip">here</a>.</p>
<p>P.P.S. What are folks using for pasting XAML and C# code into their blogs? This entry is looking a little rough&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://robburke.net/2008/04/23/wpf-command-pattern-when-does-it-query-canexecute/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tip: Don&#8217;t forget the WPF Performance Suite</title>
		<link>http://robburke.net/2008/04/21/dont-forget-the-wpf-performance-suit/</link>
		<comments>http://robburke.net/2008/04/21/dont-forget-the-wpf-performance-suit/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 13:32:32 +0000</pubDate>
		<dc:creator>Rob Burke</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Tech]]></category>

		<category><![CDATA[WPF]]></category>

		<category><![CDATA[WPF Performance Suite]]></category>

		<guid isPermaLink="false">http://robburke.net/?p=104</guid>
		<description><![CDATA[The WPF Performance Suite includes the following tools for profiling WPF applications at runtime:
Perforator: for analyzing rendering behavior.
Visual Profiler: for profiling the use of WPF services, such as layout and event handling, by elements in the visual tree.
Working Set Analyzer: for analyzing the working set characteristics of your application.
Event Trace: for analyzing events and generating [...]]]></description>
			<content:encoded><![CDATA[<p>The WPF Performance Suite includes the following tools for profiling WPF applications at runtime:</p>
<p style="padding-left: 30px;"><strong>Perforator: </strong>for analyzing rendering behavior.</p>
<p style="padding-left: 30px;"><strong>Visual Profiler: </strong>for profiling the use of WPF services, such as layout and event handling, by elements in the visual tree.</p>
<p style="padding-left: 30px;"><strong>Working Set Analyzer: </strong>for analyzing the working set characteristics of your application.</p>
<p style="padding-left: 30px;"><strong>Event Trace: </strong>for analyzing events and generating event log files.</p>
<p style="padding-left: 30px;"><strong>ETW Trace Viewer: </strong>Record, display, and browse Event Tracing for Windows (ETW) log files in a WPF user-interface format.</p>
<p>The WPF Performance Suite can either be found <a href="http://wpf.netfx3.com/files/folders/developer/entry10880.aspx">online</a> or in your Windows SDK Directory at [WinSDK]\bin (mine was at c:\Program Files\Microsoft SDKs\Windows\v6.1\Bin).</p>
<p><img style="border: 0;" src="http://www.robburke.net/images/WPFPerformanceSuite.jpg" alt="The WPF Performance Suite" width="500" height="214" /></p>
<p>This weekend, 10 minutes with the WPF Performance Suite boosted my application&#8217;s FPS (frames per second) dramatically.  I had made an incorrect assumption about why my performance was degrading (I thought it was prolific use of texture memory, but it turned out that a textbox related to debug spew that was running wild).  The Visual Profiler revealed this to me immediately.</p>
<p>So, don&#8217;t forget the WPF Performance Suite.  It makes a very useful addition to your dev/test arsenal in addition to more traditional static/dynamic analysis tools like those found in Visual Studio Team Suite.</p>
]]></content:encoded>
			<wfw:commentRss>http://robburke.net/2008/04/21/dont-forget-the-wpf-performance-suit/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mike Holmes Makes it Right</title>
		<link>http://robburke.net/2008/04/14/mike-holmes-makes-it-right/</link>
		<comments>http://robburke.net/2008/04/14/mike-holmes-makes-it-right/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 13:25:19 +0000</pubDate>
		<dc:creator>Rob Burke</dc:creator>
		
		<category><![CDATA[Canada]]></category>

		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Tech]]></category>

		<category><![CDATA[construction]]></category>

		<category><![CDATA[make it right]]></category>

		<category><![CDATA[Mike Holmes]]></category>

		<category><![CDATA[renovation]]></category>

		<guid isPermaLink="false">http://robburke.net/?p=102</guid>
		<description><![CDATA[Mike Holmes is well on his way to being my new idol.
If you&#8217;re reading this from Canada, you know Mike: the contractor who arrives at botched renovation jobs and works his magic.
So why do I love this guy?
1. He knows everything there is to know about construction.  He seems to have deep knowledge of [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" style="float: right; border: 0;" src="http://www.robburke.net/images/MikeHolmes.jpg" alt="Mike Holmes: 'Make it Right, the first time'" width="159" height="209" />Mike Holmes is well on his way to being my new idol.</p>
<p>If you&#8217;re reading this from Canada, you know Mike: the contractor who arrives at botched renovation jobs and works his magic.</p>
<p>So why do I love this guy?</p>
<p>1. He knows everything there is to know about construction.  He seems to have <strong>deep knowledge </strong>of <em>every </em>subdomain of home renovation.  It&#8217;s knowledge (and wisdom) that can only come from years of experience.</p>
<p>2. His mantra is <strong>&#8220;Make it right <em>[the first time]</em>.&#8221; </strong> Fellow software developers, need I say more?</p>
<p>3. The concept for his show is an entrepreneur&#8217;s dream.</p>
<p style="padding-left: 30px;">Take an <strong>existing idea</strong>: shows about home renovation, which are a dime a dozen.</p>
<p style="padding-left: 30px;">Make a <strong>clever addition</strong>: start on a site where the contractors screwed up.</p>
<p style="padding-left: 30px;">Suddenly, look at this innovative format you&#8217;ve got:</p>
<p style="padding-left: 60px;">a show with <strong>conflict </strong>(in the <span style="text-decoration: underline;">dramatic</span> sense only - Mike has a policy of not naming and shaming)</p>
<p style="padding-left: 60px;">episodic story arcs that are much more <strong>engaging</strong></p>
<p style="padding-left: 60px;">(most importantly) a useful tweak to the format that gives Mike and his crews <strong>ample opportunity to relay relevant information</strong> about a reno to the audience, without relying on awkward asides.</p>
<p>More information: Check out the <a href="http://www.holmesonhomes.com/">Holmes on Homes Website</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://robburke.net/2008/04/14/mike-holmes-makes-it-right/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
