title: timer doesn't stop c#
body: <p>I am using timer in form to send a command to a controller after every 3 seconds when user presses button. The timer should stop after user again presses same button. But in my case timer doesn't stop. I am using timer in the following way.</p>
  
  <pre><code>private void autoModeTempBtn_Click(object sender, EventArgs e)
      {
          System.Timers.Timer tempTimer = new System.Timers.Timer(3000);
          tempTimer.SynchronizingObject = this;
          tempTimer.AutoReset = true;
  
          if (autoModeTempBtn.Text == "Get Temperature Auto Mode")
          {
              autoModeTempBtn.Text = "hello";
  
              tempTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTemperatureEvent);
              tempTimer.Enabled = true;
          }
          else /*user presses button second time */
          {
              tempTimer.Stop();
              tempTimer.AutoReset = false;
              tempTimer.Enabled = false;
              autoModeTempBtn.Text = "Get Temperature Auto Mode";
          }
      }
      private void OnTemperatureEvent(object source, System.Timers.ElapsedEventArgs e)
      {
         //do something
      }
  </code></pre>
  
  <p>Where I am making mistake?</p>