Reputation: 785
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
Upvotes: 0
Views: 1300
Reputation: 160852
There is no public constructor on the Kinect
class - there is however a public static collection KinectSensors
from which you can just grab the first one in status Connected
:
KinectSensor sensor = KinectSensor.KinectSensors
.FirstOrDefault(s => s.Status == KinectStatus.Connected);
I assume this is done for convenience because you can have more than one Kinect attached to your machine.
Upvotes: 2