Esempio n. 1
0
        private void SelectButtons()
        {
            if (Buttons == null)
            {
                switch (MessageBoxButtons)
                {
                case MessageBoxButtons.AbortRetryIgnore:
                    Buttons = new MessageFormButton[]
                    {
                        new MessageFormButton("&Abort", DialogResult.Abort, true, false),
                        new MessageFormButton("&Retry", DialogResult.Retry),
                        new MessageFormButton("&Ignore", DialogResult.Ignore)
                    };
                    break;

                case MessageBoxButtons.OK:
                    Buttons = new MessageFormButton[]
                    {
                        new MessageFormButton("OK", DialogResult.OK, true, true)
                    };
                    break;

                case MessageBoxButtons.OKCancel:
                    Buttons = new MessageFormButton[]
                    {
                        new MessageFormButton("OK", DialogResult.OK, true, false),
                        new MessageFormButton("Cancel", DialogResult.Cancel, false, true)
                    };
                    break;

                case MessageBoxButtons.RetryCancel:
                    Buttons = new MessageFormButton[]
                    {
                        new MessageFormButton("&Retry", DialogResult.Retry, true, false),
                        new MessageFormButton("Cancel", DialogResult.Cancel, false, true)
                    };
                    break;

                case MessageBoxButtons.YesNo:
                    Buttons = new MessageFormButton[]
                    {
                        new MessageFormButton("&Yes", DialogResult.Yes, true, false),
                        new MessageFormButton("&No", DialogResult.No)
                    };
                    break;

                case MessageBoxButtons.YesNoCancel:
                    Buttons = new MessageFormButton[]
                    {
                        new MessageFormButton("&Yes", DialogResult.Yes, true, false),
                        new MessageFormButton("&No", DialogResult.No),
                        new MessageFormButton("Cancel", DialogResult.Cancel, false, true)
                    };
                    break;

                default:
                    throw new Exception("Cannot understand MessageBoxButtons");
                }
            }
        }
Esempio n. 2
0
        private void SelectButtons()
        {
            if (Buttons == null)
            {
                switch (MessageBoxButtons)
                {
                    case MessageBoxButtons.AbortRetryIgnore:
                        Buttons = new MessageFormButton[]
                        {
                            new MessageFormButton("&Abort", DialogResult.Abort, true, false),
                            new MessageFormButton("&Retry", DialogResult.Retry),
                            new MessageFormButton("&Ignore", DialogResult.Ignore)
                        };
                        break;

                    case MessageBoxButtons.OK:
                        Buttons = new MessageFormButton[]
                        {
                            new MessageFormButton("OK", DialogResult.OK, true, true)
                        };
                        break;

                    case MessageBoxButtons.OKCancel:
                        Buttons = new MessageFormButton[]
                        {
                            new MessageFormButton("OK", DialogResult.OK, true, false),
                            new MessageFormButton("Cancel", DialogResult.Cancel, false, true)
                        };
                        break;

                    case MessageBoxButtons.RetryCancel:
                        Buttons = new MessageFormButton[]
                        {
                            new MessageFormButton("&Retry", DialogResult.Retry, true, false),
                            new MessageFormButton("Cancel", DialogResult.Cancel, false, true)
                        };
                        break;

                    case MessageBoxButtons.YesNo:
                        Buttons = new MessageFormButton[]
                        {
                            new MessageFormButton("&Yes", DialogResult.Yes, true, false),
                            new MessageFormButton("&No", DialogResult.No)
                        };
                        break;

                    case MessageBoxButtons.YesNoCancel:
                        Buttons = new MessageFormButton[]
                        {
                            new MessageFormButton("&Yes", DialogResult.Yes, true, false),
                            new MessageFormButton("&No", DialogResult.No),
                            new MessageFormButton("Cancel", DialogResult.Cancel, false, true)
                        };
                        break;

                    default:
                        throw new Exception("Cannot understand MessageBoxButtons");
                }
            }
        }