Muhammad Al-Baloushi
Muhammad Al-Baloushi

Reputation: 37

Alternative to Timer

I'm developing a c# winform application which is based on third party web API's for trading purpose. It deals with real time data coming from internet like currency rates but I'm using 8 timer in my winform to retrieve different data, application gets non-responding because of timers,

what can i do to make this application work fast and smooth?

Upvotes: 1

Views: 6980

Answers (2)

FishySwede
FishySwede

Reputation: 1583

You might want to look into the System.Threading.Timer instead: Timer Class

System.Threading.Timer, which executes a single callback method on a thread pool thread at regular intervals. The callback method is defined when the timer is instantiated and cannot be changed. Like the System.Timers.Timer class, this class is intended for use as a server-based or service component in a multithreaded environment; it has no user interface and is not visible at runtime.

This link has a nice table of comparison between the different timer classes at the bottom:

Comparing the Timer Classes in the .NET Framework Class Library

Upvotes: 2

Lying Dog
Lying Dog

Reputation: 1524

Use threading. Timers (at least the ones you seem to be using) are executed in the GUI's thread. Use BackgroundWorkers (or other threading methods) instead to decouple background tasks from the GUI.

Upvotes: 0

Related Questions