VixenModules.App.Curves.CurveLibrarySelector.buttonNewCurve_Click C# (CSharp) Method

buttonNewCurve_Click() private method

private buttonNewCurve_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void buttonNewCurve_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());
                        Library.EditLibraryCurve(dialog.Response);
                        PopulateListWithCurves();
                        break;
                    }
                    if (messageBox.DialogResult == DialogResult.Cancel)
                    {
                        break;
                    }
                }
                else
                {
                    Library.AddCurve(dialog.Response, new Curve());
                    Library.EditLibraryCurve(dialog.Response);
                    PopulateListWithCurves();
                    break;
                }
            }
        }