public void Dispose()
 {
     kinectGui.Dispose();
     if (sensorManager != null)
     {
         sensorManager.Dispose();
         sensorManager = null;
     }
     if (sequenceRecorder != null)
     {
         sequenceRecorder.Dispose();
         sequenceRecorder = null;
     }
 }
        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"));
        }