title: Unable to stop the kinect camera freezes my app
body: <p>I'm using kinect SDK 1.7 (since only that one works on win 7).</p>
  
  <p>My program works fine, i can change video modes for depth and color without errors. But it goes wrong when i want to close my program by using the top right redcross close main form corner button. In fact it seams even if i set breakpoint in Deactivate Sensor, ..its never triggered ??</p>
  
  <p>I wrote code below with no success.</p>
  
  <pre><code> private void DeActivateSensor()
      {
          if (kinectSensor != null)
          {
              if (kinectSensor.SkeletonStream.IsEnabled) { kinectSensor.SkeletonStream.Disable();}
              if (kinectSensor.ColorStream.IsEnabled) { kinectSensor.ColorStream.Disable(); }
              if (kinectSensor.DepthStream.IsEnabled) {kinectSensor.DepthStream.Disable();}
  
  
              Thread.Sleep(1000);
  
              kinectSensor.ColorFrameReady -= new EventHandler&lt;ColorImageFrameReadyEventArgs&gt;(kinectSensor_ColorFrameReady);
              kinectSensor.DepthFrameReady -= new EventHandler&lt;DepthImageFrameReadyEventArgs&gt;(kinectSensor_DepthFrameReady);
              // since i dont have skelleton events i dont need to repeat that for it
              try
              {
                  if (kinectSensor.IsRunning) { kinectSensor.Stop(); }
              }
              catch
              {
                  Debug.WriteLine("unknown Exception ");
              }
  
              Thread.Sleep(1000);
              if (kinectSensor != null) { kinectSensor.Dispose(); }
          }
      }
  
  
      private void MainForm_Load(object sender, EventArgs e)
      {
          DeActivateSensor();
  
      }
  
      private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
      {
          DeActivateSensor();
      }
  </code></pre>