title: C# How to run delayed method in between timer ticks
body: <p>I am using a timer to run a method every 16 minutes. I also want to run a second method every minute for 15 minutes in-between.</p>
  
  <p>Below is the code I am using:</p>
  
  <pre><code>int count =  0;
  
  private void cmdGo_Click(object sender, EventArgs e)
  {
          System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
          t.Interval = 960000; // specify interval time - 16 mins
          t.Tick += new EventHandler(timer_Tick);
          t.Start();
  }
  
  void timer_Tick(object sender, EventArgs e)
  {
          RunMethod1();
  
          while(count &lt; 15)
          {
              //waiting for 60 seconds 
              DateTime wait = DateTime.Now;
              do
              {
                   Application.DoEvents();
              } while (wait.AddSeconds(60) &gt; DateTime.Now);
  
              RunMethod2();
          }
  }
  </code></pre>
  
  <p>The above code seems to work fine but the ‘do while’ loop to wait for 60 seconds is very CPU heavy.</p>
  
  <p>I tried to use Thread.Sleep(60000) but this freezes up the Interface and also tried to add a second timer within timer_Tick but this doesn’t seem possible. Can a second timer be added within the EventHandler of the first?</p>
  
  <p>Is there any other method to achieve this without being so CPU intensive?</p>
  
  <p>Thanks!
  Warren</p>
  
  <p>NOTE: Sorry guys, there was a typo in my original post. The 60 second wait do, while loop should have been within the while &lt; 15 loop. Just updated the code snippet.</p>
  
  <p>So:</p>
  
  <ul>
  <li>RunMethod1() should be executed every 16 mins</li>
  <li>RunMethod2() should be executed every 1 min (15 times) in between the 16 min tick</li>
  </ul>