VixenModules.App.Curves.CurveEditor.buttonSaveCurveToLibrary_Click C# (CSharp) Méthode

buttonSaveCurveToLibrary_Click() private méthode

private buttonSaveCurveToLibrary_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Résultat void
        private void buttonSaveCurveToLibrary_Click(object sender, EventArgs e)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Curve name?");

            while (dialog.ShowDialog() == DialogResult.OK) {
                if (dialog.Response == string.Empty) {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("Please enter a name.", "Curve Name", false, false);
                    messageBox.ShowDialog();
                    continue;
                }

                if (Library.Contains(dialog.Response)) {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Question; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("There is already a curve with that name. Do you want to overwrite it?", "Overwrite curve?", true, true);
                    messageBox.ShowDialog();
                    if (messageBox.DialogResult == DialogResult.OK) {
                        Library.AddCurve(dialog.Response, new Curve(Curve));
                        break;
                    }
                    if (messageBox.DialogResult == DialogResult.Cancel) {
                        break;
                    }
                }
                else {
                    Library.AddCurve(dialog.Response, new Curve(Curve));
                    break;
                }
            }
        }