Countdown depending on the dates of a list [closed]

0

Good, my query is the following I have a windows Form as in the following image.

What I'm looking for is that when I hit Start. the time above only count the total seconds to the back. Until reaching zero. It will then be when that date is added to List2 and the counter shown in the label "Out of Time: 00" increases its value by 1, on the other hand the timer will restart and count the total seconds of the next row of list1, it will this until all the rows in the list are finished. And that's it.

I use For to count each row, but I can not get the For line to stop until the Timer time is reached, so that it can then go on to the next Row. That is my question. Thanks in advance.

    
asked by neojosh2 31.03.2017 в 23:50
source

1 answer

1

Definitely do not use a For to go through the list, simply use the Timer and when it's zero, get the next one from the list.

For example:

int objetos = lista.count;
int posicion = 0;
public void cambiar_Posicion()
{ 
    if lista(posicion) <= timeSpawn(0, 0, 0, 0, 0)
        {
        if posicion < objetos
        {
            posicion++;
        }
    }
    lista(posicion).Tick += timer_tick;
    lista(posicion).Start;
}
public void timer_tick(object sender, EventArgs e)
{
    //tu lógica.

    cambiar_Posicion()
}

I hope it helps, this code has not been tested, it's only for reference .

    
answered by 01.04.2017 / 05:33
source