Questions tagged [dispatchertimer]

DispatcherTimer is a .Net class that provides timers that are integrated into the Dispatcher queue which is processed at a specified interval of time and at a specified priority.

216 questions
5
votes
2 answers

Getting Elapsed Time with DispatchTimer to 1 millisecond accuracy

I'm trying to measure the elapsed time in milliseconds between keypress events using a dispatch timer but when declaring a dispatch timer to have an interval of 1 millisecond and then establishing the tick event it doesn't fire every 1 millisecond…
James Santiago
  • 2,883
  • 4
  • 22
  • 29
5
votes
3 answers

DispatcherTimer eating up CPU over time causing WPF visual not rendering properly

I have a WPF app that uses DispatcherTimer to update a clock tick. However, after my application has been running for approx 6 hours the clocks hands angles no longer change. I have verified that the DispatcherTimer is still firing with Debug and…
discorax
  • 1,487
  • 4
  • 24
  • 39
5
votes
1 answer

Async friendly DispatcherTimer wrapper/subclass

I have a DispatcherTimer running in my code that fire every 30 seconds to update system status from the server. The timer fires in the client even if I'm debugging my server code so if I've been debugging for 5 minutes I may end up with a dozen…
Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
4
votes
1 answer

Problem with WPF Application and slow GUI response

I've been analyzing a WPF application which basically fetch data from a server and display the data in the GUI. This code is not mine, and the application has a problem related with slow response from the GUI, I'm trying to find the reason for that…
Vic
  • 2,878
  • 4
  • 36
  • 55
4
votes
4 answers

Dispatcher timer is firing twice :(

i have problems with this timer, my function in the Tick event are appearing twice.. i want it to appear only once.. public void timerStart() { DispatcherTimer updaterTimer = new DispatcherTimer(); …
Braudy
  • 181
  • 1
  • 11
4
votes
1 answer

Why does this rotation animation become choppy?

I have a WPF application where an image keeps rotating and, occasionally, has some kind of animation on it. The rotation keeps running smoothly when the application plays, except during a time when two keyframes hold the same value. For…
Bas
  • 1,946
  • 21
  • 38
4
votes
2 answers

DispatcherTimer doesn't work in Console

I'm curious as to why dispatcher timer doesn't work in console mode. I created a simple alarm that does something when the timer reaches it's limit. Can you use dispatcher timer with UnitTest or in Console mode? DailyAlarm works when I run it in a…
Pat
  • 627
  • 1
  • 9
  • 24
4
votes
2 answers

Why the "Pause" button is not working in this Stopwatch timer? --Windows Phone App Developement

I don't know why this pause button is not working here. Also my stopwatch class doesn't have Restart method so I thought to write it by combining "reset and start". Any other idea? Or any idea about how to make this pause button work? using…
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
4
votes
1 answer

DispatcherTimer not firing in wpf app

I refactored my WPF code recently and now my DispatcherTimer stopped firing. I checked other similar posts here, but they all seemed to be problems with having the wrong dispatcher thread set, which I tried... My code looks like this: class…
LCC
  • 1,170
  • 1
  • 17
  • 28
3
votes
2 answers

More DispatcherTimers in one application

I have an application behaving like autorefresh. It checks emails, new videos, jokes, etc. My client wants these single elements check in different intervals. For example emails every minute, videos every hour, etc. So there should be option for him…
Ondrej Janacek
  • 12,486
  • 14
  • 59
  • 93
3
votes
1 answer

C# WPF timer (stopwatch) with DispatcherTimer

I'm trying to make a simple stopwatch but it just doesn't work.. The app just crashes when I press the buttons. What's wrong? public partial class MainWindow : Window { private DispatcherTimer timer; public MainWindow() { …
user360330
3
votes
1 answer

Trying to update interval for DispatcherTimer, not always working

I am trying to make a Snake game. And what I want to happen is that each time the snake eats a piece of food it moves quicker. I want to do this by making the timer tick faster. I start the timer at an interval time of: gltimer.Interval = new…
BVerspeek
  • 43
  • 3
3
votes
1 answer

Most efficient method to update large number of objects (1,000+) in real-time

What would be the most efficient way to iterate through a collection with a large number of items (1,000 or more) and update the items' properties in real-time? At the moment, my program draws an image for each object in the collection on a canvas…
Jason D
  • 2,634
  • 6
  • 33
  • 67
2
votes
1 answer

How can I set the priority of a DispatcherTimer?

I am creating an app for Windows Phone 7 using Silverlight in C#. I have found many references to the DispatcherTimer(DispatcherPriority) overload, but I cannot set this in my code (e.g. timer = new DispatcherTimer(DispatcherPriority) tells me…
2
votes
1 answer

dispatcherTimer not restarting

I'm implementing a countdown in my app private async void Window_Activated(object sender, WindowActivatedEventArgs args) { dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += dispatcherTimer_Tick; dispatcherTimer.Interval =…
KelvinJPS
  • 69
  • 6
1
2
3
14 15