Search code examples
c#wpfmethodskinectkinect-sdk

How to run a method without interrupting Kinect


I have written a program in C# that creates a window with both a video feed and skeleton feed from the kinect, I also do some calculations based on the skeleton position then on the click of a button send the results of those calculations to another program.

This only sends the one set of values though, if i want to send more values i have to keep clicking the start button. I want the button once clicked to continuously run the SendData method so I can have a (close to live) feed of the data with the video and skeleton feed running.

I tried putting the SendData method in a while or for loop but then the kinect part (skeleton, video and calculation) stop running and freezes.

I have tried putting the SendData part in the initialiseKinect method but no luck.

Does anyone have any ideas how to have the Kinect part running while sending the data by calling my method continuously or without me having to click a thousand times a second?

many thanks


Solution

  • Keep track of a boolean that changes value based on the click of the button.

    Check if the boolean is true or false in your Skeleton_On_Ready event and then send your data via a Task or backgroundworker.