<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Coding4Fun</title><link>http://blogs.msdn.com/coding4fun/default.aspx</link><description>&lt;div id="menuContainer"&gt;&lt;/div&gt;</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>RGB in, HLS out</title><link>http://blogs.msdn.com/coding4fun/archive/2010/01/04/9943689.aspx</link><pubDate>Tue, 05 Jan 2010 02:03:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9943689</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9943689.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9943689</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9943689</wfw:comment><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/RGBinHLSout_FDD8/temp0%5B1%5D_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="temp0[1]" border="0" alt="temp0[1]" align="right" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/RGBinHLSout_FDD8/temp0%5B1%5D_thumb.png" width="240" height="170" /&gt;&lt;/a&gt; David Veeneman wrote a neat little console application that will &lt;a href="http://www.codeproject.com/KB/WPF/WpfColorConversions.aspx"&gt;convert RGB colors to HLS&lt;/a&gt; (Hue-Luminance-Saturation) or HSB (Hue-Saturation-Brightness) over at Code Project.&lt;/p&gt;  &lt;p&gt;One of the neat things David also did was show off using IValueConverter as well to do some of the conversion for you.&lt;/p&gt;  &lt;p&gt;David did use an MSDN article as reference, if you want to see the sample, head over to &lt;a title="http://msdn.microsoft.com/en-us/library/ms771620.aspx" href="http://msdn.microsoft.com/en-us/library/ms771620.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms771620.aspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9943689" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/utility/default.aspx">utility</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/WPF/default.aspx">WPF</category></item><item><title>Creating An Application With Full Plug-in Support</title><link>http://blogs.msdn.com/coding4fun/archive/2009/12/28/9941747.aspx</link><pubDate>Mon, 28 Dec 2009 22:43:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9941747</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9941747.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9941747</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9941747</wfw:comment><description>&lt;p&gt;In this article, you’ll learn how to create an application with full plug-in support.&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="157"&gt;         &lt;p&gt;Arian T. Kulp           &lt;br /&gt;&lt;a href="http://www.ariankulp.com"&gt;www.ariankulp.com&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="481"&gt;         &lt;p&gt;&lt;b&gt;Project site:&lt;/b&gt; &lt;a title="http://utilrunner.codeplex.com/" href="http://utilrunner.codeplex.com/"&gt;http://utilrunner.codeplex.com/&lt;/a&gt;&lt;b&gt;             &lt;br /&gt;Code It: &lt;/b&gt;&amp;#160;&lt;a href="http://utilrunner.codeplex.com/Release/ProjectReleases.aspx"&gt;Downloads&lt;/a&gt;            &lt;br /&gt;&lt;strong&gt;Run It:&amp;#160;&amp;#160;&amp;#160; &lt;/strong&gt;&lt;a href="http://utilrunner.codeplex.com/Release/ProjectReleases.aspx"&gt;Downloads&lt;/a&gt;&lt;/p&gt;          &lt;p&gt;&lt;b&gt;Difficulty:&lt;/b&gt; Intermediate            &lt;br /&gt;&lt;b&gt;Time Required:&lt;/b&gt; 3 hours            &lt;br /&gt;&lt;b&gt;Cost:&lt;/b&gt; Free!            &lt;br /&gt;&lt;b&gt;Software Needed:&lt;/b&gt; &lt;a href="http://www.microsoft.com/express/download/"&gt;Visual C# 2008 Express Edition or higher&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;   &lt;p&gt;&lt;a href="http://www.microsoft.com/express/download/"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/p&gt;  &lt;h3&gt;Introduction&lt;/h3&gt;  &lt;p&gt;It’s been a number of months since I released the &lt;a href="http://blogs.msdn.com/coding4fun/archive/2009/04/14/9535026.aspx"&gt;first version of my Utility Runner application&lt;/a&gt;.&amp;#160; Utility Runner makes it possible to run system utilities with as little overhead as possible: Instead of lots of tray icons, numerous EXE’s, and the associated memory and startup time overhead, this application manages multiple utilities from one place.&lt;/p&gt;  &lt;p&gt;To open this solution, you’ll need Visual Studio 2008 Express Edition (Visual C# or Visual Basic), at least.&amp;#160; If you don’t have it yet, you should get it!&lt;/p&gt;  &lt;h3&gt;Working with MEF&lt;/h3&gt;  &lt;p&gt;Little has changed functionally from the last version of the application, beyond some refactoring that’s taken place since the new version of MEF was released.&amp;#160; For one thing, the attribute for marking an export is no longer sealed, so you can now create a subclassed attribute that encompasses the export name and any other metadata included with it.&amp;#160; Consumers can simply use your new custom attribute for a stronger-typed experience.&amp;#160; In my case, I created a WpfServiceMetadata class.&amp;#160; Read on for more information.&lt;/p&gt;  &lt;h3&gt;Managing Addins&lt;/h3&gt;  &lt;p&gt;My big challenge was figuring out how to implement an addin manager to support multiple utility addins, like in Firefox.&amp;#160; MEF lets you easily mark what classes are addins and where they should fit into your overall code, but I wanted to take it further.&amp;#160; I decided that my goals were:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The ability to load an addin through the UI&lt;/li&gt;    &lt;li&gt;The ability to disable/enable addins&lt;/li&gt;    &lt;li&gt;The ability to remove an addin&amp;#160; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;There are a number of ways to achieve these goals.&amp;#160; Mine isn’t the ideal way, but it works pretty well nonetheless.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Loading Addins&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Loading addins is mostly handled by the MEF Framework itself, but there is some manual work involved as well.&amp;#160; I decided that instead of scanning a folder for DLL’s like in the first version, I’d take things a step further:&amp;#160; I came up with a simple packaging format to contain the addin and its associated files.&lt;/p&gt;    &lt;p&gt;The packaging format is simply a Zip file renamed with the .util extension.&amp;#160; The file contains at least the DLL of the addin itself, but might also include associated libraries, images, sounds, or other resources.&amp;#160; I toyed with creating a manifest file to help supply addin information that didn’t require class loading, but I kept it simple for now.&lt;/p&gt;    &lt;p&gt;Before loading DLL’s with addins, the &lt;b&gt;AddinManager &lt;/b&gt;class will scan the addins folder for .util files and unzip them to same-named folders.&amp;#160; Each of these folders gets added to the list of folders in which MEF searches.&amp;#160; The original file then gets deleted.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;Adding an addin&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;An application that uses addins needs a way for users to add new ones.&amp;#160; The easiest method would be to have the user just drag new .util files into the Addins folder, but this isn’t very user-friendly.&amp;#160; I wanted to make it easy for a user to click something in the application to install an addin.&lt;/p&gt;    &lt;p&gt;If the user clicks the &lt;b&gt;Add New Addin From File &lt;/b&gt;button, they use a file browse button to locate the file.&amp;#160; The application then copies that file to the Addins folder and notifies the user that it will be loaded on next startup.&amp;#160; It would be great to load the addin immediately, and MEF supports that, but I decided to skip dynamic addin control for simplicity.&lt;/p&gt;    &lt;p&gt;Instead of going through the dialog when loading an addin, it would be nice to support double-clicking. To do this, an association needs to be made from the .util extension to the executable.&amp;#160; If you launch the executable with a file argument and it’s the right format, it will automatically copy it to the Addins folder.&amp;#160; If an instance is already running, the new instance will just exit.&amp;#160; Similarly, if you launch the executable when another instance is running, the existing instance will show itself and the new instance will exit.&lt;/p&gt;    &lt;p&gt;It’s important to note that standard users don’t have write access to the &lt;i&gt;Program Files &lt;/i&gt;folder.&amp;#160; For this reason, addins need to be stored in the user’s local profile folder.&amp;#160; System-level addins can be stored in the &lt;i&gt;ProgramData &lt;/i&gt;folder.&amp;#160; Addins could be in the user’s roaming profile folder, but I haven’t thought through all of that yet.&amp;#160; (For example, if a user logs into different machines, an addin might not run on each system due to different hardware configurations.)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;Disabling an addin&lt;/strong&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Disabling an addin should be a simple matter of renaming the addin folder.&amp;#160; You can’t do this at runtime though, since the DLL’s are locked and loaded.&amp;#160; As an alternative, I create a file (zero-length) with the same name and add the .disable extension to it.&amp;#160; I check for this upon startup and before loading, and can handle it properly.&lt;/p&gt;    &lt;p&gt;Enabling and removing addins are handled similarly, using .enable and .delete extensions on the zero-length files.&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;Creating Addins&lt;/h3&gt;  &lt;p&gt;To create an addin, you need to 1) implement the &lt;b&gt;IWpfService &lt;/b&gt;interface, and 2) add the &lt;b&gt;WpfServiceMetadata &lt;/b&gt;attribute with a name for your addin.&amp;#160; From there, be sure to implement all the methods in the interface.&amp;#160; The &lt;b&gt;Start &lt;/b&gt;method is called at initialization (you shouldn’t take much time in the constructor), and &lt;b&gt;Stop &lt;/b&gt;is called at the end, for cleanup.&amp;#160; Any time you want to update the &lt;b&gt;Status&lt;/b&gt;, be sure to raise the &lt;b&gt;StatusChanged &lt;/b&gt;event.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;[WpfServiceMetadata(&lt;span class="str"&gt;&amp;quot;SampleAddin&amp;quot;&lt;/span&gt;)]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; SampleAddinImpl : IWpfService
{
}&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;The final thing you’ll need to do is copy your addin DLL to a folder with your addin name, plus the .util extension (Yes, an extension on the folder name.&amp;#160; I do this in Visual Studio with a post-build event.&amp;#160; If you debug the application, it looks for an Addins folder under the current directory.&amp;#160; When started normally (such as when installed) it uses the local user profile.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/CreatingAnApplicationWithFullPluginSuppo_CF07/clip_image001_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/CreatingAnApplicationWithFullPluginSuppo_CF07/clip_image001_thumb.png" width="400" height="311" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you’re ready to distribute the addin, compress the DLL and any supporting files into the top-level of a ZIP file, then rename the .zip extension to .util.&amp;#160; You can load this from the Addins page of the app settings, or manually move it to the &lt;i&gt;MefUtilRuner\Addins&lt;/i&gt; folder in your local profile folder (&lt;i&gt;c:\users\{USERNAME}\AppData&lt;/i&gt;):&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/CreatingAnApplicationWithFullPluginSuppo_CF07/clip_image002_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/CreatingAnApplicationWithFullPluginSuppo_CF07/clip_image002_thumb.png" width="457" height="283" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;TimedQueue&lt;/h3&gt;

&lt;p&gt;Message boxes, balloon help, status bars—these are all great ways to display a message to the user, but they all only show one string at a time.&amp;#160; If you call it again before the reader has the chance to see it, it’s just gone.&amp;#160; There are some nice message managers that make it easy to manage stacking alerts, but I decided to stick with the built-in balloon help provider, and just manage how often I send changes.&amp;#160; It’s basically a buffered balloon provider that will only show messages every x number of seconds, regardless of how many attempts the application makes.&amp;#160; To use it, simply add items to the collection.&amp;#160; An event is raised whenever an item is available.&amp;#160; If an item has exceeded the maximum time-to-live threshold, the users of the collection never see it.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;// Repeat while there are items (one pulse may occur with several items ready)&lt;/span&gt;
&lt;span class="kwrd"&gt;while&lt;/span&gt; (item != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
{
    &lt;span class="rem"&gt;// If this is an old item, no event is raised.  This could happen if&lt;/span&gt;
    &lt;span class="rem"&gt;// a process goes into a loop and dumps a large number in a very short&lt;/span&gt;
    &lt;span class="rem"&gt;// amount of time.  &lt;/span&gt;
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (DateTime.Now.Subtract(item.TimeStamp).TotalMilliseconds &amp;lt; _maxTTL)
    {
        RaiseEvent(item.Item);
        Thread.Sleep(_interval);
    }

    item = &lt;span class="kwrd"&gt;default&lt;/span&gt;(ItemWrapper&amp;lt;T&amp;gt;);

    &lt;span class="kwrd"&gt;lock&lt;/span&gt; (_lock)
    {
        &lt;span class="kwrd"&gt;if&lt;/span&gt;( _items.Count &amp;gt; 0 )
            item = _items.Dequeue();
    }
}&lt;/pre&gt;

&lt;p&gt;The main window creates an instance of the TimedQueue class.&amp;#160; Every time an addin wants to display a message, it’s added to the collection.&amp;#160; When &lt;b&gt;ItemAvailableEvent&lt;/b&gt; fires, it’s dispatched to the UI thread to be displayed.&amp;#160; Dispatching prevents cross-threading issues between the background &lt;b&gt;TimedQueue &lt;/b&gt;thread and the UI thread.&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; statuses_ItemAvailableEvent(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender,
    ItemAvailableEventArgs&amp;lt;StatusMessage&amp;gt; e)
{
    Dispatcher.BeginInvoke((ThreadStart)&lt;span class="kwrd"&gt;delegate&lt;/span&gt;() {
        StatusUpdatedHandler(e.Item); }
        , DispatcherPriority.Background);
}&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Though this instance is being used for status messages, you can also use &lt;b&gt;TimedQueue &lt;/b&gt;for other purposes, when you are willing to lose old messages.&amp;#160; One example would be to throttle user input, such as a game that doesn’t want constant firing or jumping as fast as the user clicks a button.&lt;/p&gt;

&lt;h3&gt;Next Steps&lt;/h3&gt;

&lt;p&gt;There are a number of things that would be nice to have in this application.&amp;#160; It would be good to allow utilities to extend the context menu to enable or disable something, or at least to jump straight to their configuration page.&lt;/p&gt;

&lt;p&gt;Using ClickOnce to deploy utilities would also be nice since it’s so clean for the user, but there is a cost:&amp;#160; ClickOnce is very strict about how applications can interact with the system.&amp;#160; They are always per-user, and they live in “secret” folders.&amp;#160; Developers can’t read or write to the hard drive except to protected storage (similar to the iPhone I suppose).&amp;#160; I’m not sure if they are restricted in other ways, but it could cause a hardship.&lt;/p&gt;

&lt;p&gt;It would also be nice if addins could be added at runtime.&amp;#160; This is a fairly simple case, but I didn’t get to it yet.&amp;#160; Furthermore, if you add, you might expect to enable/disable/remove at runtime too.&amp;#160; Unfortunately, disabling and removing aren’t really possible.&amp;#160; Sure, I could call &lt;b&gt;Stop&lt;/b&gt; on a utility and remove it from the UI (and not call &lt;b&gt;Start &lt;/b&gt;on it next time), but that’s not really disabled since it could still be running until the next restart.&amp;#160; I couldn’t force it to die unless I used separate application domains, which I’m loath to do.&lt;/p&gt;

&lt;p&gt;Finally, I’d really like to get an “app store” type of repository going.&amp;#160; I imagine being able to publish utilities like Sidebar Gadgets or Windows Live Writer Plugins so users can browse, read information, and click-and-install.&amp;#160; That could be a really great way to make the idea take off. &lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;There are definitely some rough edges at this point, but it’s getting there.&amp;#160; The source code is fully available and I’d be willing to give commit access to anyone interested in moving things forward.&amp;#160; Just drop me a line!&lt;/p&gt;

&lt;h3&gt;About Arian&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://www.ariankulp.com"&gt;Arian Kulp&lt;/a&gt; is a software developer living in Western Oregon.&amp;#160; He creates samples, screencasts, demos, labs, and articles; speaks at programming events; and enjoys spending time with his family.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9941747" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/utility/default.aspx">utility</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/UtilRunner/default.aspx">UtilRunner</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/MEF/default.aspx">MEF</category></item><item><title>Trace.Writing in your web applications</title><link>http://blogs.msdn.com/coding4fun/archive/2009/12/25/9941111.aspx</link><pubDate>Fri, 25 Dec 2009 08:45:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9941111</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9941111.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9941111</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9941111</wfw:comment><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Trace.Writinginyourwebapplications_26D4/tracing_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="tracing" border="0" alt="tracing" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Trace.Writinginyourwebapplications_26D4/tracing_thumb.jpg" width="500" height="256" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We’ve talked in the past about debugging your application but if you can’t attach a debugger to your website, &lt;a href="http://blogs.msdn.com/webdevelopertips/archive/2009/12/18/tip-100-did-you-know-how-to-view-asp-net-trace-information.aspx"&gt;why not use the ASP.Net Tracing&lt;/a&gt;?&amp;#160; This acts very much like a &lt;strong&gt;Debug.WriteLine&lt;/strong&gt; in a Windows application but instead you do &lt;strong&gt;Trace.Write&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Since this does have some memory ramifications, you’ll have to add in a line to your web.config file under the &lt;strong&gt;System.Web&lt;/strong&gt; section.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
&lt;span class="rem"&gt;&amp;lt;!-- Add me! --&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;trace&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;mostRecent&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;pageOutput&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;requestLimit&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;20&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Then you just go to your trace.axd file.&amp;#160; So in an example where your application is in “WebSite1” and on your local development box, &lt;a href="http://localhost/WebSite1/trace.axd"&gt;http://localhost/WebSite1/trace.axd&lt;/a&gt; would be where to get this information&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9941111" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/debugging/default.aspx">debugging</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>IronRuby sketch up</title><link>http://blogs.msdn.com/coding4fun/archive/2009/12/16/9937778.aspx</link><pubDate>Wed, 16 Dec 2009 18:20:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9937778</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9937778.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9937778</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9937778</wfw:comment><description>&lt;p&gt;&lt;a href="http://blog.jimmy.schementi.com/2009/12/ironruby-rubyconf-2009-part-35.html"&gt;Jimmy Schementi posted about his talk at RubyConf 2009&lt;/a&gt; and talked about embedding IronRuby in another program.&amp;#160; His goals were:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;2D rendering surface with simple primitive shapes &lt;/li&gt;    &lt;li&gt;Simple animation support – callbacks for each frame and each object on the canvas &lt;/li&gt;    &lt;li&gt;User-loadable “macros” for drawing and animating&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;His outcome looks amazing!&amp;#160; It is worth noting Jimmy is using Visual Studio 2010 beta 2 for the demo here.&amp;#160; His blog states he hasn’t tried it in Visual Studio 2008.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:7be7f167-1ea1-4505-9525-9cfe595696eb" class="wlWriterEditableSmartContent"&gt;&lt;div&gt;&lt;object width="400" height="280"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8185302&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=8185302&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="280"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9937778" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/IronRuby/default.aspx">IronRuby</category></item><item><title>use Less to reduce CSS clutter!</title><link>http://blogs.msdn.com/coding4fun/archive/2009/12/11/9932669.aspx</link><pubDate>Fri, 11 Dec 2009 18:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9932669</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9932669.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9932669</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9932669</wfw:comment><description>&lt;p&gt;&lt;a href="http://haacked.com/archive/2009/12/02/t4-template-for-less-css.aspx" mce_href="http://haacked.com/archive/2009/12/02/t4-template-for-less-css.aspx"&gt;Reading a post by Phil Haack&lt;/a&gt;, I learned about a neat technology called LESS that helps reduce the amount of CSS and duplicated code you have to create.&amp;#160; It was &lt;a href="http://lesscss.org/" mce_href="http://lesscss.org/"&gt;originally a Ruby Gem&lt;/a&gt; but now has a .Net port called .Less which can be found at &lt;a href="http://www.dotlesscss.com/" mce_href="http://www.dotlesscss.com"&gt;www.dotlesscss.com&lt;/a&gt;.&amp;#160; &lt;/p&gt;  &lt;p&gt;It lets you do some amazing things like global changes and even operations!&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Variable:&lt;/strong&gt;&lt;/p&gt;  &lt;pre class="csharpcode"&gt;@brand_color: #4D926F;
 
#header {
  color: @brand_color;
}
 
h2 {
  color: @brand_color;
}&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Operation:&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;@the-border: 1px;
@base-color: #111;
 
#header {
  color: @base-color * 3;
  border-left: @the-border;
  border-right: @the-border * 2;
}
 
#footer { 
  color: (@base-color + #111) * 1.5; 
}&lt;/pre&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9932669" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/web/default.aspx">web</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/CSS/default.aspx">CSS</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/ASP.Net/default.aspx">ASP.Net</category></item><item><title>Build your own Windows 7 Sensors!</title><link>http://blogs.msdn.com/coding4fun/archive/2009/12/10/9934884.aspx</link><pubDate>Thu, 10 Dec 2009 13:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9934884</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9934884.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9934884</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9934884</wfw:comment><description>&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/BuildyourownWindows7Sensors_A690/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/BuildyourownWindows7Sensors_A690/image_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: 0px" title=image border=0 alt=image align=right src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/BuildyourownWindows7Sensors_A690/image_thumb.png" width=240 height=220 mce_src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/BuildyourownWindows7Sensors_A690/image_thumb.png"&gt;&lt;/A&gt; Tired of having a computer with no sensors?&amp;nbsp; We’ve created a &lt;A href="http://code.msdn.microsoft.com/motionsensor" mce_href="http://code.msdn.microsoft.com/motionsensor"&gt;parallax windows 7 sensor driver with source code&lt;/A&gt; so you can create your own!&lt;/P&gt;
&lt;P&gt;The sensor device we made here is a Passive-Infrared Sensor.&amp;nbsp; So basically it is a motion sensor.&amp;nbsp; The board used in the white paper is the Parallax “BASIC Stamp HomeWork Board”.&amp;nbsp; Sadly these only come in a 10-pack so the fallback would be the &lt;A href="http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/CategoryID/11/List/0/SortField/0/Level/a/ProductID/1/Default.aspx" mce_href="http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/CategoryID/11/List/0/SortField/0/Level/a/ProductID/1/Default.aspx"&gt;BASIC Stamp 2 Module ($49.00)&lt;/A&gt; and getting either the &lt;A href="http://www.parallax.com/Store/Microcontrollers/BASICStampDevelopmentBoards/tabid/137/CategoryID/12/List/0/SortField/0/Level/a/ProductID/121/Default.aspx" mce_href="http://www.parallax.com/Store/Microcontrollers/BASICStampDevelopmentBoards/tabid/137/CategoryID/12/List/0/SortField/0/Level/a/ProductID/121/Default.aspx"&gt;BASIC Stamp 2 Carrier Board” ($15.99)&lt;/A&gt; or &lt;A href="http://www.parallax.com/Store/Microcontrollers/BASICStampDevelopmentBoards/tabid/137/CategoryID/12/List/0/Level/a/ProductID/126/Default.aspx?SortField=ProductName%2cProductName" mce_href="http://www.parallax.com/Store/Microcontrollers/BASICStampDevelopmentBoards/tabid/137/CategoryID/12/List/0/Level/a/ProductID/126/Default.aspx?SortField=ProductName%2cProductName"&gt;the Board of Education Dev Board (USB) ($41.99)&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The code example also has a .Net application that interprets the data from the sensor.&lt;/P&gt;
&lt;P&gt;More of an Arduino fan?&amp;nbsp; Coding4Fun is working with Brian Jepson (&lt;A href="http://twitter.com/bjepson" mce_href="http://twitter.com/bjepson"&gt;@bjepson&lt;/A&gt;) of &lt;A href="http://www.makezine.com/" mce_href="http://www.makezine.com/"&gt;MAKE&lt;/A&gt; and O'Reilly to create a driver that works with Arduino!&amp;nbsp; I’ll post more when it gets finished.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9934884" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/hardware/default.aspx">hardware</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/Windows+7/default.aspx">Windows 7</category></item><item><title>Windows 7: Jump Lists</title><link>http://blogs.msdn.com/coding4fun/archive/2009/12/09/9933039.aspx</link><pubDate>Thu, 10 Dec 2009 00:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9933039</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9933039.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9933039</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9933039</wfw:comment><description>&lt;p&gt;In this article, learn how to provide quick access to links and actions in your Windows 7 application by creating a Jump List.&lt;/p&gt; &lt;table border="0" cellspacing="0" cellpadding="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" width="282"&gt; &lt;p&gt;Arian T. Kulp &lt;br&gt;&lt;a title="http://www.ariankulp.com" href="http://www.ariankulp.com/"&gt;http://www.ariankulp.com&lt;/a&gt;&lt;/p&gt;&lt;/td&gt; &lt;td valign="top" width="356"&gt; &lt;p&gt;&lt;b&gt;Code It:&lt;/b&gt; &lt;a href="http://c4fjumplist.codeplex.com"&gt;Download&lt;/a&gt;&lt;strong&gt; &lt;br&gt;&lt;/strong&gt;&lt;b&gt;Difficulty:&lt;/b&gt; Intermediate &lt;br&gt;&lt;b&gt;Time Required:&lt;/b&gt; 3 hours &lt;br&gt;&lt;b&gt;Cost:&lt;/b&gt; Free! &lt;br&gt;&lt;b&gt;Software Needed:&lt;/b&gt; &lt;a href="http://www.microsoft.com/express/download/"&gt;Visual Basic or Visual C# Express (or higher&lt;/a&gt;, &lt;a href="http://code.msdn.microsoft.com/WindowsAPICodePack" target="_blank"&gt;Windows API Code Pack&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;h3&gt;Introduction&lt;/h3&gt; &lt;p&gt;Windows 7 includes a wealth of new features for developers to take advantage of.&amp;nbsp; This includes better rendering subsystems, new sensor and location API's, file libraries, federated search, and of course, the improved taskbar.&amp;nbsp; My last article discussed the taskbar's ability to show custom previews and toolbar icons.&amp;nbsp; This article focuses on Jump Lists - the replacement for notification area context menus.&lt;/p&gt; &lt;p&gt;To get started, download &lt;a href="http://www.microsoft.com/exPress/" target="_blank"&gt;Visual Studio 2008 Express Edition&lt;/a&gt; or higher (C# or VB).&amp;nbsp; Or, just go for &lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" target="_blank"&gt;Visual Studio 2010 Beta 2&lt;/a&gt; - it's available now and well worth the download.&amp;nbsp; All Express editions are free, and either 2008 or 2010 versions will work fine with this article's accompanying code.&lt;/p&gt; &lt;h3&gt;What's a Jump List?&lt;/h3&gt; &lt;p&gt;Jump Lists are a new concept in Windows 7 that allow developers to provide shortcuts for users right from their icon's context menu in the taskbar or Start menu.&amp;nbsp; The shortcuts could be simple links to the documents folder or a library for a given application, or links back to the same application with a parameter passed to cause something to happen.&lt;/p&gt; &lt;p&gt;You can use this method in Live Messenger to change online status, display the new message window, or open web pages relating to the application.&amp;nbsp; In the end, all of these are shortcuts.&amp;nbsp; Shortcuts to URL's, or shortcuts back to the executable with an argument that causes some change to occur.&lt;/p&gt; &lt;h3&gt;Windows API Code Pack&lt;/h3&gt; &lt;p&gt;The Windows API Code Pack lets you take advantage of specific features of Windows Vista and Windows 7 that aren't available across the general framework, as well as native features that don't make sense in the common CLR used across all the supported configurations. Much of it consists of interop wrappers.  &lt;p&gt;With the Code Pack, you get access to the new taskbar, Direct2D, DirectWrite, shell properties, Jump Lists, and more. The download also includes numerous sample code projects to get you started, so there's no excuse for avoiding new features!  &lt;h3&gt;Adding a Jump List&lt;/h3&gt; &lt;p&gt;Adding a Jump List is easy.&amp;nbsp; After you create the list itself, add items (shortcuts to files or folders, and tasks) to it.&amp;nbsp; Then, you can choose how a user's recent or frequently used documents show up.&amp;nbsp; Windows manages the user documents list, which relieves you of some work.  &lt;p&gt;It's important to note that in order to make a change to the list, you have to recreate the entire thing.&amp;nbsp; In other words, you'll replace the old list with a new one, rather than updating it.  &lt;p&gt;Here's how the process works:  &lt;p&gt;First, add the two required references from the Windows API Code Pack.&amp;nbsp; You can either build a project and reference the DLL's, or directly add projects to your solution:  &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Windows API Code Pack references" border="0" alt="Windows API Code Pack references" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_thumb_1.png" width="244" height="84"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;For convenience, you can add the namespaces to your &lt;em&gt;using &lt;/em&gt;block to shorten typing later: &lt;/p&gt; &lt;p&gt;&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;Imports&lt;/span&gt; Microsoft.WindowsAPICodePack.Taskbar
&lt;span class="kwrd"&gt;Imports&lt;/span&gt; Microsoft.WindowsAPICodePack.Shell&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Visual C#&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.WindowsAPICodePack.Taskbar;
&lt;span class="kwrd"&gt;using&lt;/span&gt; Microsoft.WindowsAPICodePack.Shell;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;Microsoft.WindowsAPICodePack.Taskbar.JumpList &lt;/em&gt;class is where most of the action is.&amp;nbsp; There's a static factory method, &lt;em&gt;CreateJumpList&lt;/em&gt;, to create the list.&amp;nbsp; Always start by calling this method, even if the application has created a Jump List in the past.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;Private&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt; CreateJumpList()
    &lt;span class="kwrd"&gt;Dim&lt;/span&gt; jl &lt;span class="kwrd"&gt;As&lt;/span&gt; JumpList = JumpList.CreateJumpList()&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Visual C#&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; CreateJumpList()
{
    JumpList jl = JumpList.CreateJumpList();&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Next, you have several options, depending on what you need in the list.&amp;nbsp; The most basic group is the list of files.&amp;nbsp; You can choose to show Recent files, Frequent files, or neither-but you can't have both.&amp;nbsp; If you don't make a choice here, you'll get Recent files automatically, as long as you have a registered file type. 
&lt;p&gt;&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;' Show user files: Recent, Frequent, or None&lt;/span&gt;
jl.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Visual C#&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="rem"&gt;// Show user files: Recent, Frequent, or None&lt;/span&gt; &lt;br&gt;jl.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent; &lt;br&gt;&lt;/p&gt;
&lt;p&gt;Now you can add one or more custom categories of items.&amp;nbsp; These are either folders or files.&amp;nbsp; There are two very important rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The files/folders must exist!&amp;nbsp; If necessary, check the path before adding the &lt;em&gt;JumpListItem &lt;/em&gt;or you'll have a crash.&amp;nbsp; &lt;li&gt;The files you add have to be of a type registered for your application, or you'll crash. Even worse: the exception won't occur on the line where you add it, but rather when you're done setting it up and try to refresh the list. &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;I've commented out the last item here, but you would use a &lt;em&gt;JumpListItem &lt;/em&gt;for actual file system files, and &lt;em&gt;JumpListLink &lt;/em&gt;objects for non-filesystem references.&amp;nbsp; Again, don't add a JumpListItem unless you know that it exists and that you're registered to handle it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;' Add my own links (nouns)&lt;/span&gt;
&lt;span class="kwrd"&gt;Dim&lt;/span&gt; catActions &lt;span class="kwrd"&gt;As&lt;/span&gt; &lt;span class="kwrd"&gt;New&lt;/span&gt; JumpListCustomCategory(&lt;span class="str"&gt;"Destinations"&lt;/span&gt;)

catActions.AddJumpListItems(
    &lt;span class="kwrd"&gt;New&lt;/span&gt; JumpListLink(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), &lt;span class="str"&gt;"My Pictures"&lt;/span&gt;), _
    &lt;span class="kwrd"&gt;New&lt;/span&gt; JumpListLink(&lt;span class="str"&gt;"http://blogs.msdn.com/coding4fun"&lt;/span&gt;, &lt;span class="str"&gt;"Visit Coding4Fun"&lt;/span&gt;), _
    &lt;span class="kwrd"&gt;New&lt;/span&gt; JumpListLink(&lt;span class="str"&gt;"http://code.msdn.microsoft.com/WindowsAPICodePack"&lt;/span&gt;, &lt;span class="str"&gt;"Windows API Code Pack"&lt;/span&gt;))
    &lt;span class="rem"&gt;'new JumpListItem(@"c:\Test1.c4f")&lt;/span&gt;

jl.AddCustomCategories(catActions)&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Visual C#&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;// Add my own links (nouns)&lt;/span&gt;
JumpListCustomCategory catActions = &lt;span class="kwrd"&gt;new&lt;/span&gt; JumpListCustomCategory(&lt;span class="str"&gt;"Destinations"&lt;/span&gt;);
catActions.AddJumpListItems(
    &lt;span class="kwrd"&gt;new&lt;/span&gt; JumpListLink(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), &lt;span class="str"&gt;"My Pictures"&lt;/span&gt;),
    &lt;span class="kwrd"&gt;new&lt;/span&gt; JumpListLink(&lt;span class="str"&gt;"http://blogs.msdn.com/coding4fun"&lt;/span&gt;, &lt;span class="str"&gt;"Visit Coding4Fun"&lt;/span&gt;),
    &lt;span class="kwrd"&gt;new&lt;/span&gt; JumpListLink(&lt;span class="str"&gt;"http://code.msdn.microsoft.com/WindowsAPICodePack"&lt;/span&gt;, &lt;span class="str"&gt;"Windows API Code Pack"&lt;/span&gt;)
    &lt;span class="rem"&gt;//new JumpListItem(@"c:\Test1.c4f")&lt;/span&gt;
    );

jl.AddCustomCategories( catActions);&lt;/pre&gt;
&lt;p&gt;You can add one or more tasks as&amp;nbsp; links to system executables by using the &lt;em&gt;AddUserTasks &lt;/em&gt;method of the JumpList object.&amp;nbsp; Either create multiple objects and add them as a variable argument list, or add them one at a time, as I have here.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;' Add our user tasks (verbs)&lt;/span&gt;
jl.AddUserTasks(&lt;span class="kwrd"&gt;New&lt;/span&gt; JumpListLink(Path.Combine(systemFolder, &lt;span class="str"&gt;"notepad.exe"&lt;/span&gt;), &lt;span class="str"&gt;"Open Notepad"&lt;/span&gt;) _
    &lt;span class="kwrd"&gt;With&lt;/span&gt; {.IconReference = &lt;span class="kwrd"&gt;New&lt;/span&gt; IconReference(Path.Combine(systemFolder, &lt;span class="str"&gt;"notepad.exe"&lt;/span&gt;), 0)})&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Visual C#&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;jl.AddUserTasks(&lt;span class="kwrd"&gt;new&lt;/span&gt; JumpListLink(Path.Combine(systemFolder, &lt;span class="str"&gt;"notepad.exe"&lt;/span&gt;), &lt;span class="str"&gt;"Open Notepad"&lt;/span&gt;)
{
    IconReference = &lt;span class="kwrd"&gt;new&lt;/span&gt; IconReference(Path.Combine(systemFolder, &lt;span class="str"&gt;"notepad.exe"&lt;/span&gt;), 0)
});&lt;/pre&gt;
&lt;p&gt;The &lt;em&gt;IconReference&lt;/em&gt; property sets a pointer to the icon by referencing a DLL or EXE and then an index.&amp;nbsp; Specifying an EXE with "0" is a good way to get the default icon for an executable that you are linking to.&lt;/p&gt;
&lt;p&gt;You can add a separator to the list whenever you need to.&amp;nbsp; The &lt;i&gt;JumpListSeparator &lt;/i&gt;class represents a separator and can be added using the &lt;i&gt;AddUserTasks &lt;/i&gt;call. 
&lt;p&gt;&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;jl.AddUserTasks(&lt;span class="kwrd"&gt;New&lt;/span&gt; JumpListSeparator())&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Visual C#&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;jl.AddUserTasks(&lt;span class="kwrd"&gt;new&lt;/span&gt; JumpListSeparator());&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;The final links in our Jump List link back to our own executable. This is the most common use of Jump Lists.&amp;nbsp; Just having a Recent/Frequent list is nice, but being able to trigger actions on the program itself-even when it's not started-is really handy.&amp;nbsp; It's almost like a menu of command line options! 
&lt;p&gt;Commands in the list that invoke actions on the application itself involve calling the same application with different arguments.&amp;nbsp; Remember that this isn't a true menu; you won't receive a &lt;em&gt;Click&lt;/em&gt; event.&amp;nbsp; Instead, you need to deal with an argument that's passed to you, even if you're already running. 
&lt;p&gt;Remember that the first argument on the command line is always the fully-qualified location to the running executable.&amp;nbsp; The &lt;i&gt;Arguments &lt;/i&gt;property lets you specify command line arguments that users don't directly see.&amp;nbsp; For this sample application, I've defined three dummy arguments.&amp;nbsp; If one of these is passed in, the application changes the background color of a label and indicates which argument it was. 
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Visual Basic&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;jl.AddUserTasks(&lt;span class="kwrd"&gt;New&lt;/span&gt; JumpListLink(&lt;span class="kwrd"&gt;Assembly&lt;/span&gt;.GetEntryAssembly().Location, &lt;span class="str"&gt;"Action 1 (Green)"&lt;/span&gt;) _
    &lt;span class="kwrd"&gt;With&lt;/span&gt; {.Arguments = &lt;span class="str"&gt;"-1"&lt;/span&gt;, .IconReference = &lt;span class="kwrd"&gt;New&lt;/span&gt; IconReference(&lt;span class="kwrd"&gt;Assembly&lt;/span&gt;.GetEntryAssembly().Location, 0)})&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;&lt;strong&gt;Visual C#&lt;/strong&gt;&lt;/p&gt;&lt;pre class="csharpcode"&gt;jl.AddUserTasks(&lt;span class="kwrd"&gt;new&lt;/span&gt; JumpListLink(Assembly.GetEntryAssembly().Location, &lt;span class="str"&gt;"Action 1 (Green)"&lt;/span&gt;)
{
    IconReference = &lt;span class="kwrd"&gt;new&lt;/span&gt; IconReference(Assembly.GetEntryAssembly().Location, 0),
    Arguments = &lt;span class="str"&gt;"-1"&lt;/span&gt;
});&lt;/pre&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Sample JumpList" border="0" alt="Sample JumpList" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_thumb_2.png" width="267" height="367"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;h3&gt;Invoking Self Actions&lt;/h3&gt;
&lt;p&gt;Windows Live Messenger uses Jump List actions for setting its own available status, and Windows Media Player has Jump List actions for skipping tracks or stopping.&amp;nbsp; Likewise, you can add tasks that invoke actions on the same executable.&amp;nbsp; If the application isn't running (remember that the Jump List is still available), this will cause it to be launched with the right argument.&amp;nbsp; That's no problem.&amp;nbsp; What if it's already running though?&lt;/p&gt;
&lt;p&gt;The key is to find a way to pass messages between running instances.&amp;nbsp; When the application starts up, check to see if another instance is running by using a &lt;em&gt;Mutex &lt;/em&gt;(see &lt;em&gt;Program.cs&lt;/em&gt;).&amp;nbsp; If not, just use the arguments directly.&amp;nbsp; If it is running, send the information about the parameter to the other instance and then quit.&amp;nbsp; You could use temporary files, shared registry keys, or memory-mapped files.&amp;nbsp; I find it easiest to use window messages.&lt;/p&gt;
&lt;p&gt;You can find the code to create custom message ID's, to find the right window, and to send the message in my &lt;em&gt;WindowsMessageHelper &lt;/em&gt;class.&lt;/p&gt;
&lt;p&gt;From the main window code, override the &lt;em&gt;WndProc &lt;/em&gt;method.&amp;nbsp; This is the message loop for everything: mouse events, key events, window closing, and much more.&amp;nbsp; Ensure that the message is something you need; otherwise pass it on to the underlying handler.&lt;/p&gt;
&lt;p&gt;If the application is already running, post a message.&amp;nbsp; If not, start as usual and watch your message queue.&amp;nbsp; If you see a message of interest, take some action (in this case, just showing a message and changing a color).&amp;nbsp; &lt;/p&gt;
&lt;p&gt;The only other tricky thing to remember, is that you might startup as the only instance, and &lt;em&gt;also &lt;/em&gt;have a parameter.&amp;nbsp; For example, if the user clicked a task on the Jump List but the application isn't running.&amp;nbsp; I take the easy way out and check for parameters after fully starting up and then post to my own queue if needed!&amp;nbsp; That simplifies some of the logic anyway.&lt;/p&gt;
&lt;p&gt;If you don't mind using the &lt;strong&gt;Microsoft.VisualBasic.ApplicationServices&lt;/strong&gt; namespace from C#, then you can take advantage of the VB SingleInstance application mode.&amp;nbsp; This removes the need for any explicit mutex, interop, or message passing.&amp;nbsp; You can find some great information about this on Jocelyn Villaraza's excellent &lt;a href="http://aimeegurl.com/2009/11/13/making-your-win7-jumplists-trigger-on-the-same-application-instance/" target="_blank"&gt;blog post&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Registering a File Type&lt;/h3&gt;
&lt;p&gt;Remember: unless you're registered as a file handler for the type, you can't show recent or frequent files or point to individual files.&amp;nbsp; Register to be a file handler by creating a registry write operation to a key under HKEY_CLASSES.&amp;nbsp; &lt;p&gt;The problem is, you can't write to the HKEY_CLASSES branch of the registry without proper permissions.&amp;nbsp; By default, permission is only granted to the Administrators group.&amp;nbsp; You really don't want to require that your application run under administrative privileges-that would be &lt;i&gt;so &lt;/i&gt;Windows XP! 
&lt;p&gt;There are two alternatives: you could create a second application that can run elevated in order to perform the registration.&amp;nbsp; This is how the samples do it with the Windows API Code Pack. A better method is to create a custom installer for the project and perform the association there.&amp;nbsp; Installers always require administrative rights, and they only need to run once. 
&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;Creating the Installer&lt;/h3&gt;
&lt;p&gt;To create the installer, first add a setup project to your solution, following the usual steps. Then, from the &lt;b&gt;Project types &lt;/b&gt;list, click &lt;b&gt;Other Project Types | Setup and Deployment&lt;/b&gt;.&amp;nbsp; In the &lt;b&gt;Templates &lt;/b&gt;list, click &lt;b&gt;Setup Project&lt;/b&gt;. Give it a name, then add it.&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="New project types" border="0" alt="New project types" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_thumb_4.png" width="640" height="463"&gt;&lt;/a&gt; &lt;/h3&gt;
&lt;p&gt;From &lt;strong&gt;Solution Explorer&lt;/strong&gt;, right-click the setup project, then click the &lt;strong&gt;View | File Types &lt;/strong&gt;menu command.&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="View File Types" border="0" alt="View File Types" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_thumb_3.png" width="418" height="264"&gt;&lt;/a&gt; &lt;/h3&gt;
&lt;p&gt;From the File Types list, right-click &lt;strong&gt;File Types on Target Machine&lt;/strong&gt;, and then click &lt;strong&gt;Add File Type&lt;/strong&gt;.&amp;nbsp; Fill out the properties to name the file type and provide the extension.&amp;nbsp; For &lt;strong&gt;Command&lt;/strong&gt;, be sure to set it to the Primary output of the main project.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="File type properties" border="0" alt="File type properties" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_thumb_6.png" width="342" height="194"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The file type should appear like the following in the &lt;strong&gt;File Types &lt;/strong&gt;tab:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="File Types list" border="0" alt="File Types list" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Windows7Jumplists_12963/image_thumb_5.png" width="196" height="87"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Now you have a registered file type.&amp;nbsp; You still need to modify your setup project to copy the primary output (the EXE) to Program Files and customize any other properties in the setup project, but these are the special steps for file types.&amp;nbsp; If in doubt, take a look at sample code to see how the Setup project is configured.&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Working with the Windows API Code Pack makes it much easier to customize the taskbar and add Jump Lists, and gives you a great experience that really integrates well with the system.&amp;nbsp; Download Visual Studio Express, grab the Windows API Code Pack, and start digging in.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The new features won't work on machines prior to Windows 7, so be sure to check that they're supported.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9933039" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/windows+miscellaneous/default.aspx">windows miscellaneous</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/Windows+7/default.aspx">Windows 7</category></item><item><title>bugs on your screen?</title><link>http://blogs.msdn.com/coding4fun/archive/2009/12/07/9932678.aspx</link><pubDate>Mon, 07 Dec 2009 18:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9932678</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9932678.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9932678</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9932678</wfw:comment><description>&lt;p&gt;&lt;a href="http://adamkinney.wordpress.com/2009/12/03/bugcamsmash-motion-detection-with-silverlight-4-beta/"&gt;Adam Kinney created a fun example squishing bugs to show off Silverlight 4.0’s webcam support&lt;/a&gt;.&amp;#160; He created simple motion detection using a diff calculation on multiple threads to figure out where his finger was to smooth the bugs!&amp;#160; Here is a video showing off the project.&lt;/p&gt;  &lt;p&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="512" height="384"&gt; &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/vp09_11_30.xap" /&gt; &lt;param name="initParams" value="deferredLoad=true,duration=0,m=http://ecn.channel9.msdn.com/o9/ch9/3/1/5/0/1/5/BugCamSmash_ch9.wmv,autostart=false,autohide=true,showembed=true, postid=510513" /&gt; &lt;param name="background" value="#00FFFFFF" /&gt; &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt; &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt; &lt;/a&gt; &lt;/object&gt;&lt;/p&gt;  &lt;p&gt;If you want to check out the &lt;a href="http://adamkinney.wordpress.com/2009/12/03/bugcamsmash-motion-detection-with-silverlight-4-beta/"&gt;source code for BugCamSmash&lt;/a&gt;, Adam has that along with a few other helpful hints at his blog post.&lt;/p&gt;  &lt;p&gt;In addition, Adam is posting articles on how he created the application as well.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="http://adamkinney.wordpress.com/2009/12/04/bugcamsmash-dissected-part-1-smash-a-bug/"&gt;Smash a bug&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://adamkinney.wordpress.com/2009/12/05/bugcamsmash-dissected-part-2-make-the-bugs-crawl/"&gt;Make the bugs crawl&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://adamkinney.wordpress.com/2009/12/07/bugcamsmash-dissected-part-3-give-the-bugs-brains/"&gt;Giving the bugs Brains&lt;/a&gt;&lt;/li&gt; &lt;/ol&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9932678" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/web/default.aspx">web</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/Beta/default.aspx">Beta</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/Silverlight+4.0/default.aspx">Silverlight 4.0</category></item><item><title>Coding4Fun at PDC 2009 – Video Montage</title><link>http://blogs.msdn.com/coding4fun/archive/2009/12/04/9931631.aspx</link><pubDate>Fri, 04 Dec 2009 18:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9931631</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9931631.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9931631</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9931631</wfw:comment><description>&lt;p&gt;We’ll be posting one project each month but here is the Coding4Fun booth at PDC 2009!&amp;#160; You can even view the Iron Bartender challenge at GeekFest as well!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://channel9.msdn.com/posts/Clint/Coding4Fun-at-PDC-2009/"&gt;Overall Recap of each project&lt;/a&gt;     &lt;br /&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="512" height="384"&gt; &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/vp09_11_30.xap" /&gt; &lt;param name="initParams" value="deferredLoad=true,duration=0,m=http://ecn.channel9.msdn.com/o9/ch9/4/4/0/8/0/5/coding4funAtPdc_ch9.wmv,autostart=false,autohide=true,showembed=true, postid=508044, thumbnail=http://ecn.channel9.msdn.com/o9/ch9/4/4/0/8/0/5/coding4funAtPdc_512_ch9.png" /&gt; &lt;param name="background" value="#00FFFFFF" /&gt; &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt; &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt; &lt;/a&gt; &lt;/object&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://channel9.msdn.com/posts/LauraFoy/Coding4Fun-DrinkTendr/"&gt;Iron Bartender!&lt;/a&gt;     &lt;br /&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="512" height="384"&gt; &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/vp09_11_30.xap" /&gt; &lt;param name="initParams" value="deferredLoad=true,duration=0,m=http://ecn.channel9.msdn.com/o9/ch9/9/4/1/0/1/5/DrinkTendr_ch9.wmv,autostart=false,autohide=true,showembed=true, postid=510149, thumbnail=http://ecn.channel9.msdn.com/o9/ch9/9/4/1/0/1/5/DrinkTendr_512_ch9.png
" /&gt; &lt;param name="background" value="#00FFFFFF" /&gt; &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt; &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt; &lt;/a&gt; &lt;/object&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9931631" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/hardware/default.aspx">hardware</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/hardwarehacks/default.aspx">hardwarehacks</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/wiimote/default.aspx">wiimote</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/WPF/default.aspx">WPF</category></item><item><title>Is this frame straight?</title><link>http://blogs.msdn.com/coding4fun/archive/2009/12/02/9931839.aspx</link><pubDate>Thu, 03 Dec 2009 07:27:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9931839</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9931839.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9931839</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9931839</wfw:comment><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Isthisframestraight_149E9/Preview%5B1%5D_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Preview[1]" border="0" alt="Preview[1]" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Isthisframestraight_149E9/Preview%5B1%5D_thumb.png" width="500" height="265" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Joel Ivory Johnson created a rather functional program for his Zune HD.&amp;#160; &lt;a href="http://www.codeproject.com/KB/game/XNALevel.aspx"&gt;Joel created a bubble level&lt;/a&gt; based on the accelerometer in the Zune HD to get the tilt of the device.&amp;#160; From that data and &lt;a href="http://en.wikipedia.org/wiki/Pythagorean_theorem"&gt;everyone’s favorite theorem&lt;/a&gt;, he created a bubble level!&lt;/p&gt;  &lt;p&gt;Joel also explains the math needed for doing this such as calculating the direction and the magnitude.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;Vector3 accelReading = accelState.Acceleration;

tiltDirection = (&lt;span class="kwrd"&gt;float&lt;/span&gt;)Math.Atan2(accelReading.Y, accelReading.X);
tiltMagnitude = (&lt;span class="kwrd"&gt;float&lt;/span&gt;)Math.Sqrt(accelReading.X * accelReading.X + 
                 accelReading.Y * accelReading.Y );&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9931839" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/Zune/default.aspx">Zune</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/ZuneHD/default.aspx">ZuneHD</category></item><item><title>Creating a Pinball Game in Silverlight: Using the Physics Helper Library + Farseer Physics</title><link>http://blogs.msdn.com/coding4fun/archive/2009/11/30/9896181.aspx</link><pubDate>Mon, 30 Nov 2009 22:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9896181</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9896181.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9896181</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9896181</wfw:comment><description>&lt;p&gt;In this tutorial, we'll create a Silverlight pinball game using &lt;u&gt;Behaviors&lt;/u&gt;&lt;b&gt;, &lt;/b&gt;a new addition to Expression Blend 3 &amp;amp; Silverlight that allows you to create interactivity with little or no coding. &lt;/p&gt;  &lt;p&gt;Below you'll find a video and step-by-step walkthrough. &lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="157"&gt;Andy Beaulieu          &lt;br /&gt;&lt;a title="http://www.andybeaulieu.com/" href="http://www.andybeaulieu.com/"&gt;http://www.andybeaulieu.com/&lt;/a&gt;&amp;#160;&lt;/td&gt;        &lt;td valign="top" width="481"&gt;&lt;strong&gt;Run It: &lt;/strong&gt;&lt;a href="http://www.andybeaulieu.com/silverlight/3.0/pinballgame/Coding4FunPinball.htm"&gt;View The Demo&lt;/a&gt;           &lt;br /&gt;&lt;strong&gt;Code It: &lt;/strong&gt;&lt;a href="http://physicshelper.codeplex.com/Release/ProjectReleases.aspx"&gt;Download the Source&lt;/a&gt;           &lt;br /&gt;          &lt;br /&gt;&lt;strong&gt;Difficulty: &lt;/strong&gt;Intermediate           &lt;br /&gt;&lt;b&gt;Time Required:&lt;/b&gt; 4 Hour           &lt;br /&gt;&lt;strong&gt;Cost: &lt;/strong&gt;Free!           &lt;br /&gt;&lt;strong&gt;Software Needed: &lt;/strong&gt;&lt;a href="http://www.microsoft.com/expression/products/Blend_Overview.aspx"&gt;Microsoft Expression Blend 3&lt;/a&gt; (Free Trial), Microsoft Visual Studio 2008 or &lt;a href="http://www.microsoft.com/express/vcsharp/"&gt;Visual C# Express&lt;/a&gt;, &lt;a href="http://www.silverlight.net/GetStarted"&gt;Visual Studio Tools for Silverlight&lt;/a&gt;, &lt;a href="http://physicshelper.codeplex.com"&gt;Physics Helper Library&lt;/a&gt;.&amp;#160; To help get setup quicker, try &lt;a href="http://www.microsoft.com/web"&gt;Web Platform Installer&lt;/a&gt;.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt; &lt;iframe height="500" src="http://www.coding4fun.net/media/slpinball/slpinball.html" frameborder="0" width="100%"&gt;&lt;/iframe&gt;&lt;a href="http://www.andybeaulieu.com/silverlight/3.0/pinballgame/coding4funtutorial.htm#_Toc237838546"&gt;&lt;/a&gt;  &lt;br /&gt;  &lt;h3 align="center"&gt;&lt;a href="http://www.coding4fun.net/media/slpinball/slpinball.html" target="_blank"&gt;Open the video player in a new window/tab&lt;/a&gt;&lt;/h3&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;h3&gt;&lt;a name="_Toc237838538"&gt;Setup and Prerequisites&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;First you have to setup Physics Helper controls into Expression Blend. Follow these steps:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Download the Physics Helper ZIP file from &lt;a href="http://physicshelper.codeplex.com/Release/ProjectReleases.aspx"&gt;http://physicshelper.codeplex.com/Release/ProjectReleases.aspx&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Extract the ZIP file contents and dump them into a folder. &lt;/li&gt;    &lt;li&gt;Run &lt;b&gt;install.bat&lt;/b&gt;. (Note: this copies a few required assemblies to a folder in Blend 3.&lt;b&gt;)&lt;/b&gt;       &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image001.jpg" /&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;h3&gt;&lt;a name="_Toc237838539"&gt;Getting Started &amp;amp; Making the Ball&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;Next, you create the controller and the pinball. Here's how.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Open Expression Blend 3 and create a new “Silverlight 3 Application + Website” named PinballGame.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image002.jpg" width="400" height="324" /&gt; &lt;/li&gt;    &lt;li&gt;Change your default layout container to a Canvas. You can do this in the Objects and Timeline panel by right-clicking LayoutRoot and selecting Change Layout Type/Canvas. Canvas layout containers are better for games because they allow for positioning of elements at absolute (x,y) coordinates.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image003.jpg" width="290" height="266" /&gt; &lt;/li&gt;    &lt;li&gt;Give the application a bigger default size. Select the UserControl element in the Objects and Timeline panel. Then, in the Properties panel, change the Width to 800 and the Height to 600.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image004.png" width="269" height="190" /&gt; &lt;/li&gt;    &lt;li&gt;Add a &lt;b&gt;Physics Controller Behavior&lt;/b&gt; to our main game Canvas. From the Asset Panel, find the PhysicsController Behavior and drag it to the Objects and Timeline Panel. Then, drop it on the LayoutRoot Canvas.       &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image005.jpg" width="233" height="253" /&gt;       &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image006.jpg" width="233" height="122" /&gt; &lt;/li&gt;    &lt;li&gt;Change a few of the PhysicsController's properties, to make it easier to use. In the Objects and Timeline Panel, select the PhysicsControllerBehavior assigned to LayoutRoot. Then, set the highlighted properties as follows in the Properties Window:      &lt;br /&gt;1.)&amp;#160; Decrease the vertical gravity to 250       &lt;br /&gt;2.)&amp;#160; Increase the iterations to 200. This will help with collision detection in a fast-action game.       &lt;br /&gt;3.)&amp;#160; Set MousePickEnabled to true. This will allow us to manipulate objects with the mouse during development and testing.       &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image007.png" width="261" height="218" /&gt; &lt;/li&gt;    &lt;li&gt;Create a &amp;quot;playing field&amp;quot; for the pinball. To do this, draw out a Rectangle onto the artboard, just off the bottom of the user control bounds. Set the properties of the Rectangle as follows:      &lt;br /&gt;      &lt;br /&gt;&lt;b&gt;Name&lt;/b&gt;: rectPlatform       &lt;br /&gt;&lt;b&gt;Fill&lt;/b&gt;: select a color of your choosing (light blue is selected below).       &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image008.jpg" width="364" height="317" /&gt; &lt;/li&gt;    &lt;li&gt;To make “rectPlatform” a physics element, we need to add a PhysicsObjectBehavior to it. Find the PhysicsObjectBehavior in the Assets panel and drag/drop it onto rectPlatform on the Artboard.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image009.png" width="343" height="369" /&gt; &lt;/li&gt;    &lt;li&gt;In the Objects and Timeline Panel, select the PhysicsObjectBehavior belonging to rectPlatform. Then in the Properties Panel, set the IsStatic property to True so that the platform will stay in place.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image010.png" width="264" height="173" /&gt; &lt;/li&gt;    &lt;li&gt;Next we’ll create the ball. Draw out an Ellipse near the very top of the UserControl and set the following properties:      &lt;br /&gt;&lt;b&gt;       &lt;br /&gt;Name: &lt;/b&gt;ellBall&lt;b&gt;        &lt;br /&gt;Height&lt;/b&gt;: 50       &lt;br /&gt;&lt;b&gt;Width&lt;/b&gt;: 50       &lt;br /&gt;&lt;b&gt;Fill&lt;/b&gt;: A color of your choosing.       &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image011.jpg" width="378" height="326" /&gt; &lt;/li&gt;    &lt;li&gt;To make the ball a Physics Object, we need to add a PhysicsObjectBehavior to it. From the Asset Library, drag and drop a PhysicsObjectBehavior onto ellBall. &lt;/li&gt;    &lt;li&gt;Run the project by clicking F5. The ball should fall and hit the platform. Use the mouse to manipulate the ball. &lt;/li&gt; &lt;/ol&gt;  &lt;h3&gt;&lt;a name="_Toc237838540"&gt;Making the Flippers&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;In a pinball game, the Flippers are controlled by the player and are used to move the ball up the playfield. Standard pinball games have one right and one left flipper, but many games have three or more flippers located in various locations on the playfield. We’ll create two user controls to represent the flippers – a right flipper and a left flipper – that way we can easily add as many flippers as we want to our main playfield.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;In the Projects Panel, right-click the PinballGame (Silverlight) project and select Add New Item. Select UserControl and name the control LeftFlipper.xaml.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image012.jpg" width="222" height="241" /&gt; &lt;/li&gt;    &lt;li&gt;In the Objects and Timeline Panel, right-click LayoutRoot and select Change Layout Type/Canvas. This is required for the Physics Helper to work with nested User Controls.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image013.jpg" width="256" height="281" /&gt; &lt;/li&gt;    &lt;li&gt;In the Objects and Timeline Panel, select the UserControl element and set its Width and Height to 200 x 200 pixels in the Properties Panel. &lt;/li&gt;    &lt;li&gt;Draw out a Rectangle that is about 200 x 50 pixels big, centered in the user control. Round the corners of the Rectangle.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image014.png" width="235" height="185" /&gt; &lt;/li&gt;    &lt;li&gt;From the main Blend menu, select Object/Path/Convert to Path. This will create a new Path element from the Rectangle primitive. Then select the Direct Selection tool from the Toolbox, which will allow you to manipulate the individual points on the Path.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image015.png" width="37" height="84" /&gt; &lt;/li&gt;    &lt;li&gt;Select the top, left two points on the Path and move them down so that you end up with a more “flipper like” shape:      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image016.png" width="224" height="171" /&gt; &lt;/li&gt;    &lt;li&gt;In the Toolbox, select the Selection arrow and rotate the flipper 45 degrees so that it looks similar to this (be sure the flipper is still within the bounds of the user control):      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image017.jpg" width="196" height="186" /&gt; &lt;/li&gt;    &lt;li&gt;Right-click the flipper Path and select Group Into/Canvas. Name the Canvas &lt;b&gt;cnvLeftFlipper&lt;/b&gt; and resize it so that it surrounds the entire flipper Path. Note that you could “embellish” the cnvLeftFlipper with additional elements if you wish. &lt;/li&gt;    &lt;li&gt;Next we’ll create a Joint so that the Flipper can rotate on an axis. We’ll need something to anchor the joint to, so first let’s add a small Static object to hold the Joint in place. Draw out a Rectangle at the upper left of the flipper and name the Rectangle &lt;b&gt;rectHolder&lt;/b&gt;.       &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image018.jpg" width="196" height="197" /&gt; &lt;/li&gt;    &lt;li&gt;To add a Joint, we will need a UI element to visually represent where we want the joint created. You can use any element you want for this, but an Ellipse works pretty well. Draw out an Ellipse on top of the rectHolder.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image019.jpg" width="196" height="197" /&gt; &lt;/li&gt;    &lt;li&gt;Now we can add all of the required Physics Behaviors to the User Control.      &lt;ol&gt;       &lt;li&gt;From the Asset Library, drag a PhysicsObjectBehavior to the rectHolder Rectangle. Set its IsStatic property to True. Since we don’t really want to see the rectHolder in our UI, just send it to the back of the elements (Right-click, then select Order/Send to Back). &lt;/li&gt;        &lt;li&gt;Drag a PhysicsObjectBehavior to the cnvLeftFlipper Canvas. Set the RestitutionCoefficent property to “0.1”. (This makes the flipper a bit more “bouncy” on collisions) &lt;/li&gt;        &lt;li&gt;Drag a PhysicsJointBehavior to the Ellipse. Set the Body1 property to “cnvLeftFlipper” and the Body2 property to “rectHolder”. Set the CollisionGroup to “1” and the AngleLimitLower and AngleLimitUpper to 0 and 50 respectively. Also enable the AngleSpring:          &lt;br /&gt;&lt;/li&gt;        &lt;li&gt;Drag a PhysicsApplyTorqueBehavior to cnvLeftFlipper. We want to apply Torque when the user presses the Left arrow key, so we’ll create a Trigger for this. Select the Behavior and in the Properties Panel, click the New Trigger button.          &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image021.png" width="267" height="191" /&gt;&amp;#160; &lt;br /&gt;          &lt;br /&gt;Select the PhysicsKeyTrigger type from the popup.           &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image022.jpg" width="197" height="296" /&gt;           &lt;br /&gt;Set the Key property for the Trigger to “Left” and the TorqueValue to -100000           &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image023.png" width="264" height="187" /&gt; &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;Build the Project so that the LeftFlipper user control is available. &lt;/li&gt;    &lt;li&gt;Open MainPage.xaml and drag an instance of LeftFlipper from the Asset Library onto the Artboard. Position it near the bottom of the user control and slightly to the Left.      &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image024.jpg" width="373" height="321" /&gt; &lt;/li&gt;    &lt;li&gt;Run the project and try the flipper with the Left arrow key. &lt;/li&gt;    &lt;li&gt;In this step, we’ll create a copy of “LeftFlipper” to make&amp;#160; a “RightFlipper”. In the Projects Panel, right-click LeftFlipper.xaml and select Copy. Then right-click the PinBallGame Project and select Paste.      &lt;br /&gt;You now have a new User Control named “Copy of LeftFlipper.xaml”. Rename this to RightFlipper.xaml. Then in the code-behind file, make sure the Class and Constructor are also renamed to “RightFlipper”.       &lt;br /&gt;Change to XAML view for RightFlipper.xaml and change the x:Class attribute so that it inherits from RightFlipper:&amp;#160; &lt;br /&gt;      &lt;div style="border-bottom: silver 1px solid; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;       &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;UserControl&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #ff0000"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #ff0000"&gt;xmlns:d&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #ff0000"&gt;xmlns:mc&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #ff0000"&gt;mc:Ignorable&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;d&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #ff0000"&gt;xmlns:i&lt;/span&gt;=&amp;amp;&lt;span style="color: #ff0000"&gt;amp&lt;/span&gt;;&lt;span style="color: #ff0000"&gt;quotclr-namespace:System&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;Windows&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;Interactivity&lt;/span&gt;;&lt;span style="color: #ff0000"&gt;assembly&lt;/span&gt;=&lt;span style="color: #ff0000"&gt;System&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;Windows&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;Interactivity&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot; &lt;br /&gt;    xmlns:pb=&amp;quot;&lt;/span&gt;&lt;span style="color: #ff0000"&gt;clr-namespace:Spritehand&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;PhysicsBehaviors&lt;/span&gt;;&lt;span style="color: #ff0000"&gt;assembly&lt;/span&gt;=&lt;span style="color: #ff0000"&gt;Spritehand&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;PhysicsBehaviors&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot; &lt;br /&gt;x:Class=&amp;quot;&lt;/span&gt;&lt;span style="color: #ff0000"&gt;PinballGame&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;RightFlipper&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot; &lt;br /&gt;d:DesignWidth=&amp;quot;&lt;/span&gt;&lt;span style="color: #ff0000"&gt;640&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot; d:DesignHeight=&amp;quot;&lt;/span&gt;&lt;span style="color: #ff0000"&gt;480&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot; Height=&amp;quot;&lt;/span&gt;&lt;span style="color: #ff0000"&gt;200&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;quot; Width=&amp;quot;&lt;/span&gt;&lt;span style="color: #ff0000"&gt;200&lt;/span&gt;&amp;quot;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
Open RightFlipper.xaml and find the pathLeftFlipper element. Rename this to pathRightFlipper. Then, rename “cnvLeftFlipper” to “cnvRightFlipper”. Rename “rectHolder” to “rectRightHolder” and position the rectHolder and joint ellipse so that they are in the correct location for the flipper: 

    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image026.png" width="163" height="159" /&gt; 

    &lt;br /&gt;Modify the PhysicsJointBehavior for the joint in the Objects and Timeline Panel. Change BodyOne to “cnvRightFlipper”, BodyTwo to “rectRightHolder” and change the Angle limits so they are appropriate for the opposite flipper: 

    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image027.png" width="264" height="219" /&gt; 

    &lt;br /&gt;Select the PhysicsApplyTorqueBehavior for cnvRightFlipper in the Objects and Timeline Panel. Change the Key property for the trigger to “Right” so that it will initiate on the Right Arrow key down. Also change the TorqueValue so that it will apply torque clockwise: 

    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image028.png" width="265" height="190" /&gt; 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Add an instance of RightFlipper onto the MainPage.xaml and position it to the right of LeftFlipper. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image029.jpg" width="372" height="325" /&gt; &lt;/li&gt;

  &lt;li&gt;Test the project by clicking F5. You can now click left and right arrows keys to manipulate the paddles. &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;&lt;a name="_Toc237838541"&gt;Creating the Playfield + Scrolling&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Now let’s create more of a playfield for our Pinball game and add a Camera control so that the game will scroll and always follow the pinball. Feel free to tweak the design as you wish.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Open MainPage.xaml in Expression Blend and zoom out by using Ctrl plus minus (Ctrl -). &lt;/li&gt;

  &lt;li&gt;Draw out a Path using the Pen tool for the right border. Note that you can extend above the upper bounds of the User Control. Group this into a Canvas named “cnvLeftBorder” (right click the Path and select Group Into/Canvas). &lt;/li&gt;

  &lt;li&gt;Drag a PhysicsObjectBehavior from the Asset Library onto cnvLeftBorder and set the IsStatic property to True. Also set the CollisionGroup property to “1” so that collisions will not occur between the border and the Flippers. &lt;/li&gt;

  &lt;li&gt;Repeat Steps 2 and 3 above for the right border, naming that cnvRightBorder. You should have something similar to the following: 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image030.jpg" width="281" height="267" /&gt; &lt;/li&gt;

  &lt;li&gt;Continue adding border controls and applying physics behaviors until you are happy with your playfield. Make the playfield completely closed in so that the ball cannot escape (except by the bottom trap of course!) &lt;/li&gt;

  &lt;li&gt;You can also add more LeftFlipper and RightFlipper controls so that the player can more easily move the ball up the playfield. Here is one example playfield design: 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image031.jpg" width="238" height="336" /&gt; &lt;/li&gt;

  &lt;li&gt;To enable scrolling, we can add a Camera Controller to the ball, causing the camera to follow the ball around the screen. Drag a PhysicsCameraBehavior from the Asset Library onto the ellBall element. &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;&lt;a name="_Toc237838542"&gt;Creating a Kicking Target&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Pinball games have lots of different types of targets – some are simple sensors which give points on contact, others are little toys that gobble up the ball for a few seconds. In this step, we’ll create a Kicking Target, which gives points when hit by the ball but also kicks the ball back in the opposite direction.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Create a new User Control named KickingTarget. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image032.jpg" width="203" height="220" /&gt; &lt;/li&gt;

  &lt;li&gt;Change the LayoutRoot container to a Canvas by right-clicking and selecting Change Layout Type/Canvas. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image033.jpg" width="255" height="234" /&gt; &lt;/li&gt;

  &lt;li&gt;Select the [UserControl] in the Objects and Timeline Panel and set its Width and Height to 100 x 100. &lt;/li&gt;

  &lt;li&gt;Draw out an Ellipse that is 90x90 pixels, and positioned at Left, Top 5,5 (so that it is centered in the control). 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image034.png" width="484" height="141" /&gt; &lt;/li&gt;

  &lt;li&gt;Draw out a second Ellipse that is 70x70 pixels and positioned and Left, Top 15, 15. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image035.png" width="131" height="130" /&gt; &lt;/li&gt;

  &lt;li&gt;Group the two Ellipses into a Canvas by selecting them both in the Objects and Timeline Panel and selecting Group Into/Canvas. Name the Canvas “cnvKicker”. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image036.png" width="281" height="204" /&gt; &lt;/li&gt;

  &lt;li&gt;Drag a PhysicsObjectBehavior from the Asset Library onto cnvKicker. Set the IsStatic and RestitutionCoefficient properties as shown below. Setting the RestitutionCoefficient above a value of 1 will make the object “kick” things back. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image037.png" width="265" height="174" /&gt; &lt;/li&gt;

  &lt;li&gt;Build the project so that the new user control is available. Then open MainPage.xaml and add a few instance of “KickingTarget” to the page. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image038.jpg" width="208" height="296" /&gt; &lt;/li&gt;

  &lt;li&gt;Run the project and try out the Kicking Targets. &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;&lt;a name="_Toc237838543"&gt;Optimizing Performance&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Our pinball game is looking up, but the performance could be a lot better. The startup time for the game is taking quite awhile because the Physics Helper Library is determining the outline of all of the shapes. Also, the frame rate is too low.&lt;/p&gt;

&lt;p&gt;By default, Silverlight has a target frame rate of 60 frames per second. This is great for a lot of casual games, but Pinball requires a bit more speed. Additionally, Silverlight 3 introduces GPU Acceleration which can greatly increase the performance of our game by offloading graphics operations to the Video Card.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Open the Default.html page in the website project. This page hosts the Silverlight control and exposes the plugin parameters. Add the following parameters to the plug in to increase the default frame rate and enable GPU Acceleration for our game. 
    &lt;div style="border-bottom: silver 1px solid; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
      &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;object&lt;/span&gt; &lt;span style="color: #ff0000"&gt;data&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;data:application/x-silverlight,&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;application/x-silverlight-2&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;width&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;800&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;height&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;600&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;param&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;source&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ClientBin/PinballGame.xap&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;param&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;onerror&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;onSilverlightError&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;param&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;background&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;#010141&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;param&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;minRuntimeVersion&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;3.0.40624.0&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;param&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;MaxFrameRate&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;160&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;param&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;EnableGPUAcceleration&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;param&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;EnableCacheVisualization&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;param&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;autoUpgrade&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;a&lt;/span&gt; &lt;span style="color: #ff0000"&gt;href&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://go.microsoft.com/fwlink/?LinkID=149156&amp;amp;ampv=3.0.40624.0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;text-decoration: none;&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;img&lt;/span&gt; &lt;span style="color: #ff0000"&gt;src&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://go.microsoft.com/fwlink/?LinkId=108181&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;alt&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Get Microsoft Silverlight&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;border-style: none&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;a&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;object&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;Apply the CacheMode attribute to &lt;b&gt;&lt;i&gt;all elements&lt;/i&gt;&lt;/b&gt; in the game that are static. Since our pinball game’s elements are not animated, we can apply the CacheMode to each of them. (If the objects contained animations within them, then the Cache would be invalidated during animation). 

    &lt;div style="border-bottom: silver 1px solid; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
      &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Rectangle&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;rectPlatform&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;CacheMode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;BitmapCache&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Fill&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;#FF8AD0C9&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Height&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;70&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Width&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;800&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Canvas&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;Left&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;-14&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Canvas&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;Top&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;2172&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Opacity&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;0&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;i:Interaction.Behaviors&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;pb:PhysicsObjectBehavior&lt;/span&gt; &lt;span style="color: #ff0000"&gt;IsStatic&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;i:Interaction.Behaviors&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Rectangle&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;Now we’ll speed up the startup time by adding in a pre-calculated Point Cache. The Physics Helper Library echoes out the calculated points at runtime. Open the project in Visual Studio, and run with debugging on. In the Output Window, Find the ReadBoundaryCache method that was echoed out and Copy the entire method. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image041.jpg" width="523" height="218" /&gt; &lt;/li&gt;

  &lt;li&gt;Note that the copied code can contain multiple rows of the same points. You can trim out any rows that are duplicated, for example cnvRightFlipper_1 is a copy of cnvRightFlipper, so you can remove that from the list of points. &lt;/li&gt;

  &lt;li&gt;In order to load the list of boundary outlines into the Physics Controller, we need to get a reference to the controller through code. Open up MainPage.xaml.cs and add the highlighted code: 
    &lt;div style="border-bottom: silver 1px solid; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
      &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;partial&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; MainPage : UserControl &lt;br /&gt;{ &lt;br /&gt;    PhysicsControllerMain _physicsController; &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; MainPage() &lt;br /&gt;    { &lt;br /&gt;        &lt;span style="color: #008000"&gt;// Required to initialize variables &lt;/span&gt;&lt;br /&gt;        InitializeComponent(); &lt;br /&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Loaded += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; RoutedEventHandler(MainPage_Loaded); &lt;br /&gt;    } &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; MainPage_Loaded(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, RoutedEventArgs e) &lt;br /&gt;    { &lt;br /&gt;        _physicsController = LayoutRoot.GetValue( PhysicsControllerMain.PhysicsControllerProperty) &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; PhysicsControllerMain; &lt;br /&gt;        BoundaryCache.ReadBoundaryCache(_physicsController); &lt;br /&gt;    } &lt;br /&gt;}&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;Run the project and test the performance. Note that items that have a tint applied to them (Red, Blue, etc.) are NOT being cached and GPU accelerated. &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;&lt;a name="_Toc237838544"&gt;Scoring&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;In this section, we’ll embellish our game with a Score.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;We’ll create a Canvas that overlays our main Canvas to contain a High Score TextBlock. This is so that the Score TextBlock will not scroll with the rest of the Playfield. Open MainPage.xaml and the select LayoutRoot in the Objects and Timeline Panel. Right-click LayoutRoot and select Group Into/Canvas. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image043.jpg" width="227" height="200" /&gt; &lt;/li&gt;

  &lt;li&gt;Add a new StackPanel into this outside Canvas that contains two TextBlock aligned Horizontally. The first TextBlock should contain the Text “Score:” and the second TextBlock should contain the Text “0”. Set the Font Size to a larger value, around 12 pt. Position the TextBlock at the Top, Left portion of the Canvas. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image044.jpg" width="367" height="273" /&gt; &lt;/li&gt;

  &lt;li&gt;Next we’ll handle the Collision event for the Physics Controller so we can add to the score. Open MainPage.xaml.cs and add in a Property wrapper for the current&amp;#160; score: 
    &lt;div style="border-bottom: silver 1px solid; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
      &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; Score &lt;br /&gt;{ &lt;br /&gt;    get &lt;br /&gt;    { &lt;br /&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; Convert.ToInt32(txtScore.Text); &lt;br /&gt;    } &lt;br /&gt;    set &lt;br /&gt;    { &lt;br /&gt;        txtScore.Text = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;.ToString(); &lt;br /&gt;    } &lt;br /&gt;}&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;Handle the Collision event for the Physics Controller and increment the Score. 
    &lt;div style="border-bottom: silver 1px solid; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
      &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; MainPage_Loaded(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, RoutedEventArgs e) &lt;br /&gt;{ &lt;br /&gt;    _physicsController = LayoutRoot.GetValue(PhysicsControllerMain.PhysicsControllerProperty) &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; PhysicsControllerMain; &lt;br /&gt;    BoundaryCache.ReadBoundaryCache(_physicsController); &lt;br /&gt;        _physicsController.Collision += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PhysicsControllerMain.CollisionHandler(_physicsController_Collision); &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; _physicsController_Collision(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; sprite1, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; sprite2) &lt;br /&gt;{ &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (sprite1 == &amp;quot;ellBall&lt;span style="color: #006080"&gt;&amp;quot; &amp;amp;&amp;amp; sprite2.StartsWith(&amp;quot;ellKicker&amp;quot;&lt;/span&gt;)) &lt;br /&gt;        Score += 10; &lt;br /&gt;}&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;&lt;a name="_Toc237838545"&gt;Tracking Lives&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;When the ball collides with the “rectPlatform” obstacle at the bottom, the ball has been lost and we should launch a new ball. &lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Add a new ChildWindow to the project named “LostTheBall.xaml”. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image047.jpg" width="269" height="292" /&gt; &lt;/li&gt;

  &lt;li&gt;Set the “Cancel” button’s Visibility to Collapsed. &lt;/li&gt;

  &lt;li&gt;Add a TextBlock and set its Text to a message for the user stating the ball was lost. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image048.jpg" width="320" height="239" /&gt; &lt;/li&gt;

  &lt;li&gt;Add code in MainPage.xaml.cs to display the dialog and reset the ball. 
    &lt;br /&gt;LostTheBall _lostTheBall; 

    &lt;div style="border-bottom: silver 1px solid; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
      &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; _physicsController_Collision(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; sprite1, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; sprite2) &lt;br /&gt;{ &lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (sprite1 == &lt;span style="color: #006080"&gt;&amp;quot;ellBall&amp;quot;&lt;/span&gt; &amp;amp;&amp;amp; sprite2.StartsWith(&lt;span style="color: #006080"&gt;&amp;quot;cnvKicker&amp;quot;&lt;/span&gt;)) &lt;br /&gt;    { &lt;br /&gt;        Score += 10; &lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (_lostTheBall == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; &amp;amp;&amp;amp;ampsprite1 == &lt;span style="color: #006080"&gt;&amp;quot;ellBall&amp;quot;&lt;/span&gt; &amp;amp;&amp;amp; sprite2 == &lt;span style="color: #006080"&gt;&amp;quot;rectPlatform&amp;quot;&lt;/span&gt;) &lt;br /&gt;    { &lt;br /&gt;        _lostTheBall = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; LostTheBall(); &lt;br /&gt;        _lostTheBall.Closed += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler(dialog_Closed); &lt;br /&gt;        _lostTheBall.Show(); &lt;br /&gt;    } &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; dialog_Closed(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e) &lt;br /&gt;{ &lt;br /&gt;    _lostTheBall = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;; &lt;br /&gt;    PhysicsSprite ball = _physicsController.PhysicsObjects[&lt;span style="color: #006080"&gt;&amp;quot;ellBall&amp;quot;&lt;/span&gt;]; &lt;br /&gt;    ball.BodyObject.Position = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Vector2(460, 430); &lt;br /&gt;    }&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;&lt;a name="_Toc237838546"&gt;Adding Sound Effects&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;We can easily add buffered sound effects using the PhysicsSoundBehavior.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;In Visual Studio, Import two sound files into the project, score.wma and click.wma. Set their Build Action to Content. 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image050.jpg" width="220" height="315" /&gt; &lt;/li&gt;

  &lt;li&gt;Open MainPage.xaml in Expression Blend. Drag a PhysicsSoundBehavior to the LayoutRoot Canvas. Set the TriggerType to PhysicsCollisionTrigger and set the following properties: 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image051.png" width="268" height="288" /&gt; &lt;/li&gt;

  &lt;li&gt;Drag another PhysicsSoundBehavior to the LayoutRoot Canvas. Set the TriggerType to PhysicsCollisionTrigger and set the following properties: 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image052.png" width="265" height="263" /&gt; &lt;/li&gt;

  &lt;li&gt;Drag another PhysicsSoundBehavior to the LayoutRoot Canvas. Set the TriggerType to PhysicsCollisionTrigger and set the following properties: 
    &lt;br /&gt;&lt;img border="0" src="http://www.coding4fun.net/media/slpinball/images/image053.png" width="267" height="263" /&gt; &lt;/li&gt;

  &lt;li&gt;Run the project. &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;About the Author&lt;/h3&gt;

&lt;p&gt;Andy Beaulieu is a software developer and trainer who is well versed in many Microsoft technologies including Silverlight, ASP.NET, ADO.NET and WindowsForms. &lt;a href="http://www.andybeaulieu.com"&gt;Visit Andy's Blog&lt;/a&gt; for more fun and games with Silverlight.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9896181" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/gaming/default.aspx">gaming</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>INotify on new changes</title><link>http://blogs.msdn.com/coding4fun/archive/2009/11/29/9930051.aspx</link><pubDate>Mon, 30 Nov 2009 06:57:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9930051</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9930051.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9930051</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9930051</wfw:comment><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/jaimer/archive/2009/09/22/wpf-discussion-090922.aspx"&gt;Jaime Rodriguez has a great post on some of the interesting things we at Microsoft have on one of our internal discussions, namely the WPF one.&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;The big one I noticed was that my favorite was smack at the top.&amp;#160; INotifyCollection is now going to be part of system.dll so you can make your now see if stuff gets modified!&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;b&gt;Subject:&lt;/b&gt; Any chance of INotifyCollectionChanged moving to the core .NET libraries? &lt;/p&gt;    &lt;p&gt;The&amp;#160; System.Collections.Specialized.INotifyCollectionChanged interface is defined in WindowsBase.dll (primarily a WPF assembly) but my customer believes it should be pushed down into the core BCL so that other project types can benefit from it without requiring a reference to WPF/WindowsBase.&lt;/p&gt;    &lt;p&gt;Is this planned for 4.0 or later?&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;Answer:        &lt;br /&gt;&lt;/strong&gt;INotifyCollectionChanged, ObservableCollection&amp;lt;T&amp;gt;, and ReadOnlyObservableCollection&amp;lt;T&amp;gt; have been type forwarded into System.dll for .NET 4.&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9930051" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/WPF/default.aspx">WPF</category></item><item><title>Silverlight Development</title><link>http://blogs.msdn.com/coding4fun/archive/2009/11/18/9922257.aspx</link><pubDate>Wed, 18 Nov 2009 23:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9922257</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9922257.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9922257</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9922257</wfw:comment><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/SilverlightDevelopment_9377/sliverPlusLight_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="sliverPlusLight" border="0" alt="sliverPlusLight" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/SilverlightDevelopment_9377/sliverPlusLight_thumb.jpg" width="483" height="164" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;With Silverlight 4.0 just announced, here are some great posts / helpful tips on getting started with Silverlight in general.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://r.ch9.ms/sl4cl"&gt;Channel9 has a training course&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;Tim Heuer has a 7-part series “&lt;a href="http://timheuer.com/blog/articles/getting-started-with-silverlight-development.aspx"&gt;Getting Started with Silverlight&lt;/a&gt;”.&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.shinedraw.com/"&gt;Shine Draw is an awesome “Flash vs Silverlight” repository&lt;/a&gt; that can show you how to do an event in either technology.&lt;/li&gt;    &lt;li&gt;&lt;a href="http://silverlight.net/"&gt;Silverlight.net&lt;/a&gt; has an abundance of information.&amp;#160; They also have &lt;a href="http://silverlight.net/community/samples/silverlight-samples"&gt;Community Samples&lt;/a&gt; as well.&lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9922257" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/Getting+Started/default.aspx">Getting Started</category></item><item><title>Coding4Fun at PDC!</title><link>http://blogs.msdn.com/coding4fun/archive/2009/11/17/9923716.aspx</link><pubDate>Tue, 17 Nov 2009 18:09:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9923716</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9923716.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9923716</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9923716</wfw:comment><description>&lt;p&gt;Coding4Fun is in attendance at the Microsoft Professional Developer Conference!&amp;#160; We are demoing 5 projects that will have full how-to’s and will be open-sourced as well.&amp;#160; Drinktendr, Mind Blaster, Laser Graffiti, Augmented Reality, and Wi-Fi Warthogs are powered by .Net, XNA, WPF, Ling2Sql, WiiMote, MSMQ, Power Wheels, a Mind Set and a giant freaking laser!&lt;/p&gt;  &lt;h3&gt;Drinktendr&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Coding4FunatPDC_8947/IMG_4372.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="IMG_4372" border="0" alt="IMG_4372" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Coding4FunatPDC_8947/IMG_4372_thumb.jpg" width="240" height="160" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Ever get tired of pouring your own drink?&amp;#160; Have someone get upset at you since it was too strong or too weak?&amp;#160; Well, why not have a machine pour you the perfect beverage every time!&amp;#160; Drinktendr uses Linq2Sql and SQL Server to know what drinks it can make with what is on hand.&amp;#160; Combine this with WPF; the end user is given a top end experience.&lt;/p&gt;  &lt;h3&gt;Mind Blaster&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Coding4FunatPDC_8947/IMG_4328.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="IMG_4328" border="0" alt="IMG_4328" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Coding4FunatPDC_8947/IMG_4328_thumb.jpg" width="240" height="160" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;With aliens threatening to invade Earth, it’s your job to travel into outer space and destroy the alien threat…with your mind!&amp;#160; Wearing a brainwave detecting headset, coupled with head tracking hardware using a wiimote, use only your brain to destroy alien ships before they destroy you and the rest of humanity.&lt;/p&gt;  &lt;h3&gt;Laser Graffiti&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Coding4FunatPDC_8947/IMG_4323.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="IMG_4323" border="0" alt="IMG_4323" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Coding4FunatPDC_8947/IMG_4323_thumb.jpg" width="240" height="160" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Putting graffiti on something is not a very nice thing to do but what if with a flick of a switch, it was gone.&amp;#160; With a projector, an off the shelf webcam and a laser pointer, you can do just that.&amp;#160; Aim the laser at the building and start drawing.&amp;#160; Turn off the laser and it all goes away!&amp;#160; Using WPF and XNA, we can apply a variety of effects including fire, paint, and various particles.&amp;#160; This project was influenced by the Graffiti Research Lab.&lt;/p&gt;  &lt;h3&gt;Augmented Reality&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Coding4FunatPDC_8947/IMG_4340.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="IMG_4340" border="0" alt="IMG_4340" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Coding4FunatPDC_8947/IMG_4340_thumb.jpg" width="240" height="160" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We’ll be showing off two AR games.&amp;#160; ARroller and AR Domino Knockdown. ARroller is a single-player “marble game” experienced through a 3DOF-tracked video–see-through head-worn display. The player holds a tracked board on which a virtual marble must be manipulated through a maze of obstacles by tilting and moving the board. AR Domino Knockdown is a two-player first-person-shooter. Players hold 6DOF-tracked UMPCs through which they fire virtual balls at a configuration of virtual dominos on a shared table.&lt;/p&gt;  &lt;h3&gt;Wi-Fi Warthogs&lt;/h3&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Coding4FunatPDC_8947/IMG_4311.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="IMG_4311" border="0" alt="IMG_4311" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/Coding4FunatPDC_8947/IMG_4311_thumb.jpg" width="240" height="160" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Go big or go home.&amp;#160; After seeing Halo, we decided we had to make some remote control wart hogs to play laser tag with.&amp;#160; Using Xbox controllers, a wireless network, and Power Wheel cars, we’ve made a game of laser tag like no other.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9923716" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/c4fnews/default.aspx">c4fnews</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/hardware/default.aspx">hardware</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/wiimote/default.aspx">wiimote</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/PDC/default.aspx">PDC</category></item><item><title>XNA Role Playing Game (RPG) Starter Kit</title><link>http://blogs.msdn.com/coding4fun/archive/2009/11/16/9922196.aspx</link><pubDate>Mon, 16 Nov 2009 20:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9922196</guid><dc:creator>Coding4Fun</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/coding4fun/comments/9922196.aspx</comments><wfw:commentRss>http://blogs.msdn.com/coding4fun/commentrss.aspx?PostID=9922196</wfw:commentRss><wfw:comment>http://blogs.msdn.com/coding4fun/rsscomments.aspx?PostID=9922196</wfw:comment><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/charlie/archive/2009/09/27/xna-role-playing-game.aspx"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="Figure04-WorldMap_2[1]" border="0" alt="Figure04-WorldMap_2[1]" align="right" src="http://blogs.msdn.com/blogfiles/coding4fun/WindowsLiveWriter/XNARolePlayingGameRPGStarterKit_B013/Figure04-WorldMap_2%5B1%5D_39a576b6-43dd-4aa2-aa5b-1f0fe4674485.png" width="240" height="140" /&gt; Charlie Calvert has created great post&lt;/a&gt; covering the &lt;a href="http://creators.xna.com/en-US/starterkit/roleplayinggame"&gt;XNA Role Playing Game Starter Kit from the XNA team&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Charlie talks about the tile engine and the quest engine.&amp;#160; The tile engine supports several layers to create a complex final level.&amp;#160; The first layer allows you to define a basic landscape or the interior of a building. A second layer allows you to decorate it with trees, chairs, or other objects. A third layer contains your sprites, and a fourth layer defines the boundaries inside which the sprites can move.&lt;/p&gt;  &lt;p&gt;The downloads for the &lt;a href="http://creators.xna.com/en-US/starterkit/roleplayinggame"&gt;RGP Starter Kit&lt;/a&gt; are broken out into versions for XNA Game Studio 2.0 and 3.0. There is also a distinction between code that targets Windows and code for the XBox:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://creators.xna.com/downloads/?id=220"&gt;For XNA Game Studio 3.0 Windows&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://creators.xna.com/downloads/?id=221"&gt;For XNA Game Studio 3.0 XBox 360&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://creators.xna.com/downloads/?id=83"&gt;For XNA Game Studio 2.0 Windows&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://creators.xna.com/downloads/?id=84"&gt;For XNA Game Studio 2.0 XBox 360&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here are some additional links&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://creators.xna.com/en-US/starterkit/roleplayinggame"&gt;Home page and some documentation&lt;/a&gt; for the starter kit. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://forums.xna.com/forums/t/11880.aspx"&gt;Forum thread for discussing the kit&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;Information on the &lt;a href="http://creators.xna.com/en-US/tutorial/roleplayinggametutorial1"&gt;quest engine&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;Information the the &lt;a href="http://creators.xna.com/en-US/tutorial/roleplayinggametutorial2"&gt;tile engine&lt;/a&gt;. &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9922196" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/coding4fun/archive/tags/XNA/default.aspx">XNA</category><category domain="http://blogs.msdn.com/coding4fun/archive/tags/Getting+Started/default.aspx">Getting Started</category></item></channel></rss>