Skybound.Gecko.PromptService.ConfirmEx C# (CSharp) Méthode

ConfirmEx() public méthode

public ConfirmEx ( nsIDOMWindow aParent, string aDialogTitle, string aText, uint aButtonFlags, string aButton0Title, string aButton1Title, string aButton2Title, string aCheckMsg, bool &aCheckState ) : int
aParent nsIDOMWindow
aDialogTitle string
aText string
aButtonFlags uint
aButton0Title string
aButton1Title string
aButton2Title string
aCheckMsg string
aCheckState bool
Résultat int
        public int ConfirmEx(nsIDOMWindow aParent, string aDialogTitle, string aText, uint aButtonFlags, string aButton0Title, string aButton1Title, string aButton2Title, string aCheckMsg, ref bool aCheckState)
        {
            string [] buttons = new String[3];
            string [] titles = { aButton0Title, aButton1Title, aButton2Title };

            for (int i = 0; i < 3; i++)
            {
                uint flags = (aButtonFlags >> (i * 8)) & 0xFF;
                switch (flags)
                {
                    case nsIPromptServiceConstants.BUTTON_TITLE_CANCEL: buttons[i] = "Cancel"; break;
                    case nsIPromptServiceConstants.BUTTON_TITLE_DONT_SAVE: buttons[i] = "&Don't Save"; break;
                    case nsIPromptServiceConstants.BUTTON_TITLE_NO: buttons[i] = "No"; break;
                    case nsIPromptServiceConstants.BUTTON_TITLE_OK: buttons[i] = "OK"; break;
                    case nsIPromptServiceConstants.BUTTON_TITLE_REVERT: buttons[i] = "&Revert"; break;
                    case nsIPromptServiceConstants.BUTTON_TITLE_SAVE: buttons[i] = "&Save"; break;
                    case nsIPromptServiceConstants.BUTTON_TITLE_YES: buttons[i] = "Yes"; break;
                    case nsIPromptServiceConstants.BUTTON_TITLE_IS_STRING:
                        buttons[i] = titles[i];
                        break;
                }
            }

            ConfirmDialog dialog = new ConfirmDialog(aText, aDialogTitle, buttons[0], buttons[1], buttons[2], aCheckMsg);

            DialogResult result = dialog.ShowDialog();

            aCheckState = dialog.CheckBoxChecked;

            if (result == (DialogResult)1)
                return 0;
            else if (result == (DialogResult)2)
                return 1;
            else if (result == (DialogResult)3)
                return 2;

            return 0;
        }