// Initializes the plugin public Action Start() { kinectSensor = new SensorSelector((s) => { this.global.RaiseProcessingEvent("Sensor=" + s.status.ToString()); gestureProcessor = new GestureParser(kinectSensor.Kinect, (e) => { this.global.RaiseUpdateEvent(e.Player, e.Gesture); }, (e) => { if (e.ToUpper() == "FRAME") { this.global.RaiseFrameEvent(); } else { this.global.RaiseProcessingEvent(e); } }); gestureProcessor.Gestures.Clear(); if ((bool)this.properties["UseGestureFile"] == true) { gestureProcessor.GestureFromFile(this.properties["GestureFileName"].ToString()); } Started(this, new EventArgs()); }, null, (p) => { if ((p.key == "Status") && (p.value.ToString() == "NoAvailableSensors")) { throw new Exception("No Kinect Sensor Found"); } }); kinectSensor.GetSensor(); return(null); }
// Stops the plugin public void Stop() { if (gestureProcessor != null) { gestureProcessor.Stop(); gestureProcessor.Gestures.Clear(); } gestureProcessor = null; kinectSensor.ClearSensor(); kinectSensor = null; }