Hello,
I have partly problems about them correct notation with lambda.
public System.Threading.Timer AsyncProgramChangeTimer = null;
public System.Threading.Timer AsyncProgramChangeTimer2 = null;
public void MyStartTimer()
{
lock (this)
{
AsyncProgramChangeTimer = new System.Threading.Timer((o) =>
{
if (ProgramChangeDone == false)
{
//do whatever
Trace.WriteLine("Timer was coming!!!");
Action<string> DelegateTeste_ModifyText = THREAD_MOD;
Invoke(DelegateTeste_ModifyText, $"Timer was coming!!! {DateTime.Now}");
AsyncProgramChangeTimer.Change(2000, Timeout.Infinite);
}
else
{
Trace.WriteLine("Timer no repeat!!!");
}
}, null, 0, Timeout.Infinite);
}
AsyncProgramChangeTimer2 = new System.Threading.Timer(CallBackTimer, null, 0, Timeout.Infinite);
}
private void CallBackTimer(object state)
{
if (ProgramChangeDone == false)
{
//do whatever
Trace.WriteLine("Timer was coming!!!");
Action<string> DelegateTeste_ModifyText = THREAD_MOD;
Invoke(DelegateTeste_ModifyText, $"Timer was coming!!! {DateTime.Now}");
AsyncProgramChangeTimer.Change(2000, Timeout.Infinite);
}
else
{
Trace.WriteLine("Timer no repeat!!!");
}
}
Is there a trick, a recipe how to get on it. How do you do it? Simply write.
I hope you experts understand what I mean and could help me that I do easier in the future.
Many thanks in advance for the help.