My error is CS0143, The type ‘Microsoft.Kinect.KinectSensor’ has no constructors defined
I checked other questions similar to this but did not understand the answers they gave. Essentially the class I am writing is just an initializer for the kinectSenor.
Any help would be great…thank you!
public class KinectInitialize
{
KinectSensor _kinectSensor = new KinectSensor();
#region Constructors
public KinectInitialize()
{
}
#endregion
#region Methods
void SetAllFramesReady(KinectSensor Kinect)
{
Kinect.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(Kinect_AllFramesReady);
}
internal void RemoveOldSensor(DependencyPropertyChangedEventArgs e)
{
_kinectSensor = (KinectSensor)e.OldValue;
StopKinect(_kinectSensor);
}
public KinectSensor CreateNewSensor(DependencyPropertyChangedEventArgs e)
{
_kinectSensor = (KinectSensor)e.NewValue;
return _kinectSensor;
}
internal void StopKinect(KinectSensor sensor)
{
if (sensor != null)
{
sensor.Stop();
sensor.AudioSource.Stop();
}
}
#endregion
There is no public constructor on the
Kinectclass – there is however a public static collectionKinectSensorsfrom which you can just grab the first one in statusConnected:I assume this is done for convenience because you can have more than one Kinect attached to your machine.