Click here to Skip to main content
15,916,371 members
Home / Discussions / C#
   

C#

 
AnswerRe: The form refresh so slow Pin
dan!sh 15-Mar-10 20:25
professional dan!sh 15-Mar-10 20:25 
GeneralRe: The form refresh so slow Pin
Fired.Fish.Gmail15-Mar-10 21:57
Fired.Fish.Gmail15-Mar-10 21:57 
GeneralRe: The form refresh so slow Pin
The Man from U.N.C.L.E.15-Mar-10 23:36
The Man from U.N.C.L.E.15-Mar-10 23:36 
GeneralRe: The form refresh so slow Pin
Fired.Fish.Gmail16-Mar-10 5:44
Fired.Fish.Gmail16-Mar-10 5:44 
GeneralRe: The form refresh so slow Pin
dan!sh 16-Mar-10 0:39
professional dan!sh 16-Mar-10 0:39 
GeneralRe: The form refresh so slow Pin
Fired.Fish.Gmail16-Mar-10 5:50
Fired.Fish.Gmail16-Mar-10 5:50 
QuestionHow to forbid start of the second copy of the program in .net? Pin
arsendem15-Mar-10 19:37
arsendem15-Mar-10 19:37 
AnswerRe: How to forbid start of the second copy of the program in .net? Pin
dan!sh 15-Mar-10 19:42
professional dan!sh 15-Mar-10 19:42 
AnswerRe: How to forbid start of the second copy of the program in .net? Pin
arsendem15-Mar-10 20:07
arsendem15-Mar-10 20:07 
AnswerRe: How to forbid start of the second copy of the program in .net? Pin
Wes Aday16-Mar-10 4:09
professionalWes Aday16-Mar-10 4:09 
Questionwhen does the assembly.exe.config file is created Pin
prasadbuddhika15-Mar-10 18:23
prasadbuddhika15-Mar-10 18:23 
AnswerRe: when does the assembly.exe.config file is created Pin
dan!sh 15-Mar-10 18:54
professional dan!sh 15-Mar-10 18:54 
AnswerRe: when does the assembly.exe.config file is created Pin
ramzg15-Mar-10 19:19
ramzg15-Mar-10 19:19 
QuestionVideo Overlay Pin
abalbo15-Mar-10 14:11
abalbo15-Mar-10 14:11 
AnswerRe: Video Overlay Pin
Super Lloyd15-Mar-10 17:37
Super Lloyd15-Mar-10 17:37 
QuestionWPF: how do I write output from methods invoked through an event to a textbox in window1? Pin
Bragee15-Mar-10 12:57
Bragee15-Mar-10 12:57 
AnswerRe: WPF: how do I write output from methods invoked through an event to a textbox in window1? Pin
Not Active15-Mar-10 14:12
mentorNot Active15-Mar-10 14:12 
GeneralRe: WPF: how do I write output from methods invoked through an event to a textbox in window1? Pin
Bragee16-Mar-10 1:16
Bragee16-Mar-10 1:16 
GeneralRe: WPF: how do I write output from methods invoked through an event to a textbox in window1? Pin
Pete O'Hanlon16-Mar-10 2:16
mvePete O'Hanlon16-Mar-10 2:16 
GeneralRe: WPF: how do I write output from methods invoked through an event to a textbox in window1? Pin
Not Active16-Mar-10 2:26
mentorNot Active16-Mar-10 2:26 
Questioncheck if 5 min have passed Pin
Yustme15-Mar-10 12:53
Yustme15-Mar-10 12:53 
AnswerRe: check if 5 min have passed Pin
Luc Pattyn15-Mar-10 13:00
sitebuilderLuc Pattyn15-Mar-10 13:00 
GeneralRe: check if 5 min have passed Pin
Yustme15-Mar-10 13:40
Yustme15-Mar-10 13:40 
GeneralRe: check if 5 min have passed Pin
Luc Pattyn15-Mar-10 13:46
sitebuilderLuc Pattyn15-Mar-10 13:46 
GeneralRe: check if 5 min have passed Pin
Yustme15-Mar-10 13:49
Yustme15-Mar-10 13:49 
I pass 5 min to this function:

DateTime lastTimeCommandWasUsed = DateTime.MaxValue;

		private bool AtLeastXMinutesHavePassed(int xMinutes)
		{
			// Check if "x" minutes have elapsed
			DateTime currentTime = DateTime.Now;
			bool allowUse = false;

			if (lastTimeCommandWasUsed == DateTime.MaxValue) 
			{
					allowUse = true;
			}

			else 
			{
					TimeSpan elapsedTime = currentTime - lastTimeCommandWasUsed;
					allowUse = elapsedTime.TotalMinutes > xMinutes;
			}
		 
			// Return status and keep track of new last used time
			if (allowUse) 
			{
					lastTimeCommandWasUsed = currentTime;
					return true;
			}

			return false;
		}


And it returns very fast 'false'. After debugging it, it seems to check for seconds instead of minutes.

Can't figure out what is going wrong.

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.