Click here to Skip to main content
15,908,111 members
Home / Discussions / C#
   

C#

 
QuestionCheck if x minutes has passed Pin
Kristian Sixhøj25-Nov-07 4:27
Kristian Sixhøj25-Nov-07 4:27 
AnswerRe: Check if x minutes has passed [modified] Pin
Ravi Bhavnani25-Nov-07 5:09
professionalRavi Bhavnani25-Nov-07 5:09 
GeneralRe: Check if x minutes has passed Pin
Kristian Sixhøj25-Nov-07 5:20
Kristian Sixhøj25-Nov-07 5:20 
GeneralRe: Check if x minutes has passed Pin
Paul Conrad25-Nov-07 6:56
professionalPaul Conrad25-Nov-07 6:56 
GeneralRe: Check if x minutes has passed Pin
Anthony Mushrow25-Nov-07 7:02
professionalAnthony Mushrow25-Nov-07 7:02 
AnswerRe: Check if x minutes has passed Pin
Ravi Bhavnani25-Nov-07 7:02
professionalRavi Bhavnani25-Nov-07 7:02 
GeneralRe: Check if x minutes has passed Pin
Kristian Sixhøj25-Nov-07 7:12
Kristian Sixhøj25-Nov-07 7:12 
AnswerRe: Check if x minutes has passed Pin
Ravi Bhavnani25-Nov-07 7:20
professionalRavi Bhavnani25-Nov-07 7:20 
Kristian Sixhoej wrote:
In fact, I *did* spot the error and corrected it.

OK. That wasn't evident from your post.

Kristian Sixhoej wrote:
The name 'lastTimeCommandWasUsed' does not exist in the current context.

You may want to encapsulate the check for elapsed time in a class (eg: ElapsedTimeChecker) that has (a) a static member lastTimeCommandWasUsed (static preserves its value across calls) and (b) a public static method CheckIfXMinutesElapsed() as shown earlier. Then just call that method when you're about to perform the code you want to execute every 3 minutes, by doing this:
if (ElapsedTimeChecker.CheckIfXMinutesHaveElapsed (3))
   doSomething();
else
   sorryYouMustWaitAtLeastThreeMinutes();
/ravi

This is your brain on Celcius
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com

GeneralRe: Check if x minutes has passed Pin
Kristian Sixhøj25-Nov-07 7:24
Kristian Sixhøj25-Nov-07 7:24 
GeneralRe: Check if x minutes has passed Pin
Kristian Sixhøj25-Nov-07 7:48
Kristian Sixhøj25-Nov-07 7:48 
GeneralRe: Check if x minutes has passed Pin
Ravi Bhavnani25-Nov-07 7:50
professionalRavi Bhavnani25-Nov-07 7:50 
QuestionMore DirectSound Pin
MasterSharp25-Nov-07 4:14
MasterSharp25-Nov-07 4:14 
AnswerRe: More DirectSound Pin
martin_hughes25-Nov-07 4:35
martin_hughes25-Nov-07 4:35 
GeneralRe: More DirectSound [modified] Pin
MasterSharp25-Nov-07 5:23
MasterSharp25-Nov-07 5:23 
QuestionLock a directory Pin
mahdiehIR25-Nov-07 3:47
mahdiehIR25-Nov-07 3:47 
AnswerRe: Lock a directory Pin
Guffa25-Nov-07 3:52
Guffa25-Nov-07 3:52 
GeneralRe: Lock a directory Pin
Paul Conrad25-Nov-07 11:09
professionalPaul Conrad25-Nov-07 11:09 
JokeRe: Lock a directory Pin
mav.northwind25-Nov-07 20:22
mav.northwind25-Nov-07 20:22 
QuestionSystem.Window.Forms.LinkView TO System.Window.Forms.Listbox Pin
sweet corn25-Nov-07 3:24
sweet corn25-Nov-07 3:24 
AnswerRe: System.Window.Forms.LinkView TO System.Window.Forms.Listbox Pin
Ravi Bhavnani25-Nov-07 5:10
professionalRavi Bhavnani25-Nov-07 5:10 
GeneralRe: System.Window.Forms.LinkView TO System.Window.Forms.Listbox Pin
sweet corn29-Nov-07 4:44
sweet corn29-Nov-07 4:44 
QuestionGET URL from Firefox Pin
kepp25-Nov-07 3:20
kepp25-Nov-07 3:20 
QuestionTimer question - Help needed... Pin
AdiIdolized25-Nov-07 2:49
AdiIdolized25-Nov-07 2:49 
AnswerRe: Timer question - Help needed... Pin
Luc Pattyn25-Nov-07 3:05
sitebuilderLuc Pattyn25-Nov-07 3:05 
GeneralRe: Timer question - Help needed... Pin
AdiIdolized25-Nov-07 5:34
AdiIdolized25-Nov-07 5:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.