dimanche 12 janvier 2020

C# time.sleep not working as expected for no apparent reason

So this algorithm should flash the word finished in 1 second intervals 3 times but it just freezes for 5 seconds instead. Any ideas?

bool appear = false;
int i = 0;
while (i < 5)
{
    i++;
    if (appear == false)
    {
        appear = true;
        Finished_label.Visible = true;
    }
    else
    {
        appear = false;
        Finished_label.Visible = false;
    }
    System.Threading.Thread.Sleep(1000);
}

Aucun commentaire:

Enregistrer un commentaire