private void resetButton_Click(object sender, EventArgs e)
 {
     Gestures.resetGestureInfo();
     Gestures.saveData();
     Gestures.loadData(Gestures.getPath());
     LoadTable();
 }
        private void editBindingButton_Click(object sender, EventArgs e)
        {
            // returns a string form of the given keybinding or
            // null if no text was inputted to the text box;
            //usage:
            using (KeyBindForm keyForm = new KeyBindForm())
            {
                if (DialogResult.OK == keyForm.ShowDialog())
                {
                    string gestureName = keyForm.getGestureName();
                    string appName     = keyForm.getAppName();

                    if (keyForm.getKeyBind() != null && keyForm.getKeyBind().Trim() != "" &&
                        keyForm.getGestureName() != null && keyForm.getAppName() != null)
                    {
                        Gestures.setAppKeyForGesture(gestureName, appName, keyForm.getKeyBind());
                        Gestures.saveData();
                        gestureDataGridView.Hide();
                        gestureDataGridView.Controls.Clear();
                        LoadTable();
                        gestureDataGridView.Show();
                    }
                    //label1.Text = mainForm.getKeyBind();
                }
                else
                {
                    //nothing was found
                }
            }
        }
Exemple #3
0
        private void startButton_Click(object sender, EventArgs e)
        {
            SynchronizationContext ctx = SynchronizationContext.Current;


            // Save the new gesture name to gestureInfoNew.data
            string name = gestureName.Text;

            Gestures.addNewGesture(name);
            Gestures.saveData(GestureStudio.GesturesDataPathNew);
            Gestures.loadData(GestureStudio.GesturesDataPathNew);

            // Count down 5.
            int countDown = 5;

            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Interval = 1000;
            timer.Tick    += (o, src) =>
            {
                countDown--;
                ctx.Post((state) =>
                {
                    this.countDownLabel.Text = countDown.ToString();
                }, null);

                if (countDown == 0)
                {
                    this.OnStart();
                    timer.Stop();
                    countDown = 5;
                    this.countDownLabel.Text = countDown.ToString();
                    this.gestureName.Text    = "Name of the new gesture.";
                }
            };

            timer.Start();
        }