예제 #1
0
 public void SaveGesture()
 {
     if (isCalibration && _calPointer < gestureList.Count)
     {
         _gestureData[gestureList[_calPointer]] = gr.Save();
         _calPointer += 1;
     }
 }
예제 #2
0
        private void SaveProfileButton_Click(object sender, EventArgs e)
        {
            bool overwrite = false;

            if (profileName != null)
            {
                DialogResult result = MessageBox.Show("Would you like to overwrite the existing profile named \"" + profileName + "\"", "Overwrite Existing Profile?", MessageBoxButtons.YesNoCancel);
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                else if (result == DialogResult.Yes)
                {
                    overwrite = true;
                    Directory.Delete(Path.Combine("savedProfiles", profileName), true);
                }
            }

            if (!overwrite)
            {
                PromptDialog dialog = new PromptDialog("Enter Profile Name", "Save");
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    if (Directory.Exists(Path.Combine("savedProfiles", dialog.Value)))
                    {
                        if (MessageBox.Show("A profile with that name already exists. Would you like to overwrite it?", "Confirm overwrite profile", MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
                        {
                            return;
                        }
                        Directory.Delete(Path.Combine("savedProfiles", dialog.Value), true);
                    }

                    profileName = dialog.Value;
                }
            }

            Task.Factory.StartNew(() =>
            {
                Localization.Instance.Save(profileName);
                Logging.LogOtherEvent("Save Location Profile");

                if (Properties.Settings.Default.IncludeGesturesInProfile)
                {
                    GestureRecognition.Save(profileName);
                    Logging.LogOtherEvent("Save Gesture Profile");
                }

                Debug.WriteLine("Finished Saving");

                IsSaved = true;
            });
        }