Click here to Skip to main content
15,887,822 members
Home / Discussions / C#
   

C#

 
GeneralRe: Convert VB code snippet to C# Pin
Mc_Topaz18-Feb-11 3:06
Mc_Topaz18-Feb-11 3:06 
AnswerRe: Convert VB code snippet to C# Pin
Not Active18-Feb-11 2:45
mentorNot Active18-Feb-11 2:45 
AnswerRe: Convert VB code snippet to C# Pin
OriginalGriff18-Feb-11 5:55
mveOriginalGriff18-Feb-11 5:55 
QuestionLoading configuration file Pin
nitin_ion18-Feb-11 1:41
nitin_ion18-Feb-11 1:41 
AnswerRe: Loading configuration file Pin
#realJSOP18-Feb-11 2:52
mve#realJSOP18-Feb-11 2:52 
GeneralRe: Loading configuration file Pin
nitin_ion18-Feb-11 2:54
nitin_ion18-Feb-11 2:54 
QuestionStop all threads in Threading.Timer in Callback method? Pin
xkrja18-Feb-11 0:42
xkrja18-Feb-11 0:42 
AnswerRe: Stop all threads in Threading.Timer in Callback method? Pin
Alan N18-Feb-11 1:52
Alan N18-Feb-11 1:52 
C#
System.Threading.Timer timer;
  private void StartThreadTimer()
  {
    timer = new System.Threading.Timer(TimerCallback, "hepp", 5000, Timeout.Infinite);
  }

  void TimerCallback(object callbackObj)
  {
     Thread.Sleep(1000); 
     if (!success) {
       // restart
       timer.Change(5000, Timeout.Infinite);
     }
  }

I would use a single shot timer and restart it in the callback if the task is not successful. This way the callback can never be reentered and the lock isn't needed.

Alan.
JokeRe: Stop all threads in Threading.Timer in Callback method? Pin
#realJSOP18-Feb-11 2:53
mve#realJSOP18-Feb-11 2:53 
GeneralRe: Stop all threads in Threading.Timer in Callback method? Pin
xkrja18-Feb-11 3:26
xkrja18-Feb-11 3:26 
GeneralRe: Stop all threads in Threading.Timer in Callback method? Pin
#realJSOP18-Feb-11 3:47
mve#realJSOP18-Feb-11 3:47 
Questionhttp webrequest Pin
TAREQ F ABUZUHRI18-Feb-11 0:39
TAREQ F ABUZUHRI18-Feb-11 0:39 
AnswerRe: http webrequest Pin
#realJSOP18-Feb-11 2:55
mve#realJSOP18-Feb-11 2:55 
QuestionError: No value given for one or more required parameters Pin
benams17-Feb-11 23:36
benams17-Feb-11 23:36 
AnswerRe: Error: No value given for one or more required parameters Pin
Wendelius18-Feb-11 0:29
mentorWendelius18-Feb-11 0:29 
GeneralRe: Error: No value given for one or more required parameters Pin
benams18-Feb-11 0:32
benams18-Feb-11 0:32 
AnswerRe: Error: No value given for one or more required parameters Pin
Luc Pattyn18-Feb-11 0:44
sitebuilderLuc Pattyn18-Feb-11 0:44 
AnswerRe: Error: No value given for one or more required parameters Pin
J4amieC18-Feb-11 1:20
J4amieC18-Feb-11 1:20 
QuestionHow can i read utf-8 type from ms-sql 2005? Pin
buffering8317-Feb-11 23:10
buffering8317-Feb-11 23:10 
AnswerRe: How can i read utf-8 type from ms-sql 2005? Pin
jschell18-Feb-11 9:06
jschell18-Feb-11 9:06 
QuestionWeb service authentication using desktop client Pin
ika217-Feb-11 22:25
ika217-Feb-11 22:25 
QuestionHow to perform a validation for Calendar control for checking weather the selected date is less than current date(Today) Pin
Rocky2317-Feb-11 21:32
Rocky2317-Feb-11 21:32 
AnswerRe: How to perform a validation for Calendar control for checking weather the selected date is less than current date(Today) Pin
Richard MacCutchan17-Feb-11 22:13
mveRichard MacCutchan17-Feb-11 22:13 
QuestionI am making outlook add-ins and have question about it. Pin
buffering8317-Feb-11 13:01
buffering8317-Feb-11 13:01 
AnswerRe: I am making outlook add-ins and have question about it. Pin
Mycroft Holmes17-Feb-11 13:17
professionalMycroft Holmes17-Feb-11 13:17 

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.