title: WPF Dispatchertimer delayed reaction / freeze
body: <p>In my WPF application i use 3 different DispatcherTimers.</p>
  
  <ul>
  <li>One is for displaying the current time</li>
  <li>One is are for running a DB query every 5 sec </li>
  <li>The third one refreshes a value for a custom button every 1 sec</li>
  </ul>
  
  <p>When my program is running there are a lot of delays / freezes.
  For example the time starts ticking correctly but on a sudden the value freezes up and after the freeze the time gets incremented by +3 seconds for example.</p>
  
  <p>I am getting this behavior over my entire application.
  What is the proper way to solve this problem with several timers?</p>
  
  <p>EDIT:</p>
  
  <p>I am having problems to replace a DispatcherTimer with a Timer from System.Timers namespace.</p>
  
  <pre><code>//new code with timer
  timerW = new Timer();
          timerW.Elapsed += new ElapsedEventHandler(timerWegingen_Tick);
          timerW.Interval = 5000; 
          timerW.Start();
  
          //OLD Working Code
          timerW = new DispatcherTimer();
          timerW.Tick += new EventHandler(timerWegingen_Tick);
          timerW.Interval = new TimeSpan(0, 0,5);
          timerW.Start();
  </code></pre>
  
  <p><em>Error : "The calling thread must be STA, because many UI components require this."</em></p>
  
  <p>Best regards.</p>