<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9</title>
    <atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Niners/c4f.352-Media/Posts/RSS"></atom:link>
    <itunes:summary></itunes:summary>
    <itunes:author>Microsoft</itunes:author>
    <itunes:subtitle></itunes:subtitle>
    <image>
      <url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
      <title>Channel 9</title>
      <link>http://channel9.msdn.com/Niners/c4f.352-Media/Posts</link>
    </image>
    <itunes:image href=""></itunes:image>
    <itunes:category text="Technology"></itunes:category>
    <description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
    <link>http://channel9.msdn.com/Niners/c4f.352-Media/Posts</link>
    <language>en</language>
    <pubDate>Thu, 20 Jun 2013 12:33:02 GMT</pubDate>
    <lastBuildDate>Thu, 20 Jun 2013 12:33:02 GMT</lastBuildDate>
    <generator>Rev9</generator>
    <c9:totalResults>2</c9:totalResults>
    <c9:pageCount>1</c9:pageCount>
    <c9:pageSize>25</c9:pageSize>
  <item>
      <title>What’s the Point of a Windows Phone 7 Cannon if It Doesn’t Look Great?</title>
      <description><![CDATA[
<p>I think Doc Brown summed it up best in <i>Back to the Future</i> when he told Marty, “The way I see it, if you're gonna build a time machine into a car, why not do it with some style?” Accordingly, that's the approach we took when we set out to design the
 user interface for the Windows Phone 7 Coding4Fun Cannon.
</p>
<h6>In this multipart article series, we'll cover:</h6>
<ol>
<li><a href="http://blogs.msdn.com/coding4fun/archive/2010/03/16/9979874.aspx">Project overview</a>
</li><li><a href="http://blogs.msdn.com/b/coding4fun/archive/2010/06/13/my_2d00_microsoft_2d00_teched_2d00_talk.aspx">Developing the phone application</a>
</li><li><a href="http://blogs.msdn.com/coding4fun/archive/2010/04/21/10000413.aspx">Building the robot</a>
</li><li><a href="http://blogs.msdn.com/b/coding4fun/archive/2010/09/09/10059924.aspx">Creating the phone user experience</a>
</li></ol>
<h2>Designing With One Hand Tied Behind Our Backs</h2>
<p>After <a href="http://blogs.msdn.com/b/coding4fun/archive/2010/03/16/9979874.aspx">
Clint got an eleventh-hour email from Scott Guthrie</a> asking him to build t-shirt cannon for the 2010 Mix Conference, we got an equally cryptic email at 352 Media Group asking us to create a touch screen interface in Silverlight for a t-shirt cannon. The
 only trouble was Clint wasn't allowed to tell us that it would run on the phone. Instead, we were given only the dimensions and some basic direction. We had a pretty good guess about what we were designing for, but we still had to proceed with caution. The
 initial request was for a set of icons, as well as a targeting reticule for use on the aim screen. Here are the icons we were asked to create, along with their preliminary descriptions:
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="193">
<p><b>Icon</b></p>
</td>
<td valign="top" width="204">
<p><b>Description</b></p>
</td>
<td valign="top" width="204">
<p><b>Icon</b></p>
</td>
</tr>
<tr>
<td valign="top" width="193">
<p>Drive mode</p>
</td>
<td valign="top" width="204">
<p>Driving the bot </p>
</td>
<td valign="top" width="204">
<p>Steering wheel</p>
</td>
</tr>
<tr>
<td valign="top" width="193">
<p>Aim mode</p>
</td>
<td valign="top" width="204">
<p>Aiming the cannon</p>
</td>
<td valign="top" width="204">
<p>Targeting reticule</p>
</td>
</tr>
</tbody>
</table>
</p>
<p>After creating the icons, we needed to create the screens for the main “status” screen, drive mode, aim mode, and finally fire mode. Here are some rough sketches given to us, to which we've since added the phone hardware. The icons were the ones we created
 in the first step, thrown in there on the right hand side. These gave us a good idea of what information needed to go on each of the screens:</p>
<p align="center"><b>Status Screen:</b><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image002.gif"><img title="clip_image002" border="0" alt="clip_image002" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image002_thumb.gif" width="540" height="276"></a></p>
<p align="center"><b>Drive Mode: <br>
</b><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image004.gif"><img title="clip_image004" border="0" alt="clip_image004" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image004_thumb.gif" width="539" height="270"></a>
<br>
<b>Aim Mode: <br>
</b><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/image_2.png"><img title="clip_image006" border="0" alt="clip_image006" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image006.gif" width="537" height="283"></a></p>
<p align="center"><b>Fire Mode:</b></p>
<p align="center"><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image008.gif"><img title="clip_image008" border="0" alt="clip_image008" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image008_thumb.gif" width="537" height="274"></a></p>
<h2>Ready, Aim, Skin!</h2>
<p>With our murky marching orders, we got to work creating some concepts. Most of the design was focused on skinning built-in Silverlight controls. The graphics were imported straight from Photoshop into Microsoft Expression Blend and used as various backgrounds
 and control-state skins. </p>
<p>Because we were given a set screen size, we didn't need to create a fluid desktop layout and could instead focus on the design requirements of a small touch screen. Having worked with Microsoft Surface, we were already aware of certain touch screen-based
 UI patterns. For example, designers need to create buttons that are large enough for the average user to press with a finger, which is not as precise as a mouse. Also, touch screens typically won't have a mouse-over control state (there is no “hover”), so
 interactive elements must obviously appear touchable and exhibit a noticeable pressed state even when the user's finger may be covering the majority of the button.
</p>
<p>Considering the audience it was going to be debuted to, we decided to create a tech feel. The idea of live webcam feeds for the backgrounds was tossed around, but given the fact that Microsoft had only one evening to test the hardware on-site, they decided
 to scrap that. Instead, we thought it would be fun to use floor plans of the Mandalay Bay conference center, which we found online. Here are the versions of each screen that we came up with:</p>
<p align="center"><b>Status Screen:</b><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image010.jpg"><img title="clip_image010" border="0" alt="clip_image010" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image010_thumb.jpg" width="540" height="324"></a><b></b></p>
<p align="center"><b>Drive Mode: <br>
</b><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image012.jpg"><img title="clip_image012" border="0" alt="clip_image012" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image012_thumb.jpg" width="540" height="324"></a></p>
<p align="center"><b>Aim Mode: <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image014.jpg"><img title="clip_image014" border="0" alt="clip_image014" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image014_thumb.jpg" width="540" height="324"></a></b></p>
<p align="center"><b>Fire Mode: <br>
<a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image016.jpg"><img title="clip_image016" border="0" alt="clip_image016" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image016_thumb.jpg" width="540" height="324"></a></b></p>
<h3>Getting Creative With Controls</h3>
<p>Some of our usage of simple controls in this project may surprise you. For example, the tank's gas pedal is simply a Silverlight button. Its pressed state has a slight shadow effect with a 0.2 second transition. The network status indicator lights are actually
 checkboxes. This allowed the C# developer to simply alter the checked state of each light rather than manipulate design attributes like color or opacity. The stick-shift is one big SliderBar with two values (zero and one), which took care of all the finger-dragging
 functionality.</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image018.jpg"><img title="clip_image018" border="0" alt="clip_image018" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image018_thumb.jpg" width="500" height="429"></a></p>
<p>One of the key changes we made across almost all controls was to increase the state transition time from zero seconds to about 0.2 seconds. When your Silverlight interface has a touchable physicality to it, a very short transition time makes the user experience
 feel a little more lively and less jarring than the “immediate flip” you might see in any other platform. Plus, it's a short enough time span that it won't interfere with the usability of the application. Anything above 0.3 seconds will probably feel sluggish.</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image020.jpg"><img title="clip_image020" border="0" alt="clip_image020" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image020_thumb.jpg" width="500" height="375"></a></p>
<p>We also took a couple of shortcuts when importing the graphics from Photoshop. The most obvious appears on the main menu, where the 4 circular icons are visible. We made each radio button's unchecked state transparent and placed all the icon graphics in
 the background image. Then we added the icons with the green glow as the “checked” state for each of the radio buttons. So, there are only 5 total images used for the menu. This was a quick way to implement the icon menu without spending too much time adjusting
 vector graphics and applying glow filters. Plus, we knew that if any icon graphics needed to be updated on-site, we'd only need to replace the effected PNG files and recompile the project.</p>
<p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image021.jpg"><img title="clip_image021" border="0" alt="clip_image021" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10059924/clip_image021_thumb.jpg" width="107" height="325"></a></p>
<p>Looking back at the driving screen's XAML, you can see two storyboards. There is a storyboard for switching forward and another for switching to reverse. Now we know more about the Visual State Manager in Silverlight. It allows you to define distinct, mutually
 exclusive states for a userControl's appearance. What we could have done is create two visual states called “Forward” and “Reverse” and switched between them programmatically. The VSM handles all the animations and handoffs between states, so this would have
 not only made the codebehind more streamlined, but simplified the XAML as well. </p>
<h2>Conclusion</h2>
<p>It was hard to tell during the MIX keynote if the crowd liked the interface. Most of the attendees were ducking for cover after they saw the distance and power of the cannon itself. We decided that the best compliment is that people didn't talk too much
 about the UI. I mean, you should only notice it if it's not working as you'd expect, right?</p>
<p>If you want to try this out, the download link for the source code is at the top of the article!</p>
<h2>About The Author</h2>
<p>Lincoln Anderson and Tim Pratt are senior designers at <a href="http://www.352media.com/">
web design company</a> <a href="http://www.352media.com/WebDesign.aspx">352 Media Group</a>.&nbsp; 352 Media Group focuses on emerging technologies like
<a href="http://www.352media.com/SilverlightDevelopment.aspx">Microsoft Silverlight Design</a>,
<a href="http://www.352media.com/WindowsPhone7Apps.aspx">Windows Phone 7 App Development</a>, and
<a href="http://www.352media.com/MicrosoftSurfaceDevelopment.aspx">Microsoft Surface Development</a>, has worked on other cool tools like the
<a href="http://weishare.net">WEIshare.net</a> tool and the <a href="http://tweetcraft.codeplex.com/">
Tweetcraft WOW Twitter client</a>.</p>
 <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Niners/c4f.352-Media/Posts/RSS&WT.dl=0&WT.entryid=Entry:RSSView:7a0ac07c033c407aa2e19e7600c89f88">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/Whats-the-Point-of-a-Windows-Phone-7-Cannon-if-It-Doesnt-Look-Great</comments>
      <itunes:summary>
I think Doc Brown summed it up best in Back to the Future when he told Marty, “The way I see it, if you&#39;re gonna build a time machine into a car, why not do it with some style?” Accordingly, that&#39;s the approach we took when we set out to design the
 user interface for the Windows Phone 7 Coding4Fun Cannon.
 
In this multipart article series, we&#39;ll cover:

Project overview
Developing the phone application
Building the robot
Creating the phone user experience

Designing With One Hand Tied Behind Our Backs
After 
Clint got an eleventh-hour email from Scott Guthrie asking him to build t-shirt cannon for the 2010 Mix Conference, we got an equally cryptic email at 352 Media Group asking us to create a touch screen interface in Silverlight for a t-shirt cannon. The
 only trouble was Clint wasn&#39;t allowed to tell us that it would run on the phone. Instead, we were given only the dimensions and some basic direction. We had a pretty good guess about what we were designing for, but we still had to proceed with caution. The
 initial request was for a set of icons, as well as a targeting reticule for use on the aim screen. Here are the icons we were asked to create, along with their preliminary descriptions:




Icon 


Description 


Icon 




Drive mode 


Driving the bot  


Steering wheel 




Aim mode 


Aiming the cannon 


Targeting reticule 




 
After creating the icons, we needed to create the screens for the main “status” screen, drive mode, aim mode, and finally fire mode. Here are some rough sketches given to us, to which we&#39;ve since added the phone hardware. The icons were the ones we created
 in the first step, thrown in there on the right hand side. These gave us a good idea of what information needed to go on each of the screens: 
Status Screen: 
Drive Mode: 


Aim Mode: 
 
Fire Mode: 
 
Ready, Aim, Skin!
With our murky marching orders, we got to work creating some concepts. Most of the design was focused on skinning built-in Silverlight controls. The graphics </itunes:summary>
      <link>http://channel9.msdn.com/coding4fun/articles/Whats-the-Point-of-a-Windows-Phone-7-Cannon-if-It-Doesnt-Look-Great</link>
      <pubDate>Thu, 09 Sep 2010 14:25:28 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/Whats-the-Point-of-a-Windows-Phone-7-Cannon-if-It-Doesnt-Look-Great</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/10059924_100.jpg" height="75" width="100"></media:thumbnail>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/10059924_220.jpg" height="165" width="220"></media:thumbnail>      
      <dc:creator>352 Media</dc:creator>
      <itunes:author>352 Media</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/coding4fun/articles/Whats-the-Point-of-a-Windows-Phone-7-Cannon-if-It-Doesnt-Look-Great/RSS</wfw:commentRss>
    </item>
  <item>
      <title>Building the Windows Experience Index Share Site – WEIshare.net</title>
      <description><![CDATA[ <p>By now you've probably seen <a href="http://channel9.msdn.com/Blogs/LarryLarsen/WEI-Share-Share-you-Windows-7-Experience-Index">Larry's video in which he explores the WEI Share</a> (“We” share) project and what it does. Now we're going to show you what went in to creating it, from building the desktop portion to grab the score to compiling the data to setting it up on Azure. </p><h2>Creating the Silverlight App and Web Service – Peter B.</h2><p>We originally set out to create a Silverlight Application that would display uploaded Windows Experience Index (WEI) Scores via a Web Service and Desktop Application. At the time, we created the application in Silverlight 3 and used a WCF Service to integrate with not only the desktop application but also the Silverlight application. Since we weren't sure exactly where the WCF Service was being hosted in relation to the Web Site, one of the things we did was make it so the location of the WCF Service can be fairly easily changed. We ended up going with Silverlight Parameters to pass in the location of the WCF Service. Doing this was fairly easy, but it took some set up. The first step involved modifying App.xaml.cs to the following:</p><p><pre class="brush: csharp">
private void Application_Startup(object sender, StartupEventArgs e)
{
    //Insert InitParams into Global Resources
    foreach (string key in e.InitParams.Keys)
    {
        this.Resources.Add(key, e.InitParams[key]);
    }
    this.RootVisual = new MainPage();
}</pre></p><p>Once this was done, we then had to modify the code behind for the main Silverlight app in MainPage.xaml.cs, like so:</p><p><pre class="brush: csharp">public MainPage()
{
    InitializeComponent();    if (App.Current.Resources.Contains(&quot;WCFServiceLocation&quot;)
        &amp;&amp; !String.IsNullOrEmpty(App.Current.Resources[&quot;WCFServiceLocation&quot;] as string))
    {
        EndpointAddress endpointAddress = new EndpointAddress(            App.Current.Resources[&quot;WCFServiceLocation&quot;].ToString());
        serviceClient = new WindowsExperienceServiceClient(            &quot;CustomBinding_IWindowsExperienceService&quot;, endpointAddress);
    }
    else
    {
        serviceClient = new WindowsExperienceServiceClient();
    }
    myDelay.Duration = TimeSpan.FromMilliseconds(2000);
    myDelay.Completed &#43;= new EventHandler(myDelayCompleted);
    myDelay.Begin();
    this.Loaded &#43;= new RoutedEventHandler(MainPage_Loaded);
}</pre></p><p>In the above example, I checked for the parameter, and finding that it existed I changed the Endpoint Address of the WCF Service (without an existing parameter, it uses the default address). After this was complete, we had to pass in a location similar to the following in the Default.aspx page's object tag for the Silverlight control:</p><p><pre class="brush: html">&lt;param name=&quot;initparams&quot; value=&quot;WCFServiceLocation=<a href="http://&lt;%=Request.Url.Host">http://&lt;%=Request.Url.Host</a> %&gt;:8080/windowsexperienceservice.svc&quot; /&gt;
</pre></p><p>This made changing the location of the WCF Service much easier, allowing the flexibility we later needed.</p><p>Within the WCF Service, we separated our code using a three layered approach utilizing separate folders for each layer “DataAccessLayer”, “BusinessLogicLayer”, and “BusinessEntities”. Within the BusinessEntities folder, we had the base classes containing each business entity. As an example, we had the WindowsAssessment class, which contained all of the properties of the data sent from the Desktop Application to the WCF Service, including scores. Below, you can see part of what this looked like:</p><p><pre class="brush: csharp">[DataContract]
public class WindowsAssessment
{
    public Guid? WindowsAssessmentID { get; set; }
    [DataMember]
    public decimal? SystemScore { get; set; }
    [DataMember]
    public decimal? AverageScore { get; set; }
    [DataMember]
    public decimal? MemoryScore { get; set; }
    [DataMember]
    public decimal? CpuScore { get; set; }
    [DataMember]
    public decimal? CpuSubAggScore { get; set; }
    [DataMember]
    public decimal? VideoEncodeScore { get; set; }    /* additional properties... */
}</pre></p><p>You'll notice above that [DataContract] and [DataMember] was set above the class and properties so that it could be used as part of the WCF Service.</p><p>Within the DataAccessLayer folder, we utilized Linq2Sql. We simply created a dbml file, and brought over the few assets we created in the database by dragging and dropping the tables from the Data Source into the diagram. Then, within the WindowsAssessment.cs file of the Data Access Layer, we created methods that used Linq2Sql for our basic CRUD, taking advantage of Linq to easily create paging that we can search, filter, and orderby. Finally, within the Business Logic Layer, we utilized the Business Entities and created different methods that called the DAL and also took advantage of HttpRuntime.Cache. </p><p>Once all of the layers were complete, the Desktop and Silverlight Application were free to communicate back and forth, allowing the Desktop App to send a score and the Silverlight App to display it.</p><h3>Upgrading to Silverlight 4 and Azure</h3><p>Unfortunately, after we completed all of this, Silverlight 4 released. We quickly moved to upgrade to Silverlight 4 and, while we were at it, also modify the app to utilize Windows Azure. </p><p>One of the first things I encountered was that the WCF Service was not going to be within the Web Site anymore. Azure has roles in which you create for your project. In this particular instance I needed 2 web roles, one for the website, one for the WCF. In the end my Solution looked like the following: </p><p><a href="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10056062/clip_image0024.jpg"><img title="clip_image002[4]" border="0" alt="clip_image002[4]" src="http://ecn.channel9.msdn.com/o9/c4fcontent/migration/10056062/clip_image0024_thumb.jpg" width="345" height="144"></a></p><p>Working with WCF as a WCF Role, I noticed that there were a few known issues, all of which were documented here: <a href="http://code.msdn.microsoft.com/wcfazure/Wiki/View.aspx?title=KnownIssues&amp;referringTitle=Home">http://code.msdn.microsoft.com/wcfazure/Wiki/View.aspx?title=KnownIssues&amp;referringTitle=Home</a>. Luckily, with another developer's help, we were able to pinpoint some of the issues and once we addressed them, we really didn't have much more to worry about when working with WCF.</p><p>The next hurdle was moving over the database. The easiest way to do this is to use the tool, SQL Azure Migration Wizard, which can be found on CodePlex at <a href="http://sqlazuremw.codeplex.com/">http://sqlazuremw.codeplex.com/</a>.</p><h2>Creating the Desktop Experience – Peter J</h2><p>I was tasked with creating a set of applications for showcasing user's Windows Experience Index (WEI) scores. The set of applications included a desktop application created using Windows Presentation Foundation (WPF) for retrieving the scores and other system data, and a web site using Silverlight for displaying the information.</p><p>I needed to create the desktop application. Accordingly, there were some initial pre-requisites and other considerations we had to deal with:</p><ul><li>Limiting the desktop application to only run in Windows 7 </li><li>Determining where the relevant WEI data is stored in the system </li><li>Retrieving the relevant information for all areas </li><li>Remote Service connectivity—in this case we used a WCF service </li><li>Not forcing the user to install/unzip anything (just download and run) </li></ul><p>After scouring the web, I found a site (<a href="http://www.codeguru.com/cpp/w-p/system/systeminformation/article.php/c8973">http://www.codeguru.com/cpp/w-p/system/systeminformation/article.php/c8973</a>) with just the information I needed:</p><p><pre class="brush: csharp">/// &lt;summary&gt;
/// Determines if the current version of windows is valid (Vista, 7, Server 2008)
/// &lt;/summary&gt;
/// &lt;returns&gt;&lt;/returns&gt;
public static bool IsValidWindowsVersion()
{
    System.OperatingSystem osInfo = System.Environment.OSVersion;
    //6 - Vista, 7, Server 2008
    if (osInfo.Version.Major == 6)
    {
        //windows 7 = 1
        if(osInfo.Version.Minor == 1)
            return true;
    }    return false;
}</pre></p><p>The next major hurdle to overcome was determining where all of the information for the system was stored. </p><p>I didn't really know where to start, so I started looking at MSDN and the search engines for the best way to get this information and I came across a term I had only heard in passing: WMI. Windows Managed Instruction (WMI) allows for querying the system for data, as well as other things that I did not use it for so we will skip all that. You can learn more on WMI on your own time here: <a href="http://msdn.microsoft.com/en-us/library/aa394582(VS.85).aspx">http://msdn.microsoft.com/en-us/library/aa394582(VS.85).aspx</a>. I also found a nifty tool from Microsoft called WMI Creator (<a href="http://www.microsoft.com/downloads/details.aspx?familyid=2cc30a64-ea15-4661-8da4-55bbc145c30e&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?familyid=2cc30a64-ea15-4661-8da4-55bbc145c30e&amp;displaylang=en</a>) to help facilitate my search. I was blown away by the sheer amount of data and left with no idea of where to start. So, it was back to MSDN to figure out what happens when the Experience Index is run. This made my task much easier since the Experience Index creates its own XML files with most of the data I need.</p><p>I retrieved a list of files and used the one that was within a day of the current date/time. This was easy stuff, till I had to determine what to do if they didn't have an Experience Index. If they didn't, I'd just run the Experience Index on the fly. To do this, set the program to tell the user that they do not have a current enough score and that we'll update the information for them by running the Windows System Assessment Tool (WinSAT).</p><p>The initial version was not very good since it was modal and caused the application to not refresh until the Experience Index finished running. Needless to say, I was not happy. What I did do, though, was setup a child form that would launch the WinSAT and query every 5 seconds to see if it was still running. Here is the initial call to load the dialog windows and, if successful, check again for a valid Experience Index to post:</p><p><pre class="brush: csharp">/// &lt;summary&gt;
/// Launches the dialog that handles launching WinSat and checking if it is running.
/// &lt;/summary&gt;
private void SetupAndRunWinSAT()
{
    WinSatProgress progressWindow = new WinSatProgress();
    bool? dialogResult = progressWindow.ShowDialog();
    if (dialogResult.HasValue &amp;&amp; dialogResult.Value)
        CheckForAndProcessScore();
}</pre></p><p>Now we are getting into the good stuff, so I will touch on the actual running of the WinSAT and querying the system for a running process.</p><p>Launching the WinSAT is pretty simple since there is an environment variable that points to its path:</p><p><pre class="brush: csharp">Environment.GetFolderPath(Environment.SpecialFolder.System) &#43; @&quot;\WinSat.exe&quot;</pre></p><p>I only started a basic process and told it to run. I did not tell it to run behind the scenes because I wanted the user to be sure something was actually happening since the WinSAT can take any number of minutes depending on the system configuration. I also setup a global variable (WinsatExecutableExited) used elsewhere in the application to query to see if the process exited:</p><p><pre class="brush: csharp">/// &lt;summary&gt;
/// Launches the winsat program
/// &lt;/summary&gt;
public static bool RunWinSatProgram()
{
    bool isLaunched = false;
    WinsatExecutableExited = false;    System.Diagnostics.Process winSatProcess = new System.Diagnostics.Process();    winSatProcess.StartInfo.FileName = Helpers.Globals.WinSatExecutable;
    winSatProcess.StartInfo.Arguments = Helpers.Globals.WinSatExecutableParameters;
    winSatProcess.EnableRaisingEvents = true;    winSatProcess.Exited &#43;= new EventHandler(WinSatProcess_Exited);    try
    {
        winSatProcess.Start();
        isLaunched = true;
    }
    catch
    { }    return isLaunched;
}</pre></p><p>You'll notice the exited event handler. I put that there so that when the process exited, it set the flag. However, I was having issues with it not always getting executed on some systems. To accommodate for this, I setup a DispatchTimer in the dialog window that would check every 5 seconds to see if the global WinsatExecutableExited flag was true or if the WinSAT process was still running. In order to check if the process is still running, I used WMI. Yes, yes I know—why, since I hadn't yet done much of anything with it, am I using WMI for this? Well, I won't bore you with details, but I found an example online and modified it to fit what I need (<a href="http://www.techimo.com/forum/applications-operating-systems/117464-need-vbulletin-script-check-see-if-process-running.html">http://www.techimo.com/forum/applications-operating-systems/117464-need-vbulletin-script-check-see-if-process-running.html</a>). Bet you weren't expecting that were you? (Or, maybe you were.) Long story short, I set up a method that I can pass a process name to, and it returns true/false if it is still running or null if it can't determine anything:</p><p><pre class="brush: csharp"></pre></p><p>Neat, huh? That's what happens every time the dialog counts down until it either finishes or can't—for whatever reason—determine the status of the WinSAT.</p><p>Now that the file is generated, we want to get all of the data goodness out of it so we can post our data to the service. Since this is an XML file, it was easily loaded into a XElement and traversed as needed. Now we come to another sticky point, retrieving other system data not stored in the XML file. This is where the web and that WMI Creator application came in handy. I would look online to find what I needed, and then leveraged WMI Creator to generated my base code for me. I setup an object for the retrieved data and here's what it looks like to query the system for the memory type and speed:</p><p><pre class="brush: csharp">/// &lt;summary&gt;
/// used to determine if the process is still running
/// <a href="http://www.techimo.com/forum/applications-operating-systems/117464-need-vbulletin-script-check-see-if-process-running.html">http://www.techimo.com/forum/applications-operating-systems/117464-need-vbulletin-script-check-see-if-process-running.html</a>
/// &lt;/summary&gt;
/// &lt;param name=&quot;processName&quot;&gt;&lt;/param&gt;
/// &lt;returns&gt;&lt;/returns&gt;
public static bool? IsProcessStillRunning(string processName)
{
    bool? response = null;    try
    {
        ManagementObjectSearcher searcher =
            new ManagementObjectSearcher(&quot;root\\CIMV2&quot;,
            &quot;SELECT * FROM Win32_Process&quot;);
        foreach (ManagementObject queryObj in searcher.Get())
        {
            if(string.Compare(queryObj[&quot;Name&quot;].ToString(), 
                processName, 
                StringComparison.OrdinalIgnoreCase) == 0)
            {
                response = true;
                break;
            }
        }        if(!response.HasValue)
            response = false;
    }
    catch (Exception ex)
    {
        System.Windows.MessageBox.Show(ex.Message &#43; 
            Environment.NewLine &#43; ex.StackTrace);
    }    return response;
}</pre></p><p>Now is about where I have all of my information ready and need to send it to the server. Setting up the service connection for initial testing is no problem. It's a standard Windows Communication Foundation (WCF) service. But here comes the hard part—setting it up so the service does not need information from a config file. Back to the web we go, since I am like the other 100% lazy programmers who prefer to just add a Service reference because it is easy. Well, there are two parts to this: generating the code class and setting up the service connection information.</p><p>Generating the code class is easy—you use a command line to generate it. It was a little complex since I was generating it for asynchronous calls to the service, but this was nothing MSDN couldn't help me with. Speaking of, here's the documentation from MSDN: <a href="http://msdn.microsoft.com/en-us/library/ms730059.aspx">http://msdn.microsoft.com/en-us/library/ms730059.aspx</a></p><p>The other part was sending up the binding endpoint. Most of the information I needed was generated when I generated the code file form the service. Now I just needed to determine how to put it all together. MSDN to the rescue yet again: <a href="http://msdn.microsoft.com/en-us/library/ms733107.aspx">http://msdn.microsoft.com/en-us/library/ms733107.aspx</a></p><p>What I ended up doing was creating a CustomBinding and specifying the same information/objects the system would have created for me using the values in the config file:</p><p><pre class="brush: csharp">/// &lt;summary&gt;
/// The wcf service reference member
/// &lt;/summary&gt;
WindowsExperienceServiceClient experienceClient = null;CustomBinding myBinding = new CustomBinding();
myBinding.Elements.Add(Helpers.Globals.CustomServiceBinding);
myBinding.Elements.Add(Helpers.Globals.CustomTransportBinding);
experienceClient = 
   new WindowsExperienceServiceClient(
      myBinding, 
      Helpers.Globals.CustomEndPoint);</pre></p><p>The global bindings and endpoints:</p><p><pre class="brush: csharp">/// &lt;summary&gt;
/// The binary encoding objct for the custom binding
/// &lt;/summary&gt;
public static BinaryMessageEncodingBindingElement CustomServiceBinding
{
    get
    {
        BinaryMessageEncodingBindingElement binaryEncoding = new BinaryMessageEncodingBindingElement();
        binaryEncoding.MaxReadPoolSize = 64;
        binaryEncoding.MaxSessionSize = 2048;
        binaryEncoding.MaxWritePoolSize = 16;
        binaryEncoding.ReaderQuotas.MaxDepth = 32;
        binaryEncoding.ReaderQuotas.MaxStringContentLength = 8192;
        binaryEncoding.ReaderQuotas.MaxArrayLength = 16384;
        binaryEncoding.ReaderQuotas.MaxBytesPerRead = 4096;
        binaryEncoding.ReaderQuotas.MaxNameTableCharCount = 16384;        return binaryEncoding;
    }
}/// &lt;summary&gt;
/// The transport element for the custom binding
/// &lt;/summary&gt;
public static HttpTransportBindingElement CustomTransportBinding
{
    get
    {
        HttpTransportBindingElement transportBinding = new HttpTransportBindingElement();
        transportBinding.ManualAddressing = false;
        transportBinding.MaxBufferPoolSize = 524288;
        transportBinding.MaxReceivedMessageSize = 65536;
        transportBinding.AllowCookies = false;
        transportBinding.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous;
        transportBinding.BypassProxyOnLocal = false;
        //decompressionEnabled=&quot;true&quot; 
        transportBinding.HostNameComparisonMode =  HostNameComparisonMode.StrongWildcard;
        transportBinding.KeepAliveEnabled = true;
        transportBinding.MaxBufferSize = 65536;
        transportBinding.ProxyAuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous;
        transportBinding.Realm = string.Empty;
        transportBinding.TransferMode = TransferMode.Buffered;
        transportBinding.UnsafeConnectionNtlmAuthentication = false;
        transportBinding.UseDefaultWebProxy = true;        return transportBinding;
    }
}/// &lt;summary&gt;
/// the endpoint used for the service communication
/// &lt;/summary&gt;
public static EndpointAddress CustomEndPoint
{
    get
    {
        return new EndpointAddress(Properties.Resources.WEIServiceEndpoint);    }
}</pre></p><p>Yes, it is just that easy. All I had to do after that was setup the call completed handler and then call the service method and then it was all done.</p><h2>Conclusion</h2><p>This was a really fun and challenging project for us. While we'd worked extensively in Silverlight, the desktop development was relatively new to us. After getting our bearings, we found it pretty simple to translate our Web development skills to the desktop environment with WPF.</p><p>If you want to try this out, the download link for the source code is at the top of the article!</p><h2>About The Authors</h2><p>Lincoln Anderson, Peter Brownstein, and Peter Juchniewicz are all developers at <a href="http://www.352media.com/">web design company</a> <a href="http://www.352media.com/WebDesign.aspx">352 Media Group</a>. The company, which focuses on emerging technologies like <a href="http://www.352media.com/SilverlightDevelopment.aspx">Microsoft Silverlight Design</a>, <a href="http://www.352media.com/WindowsPhone7Apps.aspx">Windows Phone 7 App Development</a>, and <a href="http://www.352media.com/MicrosoftSurfaceDevelopment.aspx">Microsoft Surface Development</a>, has worked on other cool tools like the Coding4Fun <a href="http://blogs.msdn.com/b/coding4fun/archive/2010/06/13/my_2D00_microsoft_2D00_teched_2D00_talk.aspx">Windows Phone 7 T-Shirt Cannon</a> and the <a href="http://tweetcraft.codeplex.com/">Tweetcraft WOW Twitter client</a>.</p> <img src="http://m.webtrends.com/dcs1wotjh10000w0irc493s0e_6x1g/njs.gif?dcssip=channel9.msdn.com&dcsuri=http://channel9.msdn.com/Niners/c4f.352-Media/Posts/RSS&WT.dl=0&WT.entryid=Entry:RSSView:1525331441314f0483899e7600c8a8e3">]]></description>
      <comments>http://channel9.msdn.com/coding4fun/articles/Building-the-Windows-Experience-Index-Share-Site--WEIsharenet</comments>
      <itunes:summary> By now you&#39;ve probably seen Larry&#39;s video in which he explores the WEI Share (“We” share) project and what it does. Now we&#39;re going to show you what went in to creating it, from building the desktop portion to grab the score to compiling the data to setting it up on Azure.  Creating the Silverlight App and Web Service – Peter B.We originally set out to create a Silverlight Application that would display uploaded Windows Experience Index (WEI) Scores via a Web Service and Desktop Application. At the time, we created the application in Silverlight 3 and used a WCF Service to integrate with not only the desktop application but also the Silverlight application. Since we weren&#39;t sure exactly where the WCF Service was being hosted in relation to the Web Site, one of the things we did was make it so the location of the WCF Service can be fairly easily changed. We ended up going with Silverlight Parameters to pass in the location of the WCF Service. Doing this was fairly easy, but it took some set up. The first step involved modifying App.xaml.cs to the following: 
private void Application_Startup(object sender, StartupEventArgs e)
{
    //Insert InitParams into Global Resources
    foreach (string key in e.InitParams.Keys)
    {
        this.Resources.Add(key, e.InitParams[key]);
    }
    this.RootVisual = new MainPage();
} Once this was done, we then had to modify the code behind for the main Silverlight app in MainPage.xaml.cs, like so: public MainPage()
{
    InitializeComponent();    if (App.Current.Resources.Contains(&amp;quot;WCFServiceLocation&amp;quot;)
        &amp;amp;&amp;amp; !String.IsNullOrEmpty(App.Current.Resources[&amp;quot;WCFServiceLocation&amp;quot;] as string))
    {
        EndpointAddress endpointAddress = new EndpointAddress(            App.Current.Resources[&amp;quot;WCFServiceLocation&amp;quot;].ToString());
        serviceClient = new WindowsExperienceServiceClient(            &amp;quot;CustomBinding_IWindowsExperienceService&amp;quot;, endpointAddress);
    }
    el</itunes:summary>
      <link>http://channel9.msdn.com/coding4fun/articles/Building-the-Windows-Experience-Index-Share-Site--WEIsharenet</link>
      <pubDate>Mon, 30 Aug 2010 21:52:13 GMT</pubDate>
      <guid isPermaLink="false">http://channel9.msdn.com/coding4fun/articles/Building-the-Windows-Experience-Index-Share-Site--WEIsharenet</guid>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/10056062_100.jpg" height="75" width="100"></media:thumbnail>
      <media:thumbnail url="http://ecn.channel9.msdn.com/o9/c4f/images/10056062_220.jpg" height="165" width="220"></media:thumbnail>      
      <dc:creator>352 Media</dc:creator>
      <itunes:author>352 Media</itunes:author>
      <slash:comments>0</slash:comments>
      <wfw:commentRss>http://channel9.msdn.com/coding4fun/articles/Building-the-Windows-Experience-Index-Share-Site--WEIsharenet/RSS</wfw:commentRss>
    </item>    
</channel>
</rss>