public MainWindow()
        {
            InitializeComponent();

            // データバインド
            coordinates = new ThreeDimensionalCoordinates();
            this.chartX.DataContext = coordinates;
            this.chartY.DataContext = coordinates;
            this.chartZ.DataContext = coordinates;

            // test
            coordinates.X.Add(new ViewModel.CoordinateWithFrame(0.5, 1));
            coordinates.X.Add(new ViewModel.CoordinateWithFrame(0.6, 2));
            coordinates.X.Add(new ViewModel.CoordinateWithFrame(0.2, 3));
            coordinates.X.Add(new ViewModel.CoordinateWithFrame(0.8, 4));
            coordinates.X.Add(new ViewModel.CoordinateWithFrame(0.1, 5));

            i = 6;
            this.randomAdd();


            kinect = KinectSensor.GetDefault();
            if (kinect == null)
            {
                throw new Exception("Kinectを開けませんでした。");
            }

            kinect.Open();
            bodyFrameReader = kinect.BodyFrameSource.OpenReader();
            bodyFrameReader.FrameArrived += bodyFrameReader_FrameArrived;

            //this.DataContext = new 
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();


            this.isReading = false;
            // データバインド
            coordinates             = new ThreeDimensionalCoordinates();
            this.chartX.DataContext = coordinates;
            this.chartY.DataContext = coordinates;
            this.chartZ.DataContext = coordinates;

            // JointType
            foreach (JointType joint in Enum.GetValues(typeof(JointType)))
            {
                this.jointsComboBox.Items.Add(joint.ToString());
            }

            /*
             * // test
             * coordinates.X.Add(new ViewModel.CoordinateWithFrame(0.5, 1));
             * coordinates.X.Add(new ViewModel.CoordinateWithFrame(0.6, 2));
             * coordinates.X.Add(new ViewModel.CoordinateWithFrame(0.2, 3));
             * coordinates.X.Add(new ViewModel.CoordinateWithFrame(0.8, 4));
             * coordinates.X.Add(new ViewModel.CoordinateWithFrame(0.1, 5));
             */
            // Init Kinect
            kinect = KinectSensor.GetDefault();
            if (kinect == null)
            {
                throw new Exception("Kinectを開けませんでした。");
            }

            kinect.Open();
            this.bodies     = new Body[kinect.BodyFrameSource.BodyCount];
            bodyFrameReader = kinect.BodyFrameSource.OpenReader();
            bodyFrameReader.FrameArrived += bodyFrameReader_FrameArrived;
        }