September 23, 2013

Using the Windows 7 shell Taskbar Item to show that a WPF application is busy/idle

Add the following to the Main window XAML:
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo />
    </Window.TaskbarItemInfo>
In code: To make the task bar icon pulse green to show that it is busy but when the application cannot determine how far through the proceesing the app is:
this.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Indeterminate;
To stop the task bar icon pulsating green/return it to normal:
this.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
To show progress through the task bar icon:
this.TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Normal;
// ProgressValue must be a value between 0.0 and 1.0
this.TaskbarItemInfo.ProgressValue = progressPercentage/100.0d; 

No comments: