Пример #1
0
 private void ResetGesturesButton_Click(object sender, EventArgs e)
 {
     Logging.LogOtherEvent("Reset Gestures");
     training = true;
     GestureRecognition.Reset();
     training = false;
     UpdateGestureList();
 }
Пример #2
0
        private void LoadProfileButton_Click(object sender, EventArgs e)
        {
            List <string> profiles = new List <string>();

            foreach (string dir in Directory.GetDirectories("savedProfiles"))
            {
                profiles.Add((new DirectoryInfo(dir)).Name);
            }
            if (profiles.Contains("default"))
            {
                profiles.Remove("default");
            }
            if (profiles.Count == 0)
            {
                MessageBox.Show("Error: no saved profiles!");
                return;
            }
            SelectFromListDialog dialog = new SelectFromListDialog("Select Saved Profile", "Load", profiles);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                profileName = dialog.SelectedItem;

                training = true;

                Task.Factory.StartNew(() =>
                {
                    if (Properties.Settings.Default.OverwriteExistingSamples)
                    {
                        Localization.Instance.Reset();
                    }
                    Localization.Instance.Load(dialog.SelectedItem);
                    Logging.LogOtherEvent("Load Location Profile: " + dialog.SelectedItem);

                    //if (Properties.Settings.Default.IncludeGesturesInProfile)
                    {
                        if (Properties.Settings.Default.OverwriteExistingSamples)
                        {
                            GestureRecognition.Reset();
                        }
                        GestureRecognition.Load(dialog.SelectedItem, enableSingleTap: Properties.Settings.Default.EnableSingleTap, enableSwipeDown: Properties.Settings.Default.EnableSwipeDown, isDefault: true);
                        Logging.LogOtherEvent("Load Gesture Profile: " + dialog.SelectedItem);
                    }
                    training = false;

                    UpdateLists();

                    IsSaved = true;
                });
            }
        }