public void Initialize(KinectStatusUpdated kinectStatusUpdated, ProcessStatusUpdated processStatusUpdated, LocationUpdated locationUpdated, BitmapInit bitmapInit) { this.kinectSensor = KinectSensor.GetDefault(); this.multiFrameSourceReader = this.kinectSensor.OpenMultiSourceFrameReader(FrameSourceTypes.Depth | FrameSourceTypes.Color | FrameSourceTypes.BodyIndex); this.multiFrameSourceReader.MultiSourceFrameArrived += this.Reader_MultiSourceFrameArrived; this.coordinateMapper = this.kinectSensor.CoordinateMapper; FrameDescription depthFrameDescription = this.kinectSensor.DepthFrameSource.FrameDescription; depthWidth = depthFrameDescription.Width; depthHeight = depthFrameDescription.Height; FrameDescription colorFrameDescription = this.kinectSensor.ColorFrameSource.FrameDescription; colorWidth = colorFrameDescription.Width; colorHeight = colorFrameDescription.Height; this.colorMappedToDepthPoints = new DepthSpacePoint[colorWidth * colorHeight]; this.depthMappedToColorPoints = new ColorSpacePoint[depthWidth * depthHeight]; this.bitmap = new WriteableBitmap(colorWidth, colorHeight, 96.0, 96.0, PixelFormats.Bgra32, null); // Calculate the WriteableBitmap back buffer size this.bitmapBackBufferSize = (uint)((this.bitmap.BackBufferStride * (this.bitmap.PixelHeight - 1)) + (this.bitmap.PixelWidth * this.bytesPerPixel)); bitmapInit(this.bitmap); this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged; this.kinectSensor.Open(); this.kinectStatusUpdated = kinectStatusUpdated; this.processStatusUpdated = processStatusUpdated; this.locationUpdated = locationUpdated; kinectStatusUpdated(this.kinectSensor.IsAvailable ? Properties.Resources.RunningStatusText : Properties.Resources.NoSensorStatusText); this.timestamp = DateTime.Now; }