Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Timed Button

(Apr 10, 2015 09:34 AM)Coco_Cubana Wrote:  public class Timer1
{
private static System.Timers.Timer aTimer;

public static void Main()
{
// Create a timer with a ten second interval.
aTimer = new System.Timers.Timer(600000);

// Hook up the Elapsed event for the timer.
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

// Set the Interval to x minutes
aTimer.Interval = 600000;
aTimer.Enabled = true;

Console.WriteLine("Press the Enter key to exit the program.");
Console.ReadLine();

// If the timer is declared in a long-running method, use
// KeepAlive to prevent garbage collection from occurring
// before the method ends.
GC.KeepAlive(aTimer);
}

// Specify what you want to happen when the Elapsed event is
// raised.
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Butnupdate.Enabled = false;
MessageBox.Show("Time Up!");
}
}

example taken from microsoft

This is java code.

As the user above me said that's one of the ways to do it. Just stick that in a timer that checks every few seconds (or less if you wanted)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by LeonieHackPetaBytes2Jan 23, 2019 05:10 PM 1 227 Jan 23, 2019 05:10 PM
Last Post: 0xDEAD10CC
[C] by theChiveFeb 2, 2016 07:20 PM 3 144 Feb 2, 2016 07:20 PM
Last Post: Annabelle Lee
[.NET] by ElementalTreeOct 28, 2014 05:48 PM 2 143 Oct 28, 2014 05:48 PM
Last Post: Hiiro