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
0
votes
1 answer

C# how to resume code when DispatcherTimer stops

So I have a class containing a function that can check whether an element in a website changes (In my example code this is class B). I also have multiple classes that need to use this function to see whether there is a change in a web element and…
uRThow
  • 27
  • 9
0
votes
1 answer

Timer Stops When Phone Goes Into Airplane Mode, Won't Restart After Leaving AM

OK. Looked through the possible answers, but I don't see my issue here. I have a fairly bog-standard GCD repeating timer: class RepeatingGCDTimer { /// This holds our current run state. private var state: _State = ._suspended /// This…
Chris Marshall
  • 4,910
  • 8
  • 47
  • 72
0
votes
2 answers

WPF Application DispatcherTimer not working correctly (lag)

I have been trying to run a very simple application that moves a 20 by 20 pixel square 20 pixels to the right on a canvas every second. I am using a dispatchertimer to fire the event every second. The problem is that the square doesn't move to the…
Supahotfire420
  • 441
  • 1
  • 4
  • 10
0
votes
1 answer

Set the duration of a timer function UWP C#

I have an app which moves a car through specified locations on a map control. I'm using below code to achieve this functionality. But now I want to set a duration for this. I mean the car should reach at a particular time from start to endpoint. How…
nsds
  • 961
  • 4
  • 13
  • 39
0
votes
0 answers

Call a timer function after executing another function - UWP C#

I want to call a timer function only after executing a function PreCalculateAsync(). Now timer is calling every 30 milliseconds. But initially I want to execute PreCalculateAsync function. How can I achieve this? My code : public…
user2431727
  • 877
  • 2
  • 15
  • 46
0
votes
2 answers

WPF - A more accurate Timer

I'm new to CS and WPF. I'm going to get a DateTime object and set it as the beginning of my timer. But I used DispatcherTimer.Tick. I can feel it inaccurate with a little care and playing with window controls. It apparently its in a single thread…
Phree
  • 5
  • 5
0
votes
1 answer

How to wait until DispatcherTimer is stopped?

I have a DispatcherTimer with a Tick event that is stopped after interval. I stop the DispatcherTimer after amount of time in the tick event like this(using StopWatch): private void DispatcherTimerTick(object sender, EventArgs e) { var…
KaliTheGreat
  • 579
  • 6
  • 17
0
votes
1 answer

How to work with Timer, when app is in background

Am calling one function for every 4 seconds using Timer and if I tap on a button in the same viewController am navigating to google maps. After navigating to google maps that function is not getting called Here is by button action @IBAction func…
Bhanuteja
  • 41
  • 2
  • 6
0
votes
0 answers

Make something happen if a specific time is left on DispatcherTimer

I'm currently working on a UWP project and need some help with my DispatcherTimer. What I'm working with is a booking function and I want a color to change if there is 15 seconds left until the DispatcherTimer ticks. I have two variables that is…
luddep
  • 219
  • 1
  • 2
  • 14
0
votes
0 answers

Error when trying to hide columns straight after binding data to datagrid

So I have an XML file which I read in then display the data onto a DataGrid. Once I bind the DataView of the XML file to the ItemsSource of the datagrid I then attempt to hide the 4th column that will be created (it's an ID which I don't want to…
0
votes
2 answers

Change timer at runtime c#

Iv'e created a timer using dispatcher time : time = new DispatcherTimer(); time.Interval = new TimeSpan(0, 0, 0, 0, 80); and I use it for the speed of an object.Each tick the objects moves 10 pixels. I would like to know how to increase the speed…
Karoline
  • 125
  • 9
0
votes
1 answer

combination of MouseDown and timer

I try to load a function like "holdFunction", during touching(MouseDown) and during at max 1 second . So when user try to touch and hold for a second I have to call the function, and this isn't related to mouseUp. Maybe I must to combine…
0
votes
1 answer

DispatcherTimer ticking not working when started in ThreadPool.QueueUserWorkItem() method

I've created a TimerManager class for my WPF application. This class handles the start and stop the dispatcher timer. Here is the class: public static class TimerManager { static DispatcherTimer disTimer; static Model m =…
0
votes
1 answer

The best way to run periodically function on C#

In my WPF application one of the assumptions is watching a folder to capture changes. My first idea is: DispatcherTimer dt = new DispatcherTimer(); dt.Tick += (senderTick, eTick) => { // do observable folder }; dt.Interval = new TimeSpan(0, 0,…
18666
  • 125
  • 1
  • 18
0
votes
2 answers

Creating stopwatch in WPF - time precison

I need to set up a stopwatch in my app. I tried to do it using dispatcher timer, with one millisecond interval. But, the clock runs at about the speed that it takes about ten seconds to count up to a second. I assume that it is the threading…
Krepsy 3
  • 63
  • 1
  • 2
  • 11