title: Invoke timer from background thread
body: <p>What I want to do. I want to SomeMethod will be called periodically. Therefore, I want to timer will be started from backgroung thread after body of background thread method is passed. <code>_timer.Start()</code> was invoked, but TickHandler doesn't; </p>
  
  <p>code:</p>
  
  <pre><code>using Timer = System.Windows.Forms.Timer;
  
  class TestTimer
      {
          private Timer _timer;
          private Thread _thread;
  
          public TestTimer()
          {
              // create and initializing timer. but not started!
              _timer = new Timer();
              _timer.Tick += TickHandler;
              _timer.Interval = 60000; // 1 minute
  
              // create and start new thread
              _thread = new Thread(SomeMethod);
              _thread.Start();
          }
  
          private void TickHandler(object sender, EventArgs e)
          {
              // stop timer
              _timer.stop();
  
              //some handling
  
              // run background thread again
              _thread = new Thread(SomeMethod);
              _thread.Start();
          }   
  
          private void SomeMethod()
          {
              // some operations
  
              // start timer!
              TimerStart();
          }
  
          private void TimerStart()
          {
              _timer.Start();
          } 
      }
  </code></pre>
  
  <p>By monkey method I found if add Delegate like this</p>
  
  <pre><code>internal delegate void TimerDelegate();
  </code></pre>
  
  <p>And replace string </p>
  
  <pre><code>TimerStart(); 
  </code></pre>
  
  <p>with </p>
  
  <pre><code>Application.Current.Dispatcher.Invoke(new TimerDelegate(TimerStart), null);
  </code></pre>
  
  <p>all works fine. Somebody can explain me what is the trick?  </p>