Example #1
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);
        }
Example #2
0
        /// <summary>
        /// Show Message Box, using main app window(WinForms or WPF) as owner,
        /// If btn*text is null will assign text by 'buttons'
        /// </summary>
        /// <param name="GetOwnerOnUIThread">function that returns WPF UIElement to center on, wull be executed on UI thread, can be null</param>
        /// <param name="message"></param>
        /// <param name="title"></param>
        /// <param name="icon"></param>
        /// <param name="textAlignment"></param>
        /// <param name="buttons"></param>
        /// <param name="timeout">execute default action after timeout if more than 100 milliseconds</param>
        /// <returns></returns>
        public static PopUpResult MessageBox(Func <UIElement> GetOwnerOnUIThread, string message, string title,
                                             MessageBoxImage icon, TextAlignment textAlignment = TextAlignment.Center,
                                             PopUpButtons buttons = null, int timeout = Timeout.Infinite)
        {
            if (buttons == null)
            {
                buttons = new PopUpButtons(PopUpButtonsType.OK);
            }

            return(WPF_Helper.ExecuteOnUIThread(() =>
            {
                UIElement owner = null;
                if (GetOwnerOnUIThread != null)
                {
                    owner = GetOwnerOnUIThread();
                }

                return MessageWindowExtension.MessageBox(owner,
                                                         ref message, title,
                                                         icon, textAlignment,
                                                         buttons, timeout,
                                                         true);
            }));
        }
Example #3
0
 private void Start()
 {
     popupButton = GetComponent <PopUpButtons>();
     ReadyText   = ClearPopUp.GetComponentInChildren <Text>().text;
 }