Exemple #1
0
        public static DialogResult Show(string title, string message, DialogBoxIcon icon, DialogBoxButtons buttons)
        {
            if (ThundershockPlatform.IsPlatform(Platform.Windows))
            {
                var mainWindow = Process.GetCurrentProcess().MainWindowHandle;

                var type = icon switch
                {
                    DialogBoxIcon.Information => MB_ICONINFORMATION,
                    DialogBoxIcon.Warning => MB_ICONWARNING,
                    DialogBoxIcon.Question => MB_ICONQUESTION,
                    DialogBoxIcon.Error => MB_ICONSTOP,
                    _ => MB_ICONINFORMATION
                } | buttons switch
Exemple #2
0
        public static DialogBoxResult Show(IWin32Window owner, string text, string caption = "", DialogButton[] buttons = null, DialogBoxIcon icon = DialogBoxIcon.None, string title = null, int defaultButton = 1, int timeOut = 0, DialogBoxTimeoutResult timeoutResult = DialogBoxTimeoutResult.Timeout, int disable = 0)
        {
            DialogBoxForm dg = new DialogBoxForm()
            {
                Title         = title,
                Message       = text,
                Caption       = caption,
                Image         = icon,
                DefaultButton = defaultButton,
                Timeout       = timeOut,
                TimeoutResult = timeoutResult,
                Disable       = disable,
            };

            if (buttons == null)
            {
                buttons = new DialogButton[] { new DialogButton("Ok", DialogBoxResult.Ok) }
            }
            ;

            foreach (DialogButton btn in buttons)
            {
                dg.AddButton(btn.Text, btn.Result);
            }

            return(dg.ShowDialog(owner));
        }
Exemple #3
0
        public static DialogBoxResult Show(IWin32Window owner, string text, string caption = "", DialogBoxButtons buttons = DialogBoxButtons.Ok, DialogBoxIcon icon = DialogBoxIcon.None, string title = null, int defaultButton = 1, int timeOut = 0, DialogBoxTimeoutResult timeoutResult = DialogBoxTimeoutResult.Timeout, int disable = 0)
        {
            DialogBoxForm dg = new DialogBoxForm()
            {
                Title         = title,
                Message       = text,
                Caption       = caption,
                Image         = icon,
                DefaultButton = defaultButton,
                Timeout       = timeOut,
                TimeoutResult = timeoutResult,
                Disable       = disable,
            };

            dg.AddButtons(buttons);

            return(dg.ShowDialog(owner));
        }
Exemple #4
0
 public static DialogBoxResult Show(string text, string caption = "", DialogButton[] buttons = null, DialogBoxIcon icon = DialogBoxIcon.None, string title = null, int defaultButton = 1, int timeOut = 0, DialogBoxTimeoutResult timeoutResult = DialogBoxTimeoutResult.Timeout, int disable = 0)
 {
     return(Show(null, text, caption, buttons, icon, title, defaultButton, timeOut, timeoutResult, disable));
 }
Exemple #5
0
 public static DialogBoxResult Show(IWin32Window owner, string title, string text, string caption = "", DialogBoxButtons buttons = DialogBoxButtons.Ok, DialogBoxIcon icon = DialogBoxIcon.None, int defaultButton = 1, int timeOut = 0, DialogBoxTimeoutResult timeoutResult = DialogBoxTimeoutResult.Timeout, int disable = 0)
 {
     return(Show(owner, text, caption, buttons, icon, title, defaultButton, timeOut, timeoutResult, disable));
 }