public Boxes()
        {
            InitializeComponent();

            this.context = new OpenNI.Context(SAMPLE_XML_FILE);
            this.sessionManager = new NITE.SessionManager(this.context, "Wave", "RaiseHand");

            this.flowRouter = new NITE.FlowRouter();
            this.selectableSlider = new NITE.SelectableSlider1D(3, NITE.Axis.X);
            this.boxes = new MyBox[3];
            this.boxes[0] = new MyBox(this.Box1, "Box1");
            this.boxes[1] = new MyBox(this.Box2, "Box2");
            this.boxes[2] = new MyBox(this.Box3, "Box3");

            this.boxes[0].Leave += new MyBox.LeaveHandler(Boxes_Leave);
            this.boxes[1].Leave += new MyBox.LeaveHandler(Boxes_Leave);
            this.boxes[2].Leave += new MyBox.LeaveHandler(Boxes_Leave);

            this.selectableSlider.ItemHover += new EventHandler<NITE.IndexEventArgs>(selectableSlider_ItemHover);
            this.selectableSlider.ItemSelect += new EventHandler<NITE.IndexDirectionEventArgs>(selectableSlider_ItemSelect);
            this.selectableSlider.PrimaryPointCreate += new EventHandler<NITE.HandFocusEventArgs>(selectableSlider_PrimaryPointCreate);
            this.selectableSlider.PrimaryPointDestroy += new EventHandler<NITE.IdEventArgs>(selectableSlider_PrimaryPointDestroy);

            this.sessionManager.SessionStart += new EventHandler<NITE.PositionEventArgs>(sessionManager_SessionStart);

            this.sessionManager.AddListener(this.flowRouter);

            this.shouldRun = true;
            this.readerThread = new Thread(ReaderThread);
            this.readerThread.Start();
        }
Пример #2
0
        /// <summary>
        /// Creates a new instance of SensorData with the specified configuration file.
        /// </summary>
        /// <param name="configuration">Configuration file path.</param>
        public SensorData(string configuration)
        {
            InitializeCamera(configuration);
            InitializeBitmaps();
            InitializeThread();

            //New flow router
            this.flowRouter = new NITE.FlowRouter();

            this.boxes = new MyBox("Box1");
            this.boxes.Leave += new MyBox.LeaveHandler(boxes_Leave);
            this.boxes.Update += new MyBox.UpdateHandler(boxes_Update);
            this.sessionManager.AddListener(this.flowRouter);
            this.sessionManager.SessionStart += new EventHandler<NITE.PositionEventArgs>(sessionManager_SessionStart);
            Console.WriteLine("Initialized Sensor Data");

            this.DepthGenerator.AlternativeViewpointCapability.SetViewpoint(this.ImageGenerator);
            this.userGenerator = new UserGenerator(this.Context);
            this.skeletonCapbility = this.userGenerator.SkeletonCapability;
            this.poseDetectionCapability = this.userGenerator.PoseDetectionCapability;
            this.calibPose = this.skeletonCapbility.CalibrationPose;
            this.poseDetectionCapability.PoseDetected += poseDetectionCapability_PoseDetected;
            this.skeletonCapbility.CalibrationComplete += skeletonCapbility_CalibrationComplete;

            this.skeletonCapbility.SetSkeletonProfile(SkeletonProfile.All);
            this.joints = new Dictionary<int, Dictionary<SkeletonJoint, SkeletonJointPosition>>();

            this.userGenerator.NewUser += userGenerator_NewUser;
            this.userGenerator.LostUser += userGenerator_LostUser;
            this.userGenerator.StartGenerating();
        }