Updating Progress in the Windows Taskbar with C#

I’ve been using the Pomodoro Technique to structure my work day for a few years I find it very helpful to plan and focus my work. But it requires a timer. I have used Tomighty and PomoFocus.io, but I wanted something different.

I wanted a way to see the status of the pomodoro at a glance. I decided to try to use the Windows API that allows apps to display their progress in the taskbar to display the progress of a 25 minute pomodoro session.

I wasn’t sure how to update the progress from a Windows Forms app, but then I came across the Microsoft-WindowsAPICodePack Nuget package. It provides two simple methods to manipulate the progress with the taskbar icon.

The first is the SetProgressState, which takes a enum which can be NoProgress, Indeterminate, Normal, Error, or Paused. The normal state puts a green overlay on the icon. I use the Normal state for the first 20 minutes of a pomodro. The Paused state makes the icon yellow, which I use to indicate that the pomodoro has less than 5 minutes remaining. The Error state makes the icon red, which I use to indicate the pomodoro is over.

The second method is SetProgressValue. This takes a current value and a max value and renders the progress bar as an overlay on the icon. I pass the current minute of the pomodoro as the current value and 25 as the max value.

So far, I’ve been pleased with the results. The information is “glancable” without taking up additional real estate on my screen.

If you want to see the code, I’ve posted the repo on GitHub.

June 15, 2021 |
Tags : CSharp

Comments Section

Feel free to comment on the post but keep it clean and on topic.

comments powered by Disqus

About Me

Eric Potter My name is Eric Potter. I have an amazing wife and 5 wonderful children. I am a Microsoft MVP for Developer Tools and Technologies, the Director of Technical Education for Sweetwater in Ft. Wayne Indiana, and an adjunct professor for Indiana Tech. I am a humble toolsmith.

Microsoft MVP Award