timer

WPF: Button single click + double click problem

Hi All, I have to handle both the single click and the double click of a button in a WPF application with different reaction. Unfortunately, on a doubleclick, WPF fires two click event and a double click event, so it's hard to handle this situation. It tried to solve it using a timer but without success...I hope you can help me. Lets...

Threading and Singletons

Before anyone flips out on me about singletons, I will say that in this instance it makes sense for me to have a singleton given the wide use of this object throughout my code and if someone has a better way short of DI I would like to hear but I would hope that this would not be the focus of this post, moreso helping solve it would be. ...

How to make a timer fire only one time.

Hi, I am using C#2.0 and working on Winforms. I have two applications(app1,app2). when the app1 runs it will automatically invoke the app2. I have a timer in my app2 and in timer_tick I activate a buttonclick event.But I want this Button Click to be fired only one time when the app is started. The problem i am facing is for some unk...

Why will this timer not start in a .net service application?

I have this code for a Windows service I am writing in .NET....However the TICK function never gets executed regardless of what interval I put in the tmrRun properties. What am I missing? I am sure its something stupid I am not seeing. Thank You Imports System.IO Public Class HealthMonitor Protected Overrides Sub OnStart(B...

How to update a MATLAB GUI in the background?

I have a MATLAB GUI and a separate application that writes data to a file. I'd like my MATLAB GUI to check the file periodically, and update the GUI when it changes. In Java, I'd use a SwingUtils.Timer(sp?) object to do something like this. Does MATLAB have timer functionality? I could write a java class and do it I suppose, but want ...

Using timer for updating GUI: why it doesn't work?

Hi, I am creating an appication for video recording and I overlayed the video preview with labels txtStatus and txtTime. The camera button starts/stops the timer which periodically calls the UpdateGUI method. Running the debug I can see the timer is working - it calls updateGUI method every second but the method doesn't update the cont...

How to make a WPF control that updates every second?

This question is similar to another one I asked, but whereas in that case I wanted to know about forcing a binding to update from XAML or a view model, in this case I'd like to know about wrapping this up into a custom WPF FrameworkElement. The functionality I'm after is a span of text that indicates how long ago something happened. <T...

Java Swing Timer

ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { //...Perform a task... logger.finest("Reading SMTP Info."); } }; Timer timer = new Timer( 100 , taskPerformer); timer.setRepeats(false); timer.start(); According to the documentation...

Getting matlab timer to update matlab GUIDE gui?

I have a matlab timer object. It is updating a global variable FOO once per second. I have a matlab GUIDE GUI, with a couple of controls, and a single plot frame. The plot frame gets updated by some of the GUI controls, and it gets updated by the timer object. Basically, there are two global variable FOO and BAR. The timer updates F...

Using System.Windows.Forms.Timer.Start()/Stop() versus Enabled = true/false

Suppose we are using System.Windows.Forms.Timer in a .Net application, Is there any meaningful difference between using the Start() and Stop() methods on the timer, versus using the Enabled property? For example, if we wish to pause a timer while we do some processing, we could do: myTimer.Stop(); // Do something interesting here. myTi...

How can I use CreateTimerQueueTimer to create a high resolution timer in C#?

I've used a Windows multimedia dll to created a high resolution timer with timSetEvent() But the timeSetEvent() page recommends the use of: CreateTimerQueueTimer() How can I use CreateTimerQueueTimer() to execute a method every 10 milliseconds in C#? ...

[iPhone] Delaying but not disabling iPhone auto-lock

Hi everyone, I currently have a very simple app for which the only interaction is shaking the iPhone. However eventually the screen dims and auto-locks since the iPhone is not getting any touch events. I was wondering if there is a way to reset the auto-lock time-out when shaken? I know that to disable auto-lock completely I would do...

How can I use the J2EE Timer Service API in the Servlet startup code?

For a background job which I would like to run in a J2EE container, I found the suggestion to create a startup servlet and use the Timer Service API to create a managed Timer (in the answers for What tools are there for timed batch processes in J2EE?). To create a timer, I need a context which implements the timer API. (Example) In th...

count-down timer

My main problem is that I don't know how to search what I'm looking for in google,because I get different results(probably its not count-down timer). I want to calculate how much time a function takes to be executed.The instructions take a long time in seconds to be executed(seconds,not miliseconds). How to do it in C#/NET,example? ...

<100uS accurate sleeps on Windows CE

Is it possible to sleep for an amount of time that will be accurate to less than 100 microseconds on Windows CE? The less jitter the better - ideally we'd like single digit microsecond response times. What we really want is a 5ms timer with very low jitter - although the Windows CE WaitFor[Single|Multiple]Objects and Sleep APIs work in ...

Auto submit form after x mili seconds of inactive keyboard

In my form I have a set of input boxes where a user can input a value. On change of one of these boxes, the form automatically gets submitted. The problem now is however that a user stays in the last field, takes the mouse and presses the OK button (of another form) without leaving the textbox first. The change event doesn't get trigger...

Run a task at specific intervals in python

What would be the most pythonic way to schedule a function to run periodically as a background task? There are some ideas here, but they all seem rather ugly to me. And incomplete. The java Timer class has a very complete solution. Anyone know of a similar python class? ...

Java Timer

I'm trying to use a timer to schedule a recurring event in an application. However, I want to be able to adjust the period at which the event fires in real time (according to the users input). For example: public class HelperTimer extends TimerTask { private Timer timer; //Default of 15 second between updates private int se...

How to reset a timer in C#?

There are three Timer classes that I am aware of, System.Threading.Timer, System.Timers.Timer, and System.Windows.Forms.Timer, but none of these have a .Reset() function which would reset the current elapsed time to 0. Is there a BCL class that has this functionality? Is there a non-hack way of doing it? (I thought perhaps changing the ...

About RTC(system clock) issue in Win7

I encountered a very very very strange issue, if My SW is still running in Idle mode on Win7, the RTC(system clock) delay 25 sec during 3 days, I addressed it's WM_TIMER issue. If I remove the timer, the issue will disappear, but I really want to know how to avoid it and why. Thanks. ...