First you need to install the latest Kinect toolkit and SDK from Microsoft. As many namespaces have been changed from the previous ones.
So to initialize a device follow these steps.
Create a new project, Can be a WPF or Windows Forms Project.
On the main page.
Add these two imports
Now we want to see how many Kinect devices are connected to the project or and there status. For that we have to make an object of type KinectSensorChooser that is inside the Kinect.Toolkit dll.
private readonly KinectSensorChooser sensorChooser = new KinectSensorChooser();
In the constructor, we can add this line.
sensorChooser.KinectChanged += sensorChooser_KinectChanged;
Above two lines will initialize the search for kinect devices, and as soon as it finds it, it will raise the KinectChanged event.
void sensorChooser_KinectChanged(object sender, KinectChangedEventArgs e)
KinectSensor oldSensor = e.OldSensor;
KinectSensor newSensor = e.NewSensor;
This will initialize the newSensor object if a kinect device is found.