Everytime I switch something on my form, I restart my thread by doing (to call whatever was switched):
Retriever.Dispose();
Retriever = new System.Threading.Timer(CallPictureBoxRetriever, null, 0, 300000);
The problem is that this is yet creating another thread and closing the previous!
I am asking how can I call CallPictureBoxRetriever(Object state)
on the same thread created so therefore I do not have to always dispose/recreate a thread; rather have 1 thread.
Just reset the timer:
Retriever.Change(0, 300000); // reset to 300 seconds
First argument is dueTime:
Specify zero (0) to restart the timer immediately.
Second is period:
The time interval between invocations of the callback method specified when the Timer was constructed, in milliseconds. Specify Timeout.Infinite to disable periodic signaling.
Full docs here
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments