public LeapMotionManager() { deviceStatusArgs = new KineapStatusChangedArgs(); if (listener == null) { if (leapMotionConverter == null) { leapMotionConverter = new LeapMotionConverter(); listener = new LeapMotionListener(leapMotionConverter, this); AssimpConverter = leapMotionConverter; } if (controller == null) controller = new Controller(); controller.AddListener(listener); } }
public KinectManager() { kinectConverter = new KinectConverter(); AssimpConverter = kinectConverter; deviceStatusArgs = new KineapStatusChangedArgs(); KinectSensor.KinectSensors.StatusChanged += new EventHandler<StatusChangedEventArgs>(Sensor_StatusChanged); sensor = KinectSensor.KinectSensors.FirstOrDefault(); if (sensor != null) // If a Kinect is detected on startup, assigns its current status { deviceStatusArgs.CurrentStatus = GetStatus(sensor.Status); deviceStatusArgs.OriginalDeviceStatus = sensor.Status.ToString(); Device_StatusChanged(deviceStatusArgs); if (sensor.IsRunning) // This verification is important because if the software crashes unexpectedly, the sensor might still be on when relauching the software sensor.Stop(); } else // If not, assigns default status 'Disconnected' { deviceStatusArgs.CurrentStatus = GetStatus(KinectStatus.Disconnected); deviceStatusArgs.OriginalDeviceStatus = "No Kinect was found on startup"; } }
/// <summary> /// Is Called whenever a device's status changes /// Updates /// </summary> /// <param name="e"></param> public void Device_StatusChanged(KineapStatusChangedArgs e) { EventHandler<KineapStatusChangedArgs> handler = StatusChanged; if (handler != null) handler(this, e); }
private void LeapMotion_StatusChanged(object sender, KineapStatusChangedArgs e) { LeapMotionStatus = e.CurrentStatus; LeapMotionToolTip = e.OriginalDeviceStatus; }
private void Kinect_StatusChanged(object sender, KineapStatusChangedArgs e) { KinectStatus = e.CurrentStatus; KinectToolTip = e.OriginalDeviceStatus; }
/// <summary> /// Is called if the device is disconnected while running in which case /// it calls the Record method that will stop the device /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void CurrentDeviceRecording_StatusChanged(object sender, KineapStatusChangedArgs e) { if (e.CurrentStatus != KineapStatus.CONNECTED) { if (CurrentDevice.IsRecording) RecordWithDevice(CurrentDevice); } }