public void loadExperience()
        {
            if (getNewExperienceView().Rows.Count > 0)
            {
                // Prompt user (ask if they want to save ()
                if (this.NewExperienceTableModified)
                {
                    DialogResult result = MessageBox.Show("New Experience been modified. Would you like to save?", "Save Results",
                                                          MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        // Save Before Entering the Loading Panel
                        SaveExpDlg saveExpDlg = new SaveExpDlg(this, true);
                    }
                    else if (result == DialogResult.No)
                    {
                        clearAvailableExperienceItems();
                        // Replace the "New Route" Text with "Load Route" Text
                        // Add a child window for loading a route from the DB
                        experienceLabel.Text = "Load Experience";

                        LoadExperienceDlg loadExpDlg = new LoadExperienceDlg(this);
                    }
                }
            }
            else
            {
                clearAvailableExperienceItems();
                // Replace the "New Route" Text with "Load Route" Text
                // Add a child window for loading a route from the DB
                experienceLabel.Text = "Load Experience";

                LoadExperienceDlg loadExpDlg = new LoadExperienceDlg(this);
            }
        }
コード例 #2
0
        public async void saveBtnClickedHelper()
        {
            bool exists = await checkIfRouteExists(this.newExperienceNameTxtbox.Text);

            // If Route Exists, prompt user to override
            if (exists == true)
            {
                // IF user OK's override,
                // Get Name from Textbox and save route to database
                DialogResult result = MessageBox.Show("Experience " + this.newExperienceNameTxtbox.Text + "Already Exists in Database. Override?", "Override?",
                                                      MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
                if (result == DialogResult.Yes)
                {
                    this.parentForm.saveNewExperience(this.newExperienceNameTxtbox.Text);
                    DialogResult dialogRes = MessageBox.Show("Experience " + this.newExperienceNameTxtbox.Text + " has been saved", "Saved",
                                                             MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (dialogRes == DialogResult.OK)
                    {
                        parentForm.clearAvailableExperienceItems();
                        if (andLoad)
                        {
                            parentForm.clearAvailableExperienceItems();
                            // Replace the "New Route" Text with "Load Route" Text
                            // Add a child window for loading a route from the DB
                            parentForm.experienceLabel.Text = "Load Experience";

                            LoadExperienceDlg loadExpDlg = new LoadExperienceDlg(this.parentForm);
                        }
                        this.Close();
                        return;
                    }
                }
                return;
            }
            else
            {
                this.parentForm.saveNewExperience(this.newExperienceNameTxtbox.Text);
                DialogResult result = MessageBox.Show("Experience " + this.newExperienceNameTxtbox.Text + " has been saved", "Saved",
                                                      MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (result == DialogResult.OK)
                {
                    parentForm.clearAvailableExperienceItems();
                    this.Close();
                    if (andLoad)
                    {
                        parentForm.clearAvailableExperienceItems();
                        // Replace the "New Route" Text with "Load Route" Text
                        // Add a child window for loading a route from the DB
                        parentForm.experienceLabel.Text = "Load Experience";

                        LoadExperienceDlg loadExpDlg = new LoadExperienceDlg(this.parentForm);
                    }
                    return;
                }
            }
        }