Turbocharge Vista Sidebar Gadget Development with PowerGadgets

or IT professionals dealing with multiple, complex applications and systems, monitoring has always had a magical appeal: You flip on the monitoring software, put your feet up on the desk, and wait for the alarms to sound. With the flip of a switch, you can assure your boss that all systems are running as expected.

PowerGadgets offers to help with that?though it’s a little more complex than flipping one switch. Targeting non-coding IT professionals, PowerGadgets wraps disparate and complex data with a powerful charting API, making it easy to represent data visually, on the desktop. You can use any SQL Server query, Web service, or Windows PowerShell object as the basis for rendering intuitive charts, maps, and gauges.

A Five-minute Gadget Walkthrough
To put PowerGadgets through a few paces, I’ve created a quick gadget that shows status information from a defect-tracking system. This saves me from having to log into the defect-tracking system and gives me a nice gestalt to indicate project status. I’ve relied directly on SQL Server as a data source, because it stores all the data from our defect tracking system. I used the PowerGadgets Creator application that installs with PowerGadgets to build the gadget.

A wizard walked me through the gadget-creation process, which consists of selecting the output type, selecting the data source, and customizing the chart. I had to write one SQL query to retrieve the data?but in less than three minutes, I was designing my gadget’s user interface (see Figure 1).

 
Figure 1. PowerGadgets Creator: The figure shows the Gadget Designer in action.
 
Figure 2. Vista Sidebar with Custom Gadget: The figure shows the finished gadget running in the Vista Sidebar.

After completing the design, I elected to have the output on the desktop. The output can refresh at a selectable interval?I set the update interval to five minutes. Finally, I saved the design, resulting in a PowerGadget (.pgf) file. I added my new PowerGadget from the Windows Vista sidebar, which prompts me to select the .pgf file generated by the Gadget Creator and give the gadget a name. That’s it. You can see the finished sidebar PowerGadget in Figure 2.

PowerGadgets designers intelligently included some nice run-time functionality, including a mouse-over event that provides drill-down detail on the gadget’s data (see Figure 3). Much more of that runtime functionality becomes available when you add the toolbar at design-time as shown in Figure 4.

 
Figure 3. Drilldown: When users mouse over a bar on the graph, PowerGadget provides a drill-down data callout using the Gadget Details feature.
 
Figure 4. Expanding Gadgets: Users aren’t limited to the small version in the sidebar. The figure shows the custom PowerGadget expanded onto the desktop.

Peeking Under the Covers
You might expect that with a name like PowerGadgets this product would be limited to Windows Vista and its sidebar, but it’s not. As you’ve seen, PowerGadgets does let you build true gadgets easily for Vista’s sidebar, but it also functions quite nicely on Windows XP and 2003, rendering the charts, gauges, and maps on the desktop. That’s because, under the covers, PowerGadgets uses a GDI+ based .NET library. From the assembly names, it seems probable that PowerGadgets has OEM’ed the popular ChartFX engine, taking advantage of the power of its graphing library and putting the results on the desktop. This has the fortunate side effect of immediately making anyone familiar with using graphing control libraries in Visual Studio .NET comfortable with PowerGadgets Creator.

PowerGadgets and the Windows PowerShell
While the charts and gauges on the desktop are impressive for their convenience, design-time options, and data integration, they are not revolutionary. With the exception of the cool and intelligent Vista sidebar integration, you can generate equivalent charts and gauges with minimal coding using a charting library and standard data sources. But PowerGadgets breaks some ground with its tight integration with the new Windows PowerShell as a data source.

Windows PowerShell is a large topic, but suffice it to say that it is an object-based scripting language that has the full power of WMI, COM, .NET, plus its own script commands or Cmdlets (pronounced “Commandlets”) at its disposal. As a one-line movie pitch, PowerShell would be “object-oriented programming meets the UNIX shell.”

Again, PowerShell is not Vista-dependent and plays nicely with earlier Windows operating systems. In fact, it didn’t ship with the first release of Vista, although it should ship with the consumer version at the end of January 2007. So, if you are running an earlier version of Vista, PowerGadgets cannot leverage PowerShell.

Using PowerShell as a base, PowerGadgets provides its own set of Cmdlets that control chart and gauge rendering. Essentially, users are (ala UNIX) piping PowerShell objects to a PowerGadget Cmdlet, which formats the results nicely and presents them on the desktop. The real power of PowerGadgets is in its tight integration with the PowerShell itself. PowerGadgets, in fact, provides its own command-line shell that integrates its Cmdlets with PowerShell.

 
Figure 5. Figure 5. Memory Usage Monitor Created from the PowerGadgets Command Shell: Users can customize the scripts provided with PowerGadget.

After starting the Windows PowerShell with PowerGadgets, you can pipe any command via the ‘|’ operator to a chart, gauge or map, and specify refresh rates so that the data is harvested in near-real-time. In the example below, the PowerShell invokes a WMI object, pulls the FreePhysicalMemory from that object, and then redirects the raw data to a PowerGadget gauge refreshing every 5 seconds.

get-wmiobject Win32_OperatingSystem | select    FreePhysicalMemory | out-gauge -refresh 0:0:5

Figure 5 shows the results on the desktop.

Without purchasing a canned performance monitoring application, PowerGadgets is undoubtedly the fastest and most elegant way to visualize application and system data on the desktop. The strength of PowerGadgets comes from its relative simplicity?it combines a visually appealing graphing library capable of visually rendering virtually any type of data with a new data source?Windows PowerShell.

Despite the simplicity of building the demo project in this article, I worry a little that the marketing appeal to non-coding IT professionals may overstate the plug-and-play nature of the product somewhat. Early adopters will have to rely on an as yet immature public domain supply of PowerShell scripts and the PowerGadget samples or delve into PowerShell scripting?and PowerShell scripting is a full-blown programming topic that may frustrate users who are expecting full out-of-the-box monitoring capabilities on the desktop.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS