Udostępnij za pośrednictwem


Seven Segment Countdown Timer

Sometimes the inspiration for funny little applications induces as much laughter as the application itself. Although, in my experience, often these inspirations seem ridiculous to the point that I never sit down to turn inspiration into implementation. Yesterday I experienced one of these moments and actually forced myself to sit down and author the attached application.

As you may know, the final release date of the WCF product approaches. Each morning we have a cross feature team meeting to track progress against a couple of upcoming dates. Until this morning, these meetings opened with an unsent email on the screen giving the number of days left until these dates. Yesterday, some rich formatting was added (read bold text) with a joke that the next day would add color. I jokingly asked when would someone write a web page with a count down timer. Laughter ensued, but my brain refused to let the idea go. Boom – inspiration.

That afternoon, I put aside 30 minutes and wrote the attached .NET 2.0 WinForms application in C# that emulates seven segment display count down timers. At first, I hard coded the two dates important to the WCF product. However, that quickly became too restrictive as my wife asked me to add an additional date important to us. This led to adding functionality to add and remove additional timers. To keep it simple, I decided to persist the timers in the application’s AppSettings section of the app.config file.

I do not write many WinForm applications, but each time I do I find myself pleasantly surprised with how easy .NET makes the process. My new favorite control: FlowLayoutPanel. Combined with Form.AutoSize = true, and AutoSizeMode = GrowAndShrink, this control makes dynamic control content (in my case, number of countdown timers) super simple.

I almost forgot how much I enjoy writing small, fun applications. An unfortunate, potentially not uncommon, side affect of writing software professionally. Hopefully my experience with this little app reminds me to take some time each week to work on some personal project just for fun. If you have not written a small application (less than 100 lines of code, not counting auto generated lines) recently, I highly recommend it. Along with helping to keep your skills sharp, it reminds us why we do this professionally in the first place.

Mark Gabarra

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm

 

SevenSegmentCounter.zip

Comments

  • Anonymous
    February 01, 2007
    i need for project electronic thanks

  • Anonymous
    May 04, 2008
    can you make the source code available?

  • Anonymous
    June 13, 2008
    Unfortunately the source code was lost shortly after posting it up here.  I have been meaning to try and rebuild the application from scratch but have not found the time.  If I do rebuild it I will definitely look at uploading the source code the next time around.  Who knows, maybe this time I will build it on top of the Windows Presentation Foundation.  :)