title: c# how to run multiple timer in loop. one timer after another
body: <p>I want to run timer countdown (DispatchTimer) multiple times in a loop, one after another. I want to wait until one timer stops and then run another one. </p>
  
  <p>I'm gonna try something like this:</p>
  
  <pre><code>public TimeSpan CurrentTimeSpan;
  private void RunInterval()
  {
      for (int i = 0; i &lt; 10; i++)
      {
          RunTimer(new TimeSpan(0, 0, 0, 30));        
  
      }
  }
  private void RunTimer(TimeSpan Timer)
  {
      DispatcherTimer timer1 = new DispatcherTimer();
      timer1.Interval = new TimeSpan(0, 0, 0, 1);
      CurrentTimeSpan = Timer;
      timer1.Tick += Timer1OnTick;
  
  }
  private void Timer1OnTick(object sender, object o)
  {
      DispatcherTimer timer = (DispatcherTimer) sender;
      CurrentTimeSpan = CurrentTimeSpan.Subtract(timer.Interval);
      if (CurrentTimeSpan.TotalSeconds == 0)
      {
          timer.Stop();
      }
  }
  </code></pre>
  
  <p>My problem is that method RunInterval or RunTimer doesn't wait until timer will stop.</p>
  
  <p>What can I do about it?</p>