示例#1
0
        private void CmdOK_Click(object sender, System.EventArgs e)
        {
            ClsAddOns MyAna = new ClsAddOns();

            DialogResult TheResult = DialogResult.None;

            if (TxtCommandAddEdit.Text == "" || TxtNameAddEdit.Text == "")
            {
                MessageBox.Show("No Changes Made " + "\n" + "\n" + "Cause: " + "Empty Field(s) Found"
                                + "\n" + "Solution: " + "Fill Both Field(s)" + "\n", "Error !",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            FileInfo CheckIfExists = new FileInfo(MyAna.AnalyzeIt(TxtCommandAddEdit.Text));

            if (!CheckIfExists.Exists)
            {
                string TheMessage =
                    "Sorry.. But We Found That The Command You Just Entered Is Not Valid" + "\n" +
                    "\"The File Does Not Exist\"" + "\n" + "\n" +
                    "Please Use The Following" + "\n" + "\n" +
                    "Press \"Abort\" if You Want To Cancel The Whole Operation And Return To The Main Window" + "\n" +
                    "Press \"Retry\" To Correct This Error And Enter A Valid Path" + "\n" +
                    "Press \"Ignore\" If You Are An Advanced User Who Knows What He Is Doing !" + "\n" + "\n" +
                    "Thank You";

                TheResult = MessageBox.Show
                                (TheMessage, "Action Needed Here", MessageBoxButtons.AbortRetryIgnore,
                                MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            switch (TheResult)
            {
            case    DialogResult.Ignore:
                this.Cmd_Test.PerformClick();
                break;

            case DialogResult.Abort:
                this.CmdCancel.PerformClick();
                break;

            default:
                this.Cmd_Test.PerformClick();
                break;
            }
        }