I am using this Timer . but this timer not run perfectly.
Example:
DispatcherTimer starting_intervel = new DispatcherTimer();
starting_intervel.Interval = new TimeSpan(0, 0, 0, 0, 1500);
starting_intervel.Tick += mainFunctionrandom;
starting_intervel.Start();
void mainFunctionrandom(object sender, EventArgs e)
{
}
In this timer coming some problem. before 1500 ms run next loop..
Anyone know the better timer compare this.
tell me some idea to do this.
thanks.
The .NET framework has various timers, which exhibit various difference capabilities. The DispatcherTimer yields to the UI thread, so will not reliably tick at the interval you specify. For example, if there is some time-consuming UI code executing, your next tick will be late.
For a great overview of the various timer classes, see the following MSDN article:
Comparing the Timer Classes in the .NET Framework Class Library
Note, DispatcherTimer has the same characteristics as System.Windows.Forms.Timer.