none
Ask for help: Function to start the Kinect RRS feed

  • Question

  • Hi All,

        I create a project for Kinect which has a start button to start the kinect and a stop button to stop the kinect. The problem is when I hit the stop button to stop the kinect and then hit the start button. The kinect would never start. Here is the code:

    private void StartButton_Click(object sender, RoutedEventArgs s)

    {

       if(this.Kinect!=null)

      {

       this. Kinect.Start();

      }

    }

    private void StopButton_Click(object sender, RoutedEventArgs e)

    {

    if (this.Kinect != null)

    {

    this.Kinect.Stop();

    this.Kinect.Dispose();

    this._Kinect = null;

    }

    }

    Thank you

    Monday, July 16, 2012 9:59 PM

All replies

  • well, you set this._Kinect = null when you stop, and then check if(this.Kinect!=null) in StartButton
    Monday, July 16, 2012 10:09 PM
  • oh wait, I see you have this.<underscore>Kinect

    what you are seeing is this.Kinect being set to null by calling dispose

    Monday, July 16, 2012 11:08 PM