title: Delaying execution - C# WPF
body: <p>I have a Grid control and clicking on each row does some background job to load the data. Each background job is performed on a thread pool thread. When user clicks on the items quickly, lot of requests to load data will be queued. I want to minimize this by providing a delay after clicking each row. There will be some delay before firing the request to load the data. </p>
  
  <p>I am thinking about using <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer.aspx" rel="nofollow">DispatcherTimer</a> class. Something like,</p>
  
  <pre><code>readonly DispatcherTimer dt = new DispatcherTimer();
  private void Clicked(object sender, RoutedEventArgs e)
  {
      dt.Interval = TimeSpan.FromSeconds(2);
      dt.Stop();
      dt.Start();
  }
  
  private void DtOnTick(object sender, EventArgs args)
  {
      // Fire a thread and do data loading
  }
  </code></pre>
  
  <p>Is this the correct way to approach the problem? </p>
  
  <p>Any suggestions would be appreciated!</p>