form update too expensive to be executed in Winform.Timer.Tick

Posted by Abruzzo Forte e Gentile on Stack Overflow See other posts from Stack Overflow or by Abruzzo Forte e Gentile
Published on 2010-03-26T09:28:12Z Indexed on 2010/03/26 9:33 UTC
Read the original article Hit count: 416

Filed under:
|

Hi all

I have a WinForm drawing a chart from available data.

I programmed it so that every 1 secong the Winform.Timer.Tick event calls a function that:

  • will dequeue all data available
  • will add new points on the chart

Right now data to be plotted is really huge and it takes a lot of time to be executed so to update my form. Also Winform.Timer.Tick relies on WM_TIMER , so it executes in the same thread of the Form.

Theses 2 things are making my form very UNresponsive.

What can I do to solve this issue?

I thought the following:

  • moving away from usage of Winform.Timer and start using a System.Threading.Timer
  • use the IsInvokeRequired pattern so I will rely on the .NET ThreadPool.

Since I have lots of data, is this a good idea? I have fear that at some point also the ThreadPool will be too long or too big.

Can you give me your suggestion about my issue?

Thank you very much!

AFG

© Stack Overflow or respective owner

Related posts about c#

Related posts about multithreading