private void button1_Click(object sender, RoutedEventArgs e)
 {
     if (gesture == null)
     {
         gesture = new GenericOnePoint(gestureIndex++);
         gesture.Initialize(txtGestureName.Text, (JointType)cmbPoinType.SelectedItem, Int32.Parse(txtNumOfStates.Text));
         kinect.RegisterGesture(gesture);
         button1.Content = "Reset (clear) capture";
     }
     else
     {
         //todo: realy unregister gesture from kinnect
         gesture = null;
         button1.Content = "Start new capture";
         sequencesList.Items.Clear();
     }
 }
        private void button6_Click(object sender, RoutedEventArgs e)
        {
            // Configure open file dialog box
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName = ""; // Default file name
            dlg.DefaultExt = ".gdf"; // Default file extension
            dlg.Filter = "Gesture definition (.gdf)|*.gdf"; // Filter files by extension

            // Show open file dialog box
            Nullable<bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                string filename = dlg.FileName;
                gesture = new GenericOnePoint(gestureIndex++);
                gesture.LoadData(filename);
                kinect.RegisterGesture(gesture);
                txtPropThre.Text = gesture.ProbabilityThreshold.ToString();
                txtGestureName.Text = gesture.Name;
                txtGestureLength.Text = gesture.AproxLength.ToString();
                foreach (JointType item in Enum.GetValues(typeof(JointType)))
                {
                    if (gesture.UseJoint(item))
                    {
                        cmbPoinType.SelectedItem = item;
                        break;
                    }
                }
                button1.Content = "Reset capture";
            }
        }