Yesterday, I wrote about the Windows API Code Pack, and how you can add icon overlay support to your application. Another feature that the API gives you is the ability to add a progress bar to the taskbar. It is similar to icon overlays in that it changes the appearance of your icon, but only slightly. Instead of overlaying something on top of the application icon, it turns the background into a progress bar.
using Microsoft.WindowsAPICodePack.Taskbar;
private void LongRunningProcess()
{
TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal);
for (int i = 0; i < 100; i++)
{
TaskbarManager.Instance.SetProgressValue(i, 99);
Thread.Sleep(100);
}
TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);
}
There is support for other states your application could be in as well.
TaskbarProgressBarState.Indeterminate – puts the progress bar in “marquee” mode
TaskbarProgressBarState.Paused – causes the background to glow yellow
TaskbarProgressBarState.Error – causes the background to glow red
short link to this post:
.net, windows 7
programming, api