private void gestureRecognitionBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!isRecognition)
            {
                if (gesture_recognizer == null)
                {
                    gesture_recognizer = new GestureRecognizer();
                }

                if (!gesture_recognizer.LoadGestureDatabase(GESTURE_DATABASE_DIR))
                {
                    MessageBox.Show("No gesture database found for recognition.");
                    return;
                }

                UpdateGestureComboBox();

                // can't replay since share same gesture buffer
                DeactivateReplay();
                gestureReplayBtn.IsEnabled = false;

                // start kinect
                if (kinect_sensor == null)
                    return;

                if (!kinect_sensor.IsRunning)
                    kinect_sensor.Start();

                isRecognition = true;
                gestureCaptureBtn.IsEnabled = false;
                previewBtn.IsEnabled = false;

                // can't edit gesture
                add_gesture_btn.IsEnabled = false;
                remove_gesture_btn.IsEnabled = false;
                gestureRecognitionBtn.Content = "Stop Recognition";
            }
            else
            {
                kinect_sensor.Stop();

                isRecognition = false;
                recDistLabel.Content = 0;
                gestureCaptureBtn.IsEnabled = true;
                previewBtn.IsEnabled = true;

                //enable gesture editing
                add_gesture_btn.IsEnabled = true;
                remove_gesture_btn.IsEnabled = true;
                gestureRecognitionBtn.Content = "Start Recognition";
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // do initialization here
            gesture_recognizer = new GestureRecognizer();
            motion_assessor = new MotionAssessor();
            toMeasureUnits = new List<MeasurementUnit>();

            // init kinect
            if (!InitKinect())
            {
                statusbarLabel.Content = "Kinect not connected";
                MessageBox.Show("Kinect not found.");
            }
            else
                statusbarLabel.Content = "Kinect initialized";

            DeactivateReplay();

            // load gesture config and update ui
            gesture_recognizer.LoadAllGestureConfig();
            UpdateGestureComboBox();
        }