title: C# Timer thread crash, BeginInvoke
body: <p>I've an "animateMyWindow" class to change opened window's opacity with Timer.</p>
  
  <pre><code>    namespace POCentury
  {
      class animateMyWindow
      {
          Timer _timer1 = new Timer();
          Window _openedWindow = null;
          public void animationTimerStart(object openedWindow)
          {
              if (openedWindow == null)
              {
                  throw new Exception("Hata");
              }
              else
              {
                  _openedWindow = (Window)openedWindow;
                  _timer1.Interval = 1 * 25;
                  _timer1.Elapsed +=  new ElapsedEventHandler(animationStart);
                  _timer1.AutoReset = true;
                  _timer1.Enabled = true;
                  _timer1.Start();
              }
          }
          private void animationStart(object sender, ElapsedEventArgs e)
          {
              if (_openedWindow.Opacity == 1)
                  animationStop();
              else
                  _openedWindow.Opacity += .1;
          }
          private void animationStop()
          {
              _timer1.Stop();
          }
      }
  }
  </code></pre>
  
  <p>animationStart function can't reach my window because it is working on a different thread.
  I've tried Dispatcher.BeginInvoke and can't make it work.
  Can you help me with doing that?</p>