title: System.Threading Timer
body: <p>I am having problems converting my DispatcherTimer syntax to the Thread Timer. When i run my application suddenly it shuts down without any error.</p>
  
  <p>Basically i want the timer to execute 2 methods every 5 seconds.</p>
  
  <p><strong>EDIT: The 2 methods are updating the UI.</strong>
  I am trying to attempt to get rid of the DispatcherTimer because i have to much freezes and delays in the UI display.</p>
  
  <p>Dispatcher timer code:</p>
  
  <pre><code>timerW = new DispatcherTimer();
      timerW.Tick += new EventHandler(timerW_Tick);
      timerW.Interval = new TimeSpan(0, 0, 5000);
      timerW.Start();
  
  
  
   private void timerW_Tick(object sender, EventArgs e)
          {
              DisplayWegingInfo();
              CaculateTimen();
          }
  </code></pre>
  
  <p>Code for the System.Threading Timer:</p>
  
  <pre><code>public void InitializeDispatcherTimerW()
      {
          TimerCallback callback = MyTimerCallBack;
          timerW = new Timer(callback);
  
          timerW.Change(0, 5000);
      }
  
      private void MyTimerCallBack(object state)
      {
          DisplayWegingInfo();
          CaculateTime();
      }
  </code></pre>
  
  <p>Thanks.</p>