• Welcome to the Speedsolving.com, home of the web's largest puzzle community!
    You are currently viewing our forum as a guest which gives you limited access to join discussions and access our other features.

    Registration is fast, simple and absolutely free so please, join our community of 40,000+ people from around the world today!

    If you are already a member, simply login to hide this message and begin participating in the community!

.net code for a timer?

Zarxrax

Member
Joined
Jan 7, 2009
Messages
1,282
Location
North Carolina
I was wondering if anyone has implemented a timer in .net and has some code that they could share?
I've done it, but my implementation seemed to have a lot of lag and it felt like it wasn't very accurate.
I will possibly be writing a PLL training app similar to badmephisto's, but I need to get the timer part figured out before anything else.
 

Zarxrax

Member
Joined
Jan 7, 2009
Messages
1,282
Location
North Carolina
C#.
They all use the same framework though, so if its written in any of the supported languages I could probably figure out how to port it to c#.
 

masterofthebass

Premium Member
Joined
May 13, 2007
Messages
3,923
Location
Denver, CO
WCA
2007COHE01
YouTube
Visit Channel
just because the microsoft compilers compile it to language the framework can understand does not mean the languages are similar. VB code is going to be quite different from C# code for the same tasks.

anyway, check the System.DateTime class. It has what you need. For a good idea of what to do for a timer, look through the qqTimer code to understand what's going on.
 

radmin

Member
Joined
Feb 25, 2010
Messages
401
Location
Columbus, Ohio
WCA
2010HARD02
I think it would be pretty cool to make it in silverlight. Then it could port to several app types including windows phone.

But yea, saying .Net isn't very descriptive. The framework can be used for a variety of application types.
 

Zarxrax

Member
Joined
Jan 7, 2009
Messages
1,282
Location
North Carolina
I don't remember exactly, I can check tomorrow though. .Net provides thousands of different functions though, and there are several which are designed for "timing" something. With so many options, its almost impossible to know which ones are most appropriate, sometimes.
 

Zarxrax

Member
Joined
Jan 7, 2009
Messages
1,282
Location
North Carolina
Actually, it seems I was using a Timer and a Stopwatch.

In any case, that implementation turned out feeling very laggy, so I didn't like it much.

System.DateTime feels much more accurate, and it let me write the timer with MUCH fewer lines of code.
However, I'm now stuck at figuring out how to get it to display the elapsed time while the timer is running.
 

Carson

Premium Member
Joined
Feb 1, 2008
Messages
1,285
Location
Somerset, Kentucky, United States
WCA
2008PENT01
I wrote the WinMo timer in C#. I would be more than happy to share the code with you. It certainly is not "optimized" but it is very functional. The .net compact framework is more restrictive however, so you have many more options available than I did. My only real option was comparing tickcounts.
 

AvGalen

Premium Member
Joined
Jul 6, 2006
Messages
6,857
Location
Rotterdam (actually Capelle aan den IJssel), the N
WCA
2006GALE01
YouTube
Visit Channel
Silverlight is cool because it's portable? You're funny!

Silverlight isn't the best option for portability across operating systems or devices, I agree.

But when the TS is already developing in .NET, Silverlight isn't a bad option for this purpose at all. It CAN run on Windows, Mac and Linux as local apps, browser apps or server apps. and it runs on some other devices (like some phones) as well. Not "write once, run everywhere" but not "1 version of 1 OS on pc only" either.

The framework, development tools and languages that can be used with Silverlight are very good and there are free versions available. Installed base for the runtime is small though. Basically Silverlight is great for developers, not so great on the end-users point (yet?)
 

Zarxrax

Member
Joined
Jan 7, 2009
Messages
1,282
Location
North Carolina
Well, I've got everything finished now except, um... displaying the data.
I was planning to use a listview, but then I found out that you cant really edit the items... so that doesn't work.

I wanna display about 4 different times for each PLL, and not really sure which form controls would be best for this. I'm not really fond of doing 100+ labels.
 
Top