Microsoft® Windows® 7 gives users dozens of distinctive new features that make the UI more intuitive to use. As with any new OS release, a number of questions come up for developers, like which of these features are the most important? Which are part of the OS UI and what can I integrate into my app? What is the cost/benefit of implementing the new features and where can I get the biggest payoff for my efforts?
Any "best of" list is subjective by nature. That said, certain Windows 7 features stand out for two reasons: they can be integrated into third party apps via the Windows 7 SDK, and they give apps that extra polish that excites users and give the apps a competitive edge. Some of the strongest such features, known collectively as "Windows 7 Light Up" features, include:
Jump Lists
Task Bar menus, like Start menus for each application, that give users access to tasks and documents related to that app.
Libraries
New folder and document containers that organize content across local or networked file structures, allowing faster access, indexing, and searching capabilities to collections such as Pictures, Music, or user-generated topics.
Windows 7 Ribbon
The Office Ribbon UI, now available as part of the Windows 7 SDK for any third party app.
Federated Search
New open standards allowing for searches of documents and data across third party apps over networks.
Device Enhancements
Device-specific features like Multitouch, Location Awareness, and "Device Stage", a device and app management hub.
As to what constitutes the lowest hanging of these fruits, two features in particular seem especially ripe: Jump Lists and Library integration. Managed code versions of these two features will be covered here using the Windows API Code Pack available from MSDN.
Note: While all of these Windows 7 features can be implemented using the Windows 7 SDK and unmanaged code, the Windows API Code Pack gives .NET® developers the framework for implementing most of these features in managed code, as well. One, however, is not included in the Code Pack. Developers who want to reach a little further up the tree will want to explore Windows 7 Ribbon. Though you won't find it in the Code Pack, thanks to CodePlex you still have a managed code alternative called Windows Ribbons for WinForms. Once you build this solution and install the resulting msi output, you'll have a Ribbon control for your Windows Forms, as well as 19 sample projects covering bits like Combo Boxes, Images, Tab Groups, and other UI elements. At press time, this solution is not compatible with Express editions of Visual Studio® due to its use of vdproj files and other issues, so you'll need at least a Standard Edition of Visual Studio to compile it.
But new features aren't the only reason for developers to light up over Windows 7. Microsoft has also released a new development, testing, and marketing tool for partners called Microsoft Platform Ready. Regardless of your chosen platform, partners now have a streamlined certification process with fast (and free!) new testing tools that help you get your product to market faster than ever. This app management hub includes development and testing tools for:
- Windows 7
- Windows Server® 2008
- Windows Azure®
- Windows Phone 7
- SQL Server® 2008
- SharePoint® 2010
- Microsoft Office® 2010
- Microsoft Dynamics® CRM 2010
- Exchange Server® 2010
More on this later. But first, a short walkthrough on lighting up your app.
Prepare to Light Up
Before sampling what your app can look like in Windows 7, you'll need to have the following installed:
You may also want to download the code sample for this article.
Jump Lists
Windows 7 offers a huge amount of new shell functionality, a lot of it focused on the Task Bar. Of all the things the Task Bar does now, one of the first you'll notice is the Jump List. When an application is running and is visible in the Task Bar, right-clicking it will give you a list of options: common or recent documents, links to web sites, common or important tasks within the app, even a list of external apps that can be launched with one click. Essentially, whatever you the developer think is important, your users will be able to access from the Task Bar. And since one of the default options is to pin your app to the Task Bar directly, these documents and tasks can be accessed whether or not the app is actually running.
To set up a sample Jump List, open up Visual C# 2010 Express and start a new Windows Forms Application project. Name the solution "LightUpDemo" and when you get to the form, name it "frmLightUpDemo".
- Add the API Code Pack libraries to the Resources for the project by browsing to \binaries\Microsoft.WindowsAPICodePack.dll and \binaries\Microsoft.WindowsAPICodePack.Shell.dll.
- Add a button to the form and name it "btnClickMe". Change its text to "Click Me".
- Double-click the button in the Designer to create the Click handler and get to the code-behind.
- Add references to the TaskBar and Shell libraries by adding the following "using" statements to the directives for the app:
using Microsoft.WindowsAPICodePack.Taskbar;
using Microsoft.WindowsAPICodePack.Shell;
- Add the following to the form constructor:
private JumpList jumpList;
private JumpListCustomCategory jumpCat;
By default, a Jump List includes 3 options: vshost32.exe, Pin this program to taskbar, and Close window. While you can add new options directly to the Jump List, you can help usability by organizing them into custom categories that appear above these defaults.
- Add a new event handler to the frmLightUpDemo() initialization method:
this.Shown += new EventHandler(frmLightUpDemo_Shown);
Changes to the Jump List can only take place on an active window, which means the form must be showing, not just loading. So instead of adding your functionality to the frmLightUpDemo_Load method, you'll create a handler for the Shown event.
- Add a new method:
private void frmLightUpDemo_Shown(object sender, EventArgs e)
{
jumpList = JumpList.CreateJumpList();
jumpCat = new JumpListCustomCategory("Resources");
jumpCat.AddJumpListItems(new JumpListLink("http://www.devx.com", "DevX"));
jumpCat.AddJumpListItems(new JumpListLink("http://www.internet.com", "internet.com"));
jumpCat.AddJumpListItems(new JumpListLink("http://www.microsoft.com", "Microsoft"));
jumpList.AddCustomCategories(jumpCat);
jumpList.Refresh();
}
You've got several things going on here. First, in order to use the Jump List, you have to create it. Next, you're creating a new category called "Resources" and adding three URLs to that category before adding the whole thing to the Jump List. This is but one of the many things you can add to a Jump List to make it more useful. Last, when adding new items dynamically like this, you'll need to Refresh the list.
- At this point, you have a custom Jump List for your app. But in order to observe a dynamic change, add the following to your btnClickMe_Click method.
jumpCat = new JumpListCustomCategory("Utilities");
string SysPath =
System.IO.Path.Combine(Environment.GetFolderPath
(Environment.SpecialFolder.System), "notepad.exe");
JumpListLink jumpLink = new JumpListLink(SysPath, "Notepad.exe");
jumpLink.IconReference = new IconReference(SysPath, 0);
jumpCat.AddJumpListItems(jumpLink);
jumpList.AddCustomCategories(jumpCat);
jumpList.Refresh();
MessageBox.Show("New category added.");
You can add other applications to your Jump List, including system apps, custom apps, or even child apps of the current window. Here you're adding a link to Notepad, then assigning it the default icon. Again, you're creating a new category called "Utilities" and adding that to your Jump List before refreshing.
All total, your code should look something like this:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsAPICodePack.Taskbar;
using Microsoft.WindowsAPICodePack.Shell;
namespace LightUpDemo
{
public partial class frmLightUpDemo : Form
{
private JumpList jumpList;
private JumpListCustomCategory jumpCat;
public frmLightUpDemo()
{
InitializeComponent();
this.Shown += new EventHandler(frmLightUpDemo_Shown);
}
private void frmLightUpDemo_Load(object sender, EventArgs e)
{
}
private void frmLightUpDemo_Shown(object sender, EventArgs e)
{
jumpList = JumpList.CreateJumpList();
jumpCat = new JumpListCustomCategory("Resources");
jumpCat.AddJumpListItems(new JumpListLink("http://www.devx.com", "DevX"));
jumpCat.AddJumpListItems(new JumpListLink("http://www.internet.com", "internet.com"));
jumpCat.AddJumpListItems(new JumpListLink("http://www.microsoft.com", "Microsoft"));
jumpList.AddCustomCategories(jumpCat);
jumpList.Refresh();
}
private void btnClickMe_Click(object sender, EventArgs e)
{
jumpCat = new JumpListCustomCategory("Utilities");
string SysPath = System.IO.Path.Combine(Environment.GetFolderPath
(Environment.SpecialFolder.System), "notepad.exe");
JumpListLink jumpLink = new JumpListLink(SysPath, "Notepad.exe");
jumpLink.IconReference = new IconReference(SysPath, 0);
jumpCat.AddJumpListItems(jumpLink);
jumpList.AddCustomCategories(jumpCat);
jumpList.Refresh();
MessageBox.Show("New category added.");
}
}
}
Run it and see how it looks.
If you right-click on the application on the taskbar, you should see a Jump List that looks like this:
 | |
| Figure 1. Jump List |
Click your big Click Me button and then right-click on the app again. You should see something like Figure 2:
 | |
| Figure 2. More detailed Jump List |