void sensorManager_StatusChanged(KinectSensorManager obj)
 {
     //This function checks the status the first time the sensor is connected.
     if (sensorManager.Connected)
     {
         poseController.AllowMovement = true;
         sensorManager.StatusChanged -= sensorManager_StatusChanged; //Remove the event, we only care the first time
     }
 }
Beispiel #2
0
 void sensorManager_ColorFeedChanged(KinectSensorManager obj)
 {
     if (sensorManager.HasColorFeed)
     {
         createColorTexture();
     }
     else
     {
         destroyColorTexture();
     }
 }
 public void Dispose()
 {
     kinectGui.Dispose();
     if (sensorManager != null)
     {
         sensorManager.Dispose();
         sensorManager = null;
     }
     if (sequenceRecorder != null)
     {
         sequenceRecorder.Dispose();
         sequenceRecorder = null;
     }
 }
Beispiel #4
0
 void sensorManager_StatusChanged(KinectSensorManager sensorManager)
 {
     setConnectedLabelText(sensorManager.Connected);
     if (sensorManager.UseColorFeed)
     {
         if (sensorManager.Connected)
         {
             createColorTexture();
         }
         else
         {
             destroyColorTexture();
         }
     }
 }
Beispiel #5
0
        public KinectGui(KinectPoseController poseController, KinectSensorManager sensorManager, KinectDebugVisualizer debugVisualizer)
            : base("KinectPlugin.GUI.KinectGui.layout")
        {
            window.EventChangeCoord += window_EventChangeCoord;

            this.poseController = poseController;
            poseController.AllowMovementChanged += ikController_AllowMovementChanged;
            this.sensorManager              = sensorManager;
            sensorManager.StatusChanged    += sensorManager_StatusChanged;
            sensorManager.ColorFeedChanged += sensorManager_ColorFeedChanged;
            this.debugVisualizer            = debugVisualizer;

            enableMotionButton                 = new CheckButton((Button)window.findWidget("EnableMotion"));
            enableMotionButton.Checked         = poseController.AllowMovement;
            enableMotionButton.CheckedChanged += enableMotionButton_CheckedChanged;

            showIkSkeleton                 = new CheckButton((Button)window.findWidget("ShowIkSkeleton"));
            showIkSkeleton.Checked         = poseController.DebugVisible;
            showIkSkeleton.CheckedChanged += showIkSkeleton_CheckedChanged;

            showSensorSkeleton                 = new CheckButton((Button)window.findWidget("ShowSensorSkeleton"));
            showSensorSkeleton.Checked         = debugVisualizer.DebugVisible;
            showSensorSkeleton.CheckedChanged += showSensorSkeleton_CheckedChanged;

            enableVideoFeed                 = new CheckButton((Button)window.findWidget("EnableVideoFeed"));
            enableVideoFeed.Checked         = sensorManager.UseColorFeed;
            enableVideoFeed.CheckedChanged += enableVideoFeed_CheckedChanged;

            jawTracking                 = new CheckButton(window.findWidget("JawTracking") as Button);
            jawTracking.Checked         = poseController.JawTracking;
            jawTracking.CheckedChanged += jawTracking_CheckedChanged;

            skeletonTracking                 = new CheckButton(window.findWidget("SkeletonTracking") as Button);
            skeletonTracking.Checked         = poseController.SkeletonTracking;
            skeletonTracking.CheckedChanged += skeletonTracking_CheckedChanged;

            statusLabel = (TextBox)window.findWidget("StatusLabel");
            setConnectedLabelText(sensorManager.Connected);

            colorSensorImage            = (ImageBox)window.findWidget("ColorSensorImageBox");
            colorSensorImageOriginalPos = new IntCoord(colorSensorImage.Left, colorSensorImage.Top, colorSensorImage.Width, colorSensorImage.Height);
            colorSensorImageIconPos     = new IntCoord(colorSensorImageOriginalPos.width / 2 - ColorIconSize / 2, colorSensorImageOriginalPos.height / 2 - ColorIconSize / 2, ColorIconSize, ColorIconSize);
            setColorImageIcon();
        }
        public void initialize(StandaloneController standaloneController)
        {
            poseController = new KinectIkController(standaloneController);
            kinectDebugger = new KinectDebugVisualizer(standaloneController);
            sensorManager  = new KinectSensorManager();
            sensorManager.SkeletonFrameReady += sensorManager_SkeletonFrameReady;
            sensorManager.StatusChanged      += sensorManager_StatusChanged;
            sensorManager.FaceFrameReady     += sensorManager_FaceFrameReady;

            kinectGui = new KinectGui(poseController, sensorManager, kinectDebugger);
            standaloneController.GUIManager.addManagedDialog(kinectGui);

            sequenceRecorder = new MovementSequenceRecorder(standaloneController.MedicalController, standaloneController.MovementSequenceController);
            standaloneController.GUIManager.addManagedDialog(sequenceRecorder);

            var taskController = standaloneController.TaskController;

            taskController.addTask(new MDIDialogOpenTask(kinectGui, "KinectPlugin.KinectGui", "Kinect", "KinectPlugin.Kinect", "Kinect"));
            taskController.addTask(new MDIDialogOpenTask(sequenceRecorder, "KinectPlugin.KinectMovementSequenceRecorder", "Record Sequence", "KinectPlugin.Record", "Kinect"));
        }