dimanche 13 décembre 2020

How to create a timer that starts on a certain condition, and counts to 15 seconds? (C#)

I am creating a C# library, and am looking to create a timer that starts once a certain condition is met. Then, I want the timer to count up to 15 seconds, and once 15 seconds is reached, another action is performed. It would look something like this:

if (condition is met)
{
    //start timer
}

if (timer == 15 seconds)
{
    //do something
    //reset timer for next time that condition is met
}

Any help on how to do this in C# is greatly appreciated!

Aucun commentaire:

Enregistrer un commentaire