protected override void OnKinectSensorChanged(object sender, KinectSensorManagerEventArgs<KinectSensor> args)
{
if (null == args)
{
throw new ArgumentNullException("args");
}
if (null != args.OldValue)
{
args.OldValue.ColorFrameReady -= this.ColorImageReady;
if (!this.RetainImageOnSensorChange)
{
kinectColorImage.Source = null;
this.lastImageFormat = ColorImageFormat.Undefined;
}
}
if ((null != args.NewValue) && (KinectStatus.Connected == args.NewValue.Status))
{
ResetFrameRateCounters();
if (ColorImageFormat.RawYuvResolution640x480Fps15 == args.NewValue.ColorStream.Format)
{
throw new NotImplementedException("RawYuv conversion is not yet implemented.");
}
else
{
args.NewValue.ColorFrameReady += this.ColorImageReady;
}
}
}