예제 #1
0
            public PopUpButtons(PopUpButtonsType buttons, PopUpResult defaultButton)
                : this(buttons)
            {
                switch (defaultButton)
                {
                case PopUpResult.Btn1:     //cancel
                    btn1.IsDefault = true;
                    btn2.IsDefault = false;
                    btn3.IsDefault = false;
                    break;

                case PopUpResult.Btn2:
                    btn1.IsDefault = false;
                    btn2.IsDefault = true;
                    btn3.IsDefault = false;
                    break;

                case PopUpResult.Btn3:
                    btn1.IsDefault = false;
                    btn2.IsDefault = false;
                    btn3.IsDefault = true;
                    break;

                case PopUpResult.None:
                default:
                    btn1.IsDefault = false;
                    btn2.IsDefault = false;
                    btn3.IsDefault = false;
                    break;
                }
            }
예제 #2
0
            public PopUpButtons(string btn1text, string btn2text, string btn3text, PopUpResult defaultButton = PopUpResult.Btn3)
                : this(PopUpButtonsType.CancelNoYes, defaultButton)
            {
                ButtonsType    = 0;
                btn1.IsVisible = !string.IsNullOrWhiteSpace(btn1text);
                if (btn1.IsVisible)
                {
                    btn1.Text   = btn1text;
                    ButtonsType = (PopUpButtonsType)((int)ButtonsType | 4);
                }

                btn2.IsVisible = !string.IsNullOrWhiteSpace(btn2text);
                if (btn2.IsVisible)
                {
                    btn2.Text   = btn2text;
                    ButtonsType = (PopUpButtonsType)((int)ButtonsType | 2);
                }

                btn3.IsVisible = !string.IsNullOrWhiteSpace(btn3text);
                if (btn3.IsVisible)
                {
                    btn3.Text   = btn3text;
                    ButtonsType = (PopUpButtonsType)((int)ButtonsType | 1);
                }
            }
예제 #3
0
        public static PopUpResult InputBox(ref string userInput, string title,
                                           MessageBoxImage icon         = MessageBoxImage.Information, TextAlignment textAlignment = TextAlignment.Justify,
                                           PopUpButtonsType buttonsType = PopUpButtonsType.CancelOK, int timeout                   = Timeout.Infinite)
        {
            PopUpButtons buttons = new PopUpButtons(buttonsType);

            string      message = userInput;
            PopUpResult res     = WPF_Helper.ExecuteOnUIThread(() =>
            {
                return(MessageWindowExtension.MessageBox(null,
                                                         ref message, title,
                                                         icon, textAlignment,
                                                         buttons, timeout,
                                                         false));
            });

            userInput = message;
            return(res);
        }