0

I just want to know why TimerTick event handler is handled by the UI Thread and the DataReceived Event is handled by a worker thread. I thought they both are an event and handled by the UI thread. I tried Thread.Sleep(5000) when Data received event handler method is handled but the UI thread and form controls didn't freeze, yet when I tried the same inside timertick event handler, it blocks the UI thread and form control objects.

Is there a way to make timertick event work just like datareceived event (in a separate thread)?

Burak
  • 1
  • 1
  • Use `System.Threading.Timer` instead of `System.Windows.Forms.Timer` – Kevin Gosse May 12 '18 at 12:32
  • It didn't accept it but it accepted the System.Timers.Timer .. It also works just like I expect but a Thread.Sleep() inside this new timer elapsed handler seems not working . It's like this event is fired in a new thread if the last one isn't done within Timer.Interval value .. Is there a solution for that too ? – Burak May 12 '18 at 18:42

0 Answers0