TimeSpanPicker released under BSD

by Richard Mason 30. April 2008 17:49

A request via email has encouraged me to release the TimeSpanPicker control I blogged about a few years ago. The details are available at http://www.rikware.com/page/TimeSpanPicker.aspx but I've copied them in here for ease of reading: 

The TimeSpanPicker is a Windows Forms UpDown control for editing TimeSpan values. It is currently used in RikPVR (http://www.rikpvr.com/)

The control is provided, as is, under a BSD license (meaning it's free to use and alter in free or commercial projects). Any improvements will be greatly appreciated.

A Visual Studio 2008 solution (including binaries) containing the project is available here: TimeSpanPicker.zip (11.43 kb)

The project targets .NET 2.0 and should be simple to recompile in Visual Studio 2005.

The control supports input via keyboard, mouse wheel or via the up/down buttons. It is also theme aware.

kick it on DotNetKicks.com

Comments (2) -

4/30/2008 11:26:34 PM #

suhail

Nice work!

suhail

10/17/2008 5:23:11 AM #

Thankyou! Made a small modification to the 'Parse' method to avoid an unnecessary exception being thrown:

int index = Text.IndexOf(' ');
            string timeSpan = (index == -1) ? Text : Text.Substring(0, index);
            Regex timeSpanRegex = new Regex(@"^(?'hours'\d+)Frown?'minutes'\d+)Frown?'seconds'\d+)$");
            if (timeSpanRegex.IsMatch(timeSpan))
            {
                Match match = timeSpanRegex.Matches(timeSpan)[0];
                int hours = int.Parse(match.Groups["hours"].Value);
                int minutes = int.Parse(match.Groups["minutes"].Value);
                int seconds = int.Parse(match.Groups["seconds"].Value);
                userEdit = false;
                return new TimeSpan(hours, minutes, seconds);
            }
            else
            {
                userEdit = false;
                return Value;
            }


www.optimatics.com

Boinst

Comments are closed

About Us

RikWare is a software development company based in Brisbane, Australia. Led by director, Richard Mason, RikWare focusses on solving challenging business problems promptly and effectively.

RikWare is also the owner of Aussie Bushwalking, a free, wiki-like collaboration site for bushwalkers and the creator of RikMigrations, a migration framework for .NET.

Aussie Bushwalking

Want to discover some new bushwalking ideas? Share a few of your own? Aussie Bushwalking is like Wikipedia... but for bushwalkers. Head on over. Anybody can see the walks and it's free to sign up and share your own.

 

RikMigrations

RikMigrations is a database migration library for .NET based on the migrations facility provided by Ruby on Rails. It allows simple upgrading and downgrading of databases using .NET code (such as VB or C#) either from the command line or built into your application. Unlike many other migration frameworks, RikMigrations is a stand-alone library which does not rely on a large surrounding framework.