Help with Logic

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

Help with Logic

 
0
  #1
Jan 2nd, 2009
I need my program to "stop" as the timer is running and when the timer returns true i need it to continue what it was doing.

Sleep:

  1. void iUpdateStatus()
  2. {
  3. bComplete = true;
  4. //IDC_Status.Text = IDC_Status.Text + "\r\n" + DateTime.Now.ToString();
  5. }
  6.  
  7. bool sSleep()
  8. {
  9. System.Timers.Timer myTimer = new System.Timers.Timer();
  10. myTimer.Elapsed += new ElapsedEventHandler(DisplayTimeEvent);
  11. myTimer.Interval = 15000;
  12. myTimer.Start();
  13. if (bComplete)
  14. {
  15. bComplete = false;
  16. myTimer.Stop();
  17. return true;
  18. }
  19. return false;
  20. }
  21.  
  22. void DisplayTimeEvent(object source, ElapsedEventArgs e)
  23. {
  24. if(IDC_Status.InvokeRequired)
  25. {
  26. IDC_Status.Invoke(new MethodInvoker(iUpdateStatus));
  27. }
  28. }

example of the posting

  1. LoadText(Zone);
  2. PostTopic(3, "[RS.com] Zone Alarm Keygen", Post);
  3. //Sleep Here once timer has completed go to next lot
  4.  
  5. LoadText(Adobe);
  6. PostTopic(3, "[RS.com] All Adobe Keygens", Post);
  7. //Sleep Here once timer has completed go to next lot
  8.  
  9. LoadText(Alcohol);
  10. PostTopic(3, "[RS.com] Alcohol 120% v1.9", Post);
  11. //Sleep Here once timer has completed go to next lot
  12.  
  13. LoadText(CleanMyPC);
  14. PostTopic(3, "[RS.com] CleanMyPC", Post);
  15. //Sleep Here once timer has completed go to next lot
  16.  
  17. LoadText(DVDFab);
  18. PostTopic(3, "[RS.com] DVDFab 5.1 Final", Post);
  19. //Sleep Here once timer has completed go to next lot
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 49
Reputation: iDeveloper is an unknown quantity at this point 
Solved Threads: 7
iDeveloper iDeveloper is offline Offline
Light Poster

Re: Help with Logic

 
0
  #2
Jan 2nd, 2009
Simply put your current thread in sleep mode. Fairly easy to do with 1 line of code.

  1. System.Threading.Thread.Sleep(int milliseconds);
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

Re: Help with Logic

 
0
  #3
Jan 3rd, 2009
Originally Posted by iDeveloper View Post
Simply put your current thread in sleep mode. Fairly easy to do with 1 line of code.

  1. System.Threading.Thread.Sleep(int milliseconds);
i dont want to pause the main thread.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,914
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 274
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: Help with Logic

 
0
  #4
Jan 3rd, 2009
Originally Posted by FTProtocol
I need my program to "stop" as the timer is running
imho that is what you asked and iDeveloper gave you a correct answer.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Help with Logic

 
0
  #5
Jan 3rd, 2009
If you have something that needs to pause and continue you shouldnt be using the mainthread for it. Thats what threads were invented for.
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC