Exemplo n.º 1
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            GtkAlertDialog alertDialog = new GtkAlertDialog(message);

            alertDialog.FocusButton(message.DefaultButton);
            var wb  = (IGtkWidgetBackend)WidgetRegistry.GetBackend(transientFor);
            var win = wb != null ? (Gtk.Window)wb.Widget : null;

            MessageService.ShowCustomDialog(alertDialog, win);
            if (alertDialog.ApplyToAll)
            {
                ApplyToAll = true;
            }
            var res = alertDialog.ResultButton;

            if (res == null)
            {
                // If the dialog is closed clicking the close window button we may have no result.
                // In that case, try to find a cancelling button
                if (message.Buttons.Contains(Command.Cancel))
                {
                    return(Command.Cancel);
                }
                else if (message.Buttons.Contains(Command.No))
                {
                    return(Command.No);
                }
                else if (message.Buttons.Contains(Command.Close))
                {
                    return(Command.Close);
                }
            }
            return(res);
        }
Exemplo n.º 2
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            GtkAlertDialog alertDialog = new GtkAlertDialog(context, message);

            alertDialog.FocusButton(message.DefaultButton);
            var win = context.Toolkit.GetNativeWindow(transientFor) as Gtk.Window;

            MessageService.ShowCustomDialog(alertDialog, win);
            if (alertDialog.ApplyToAll)
            {
                ApplyToAll = true;
            }
            var res = alertDialog.ResultButton;

            if (res == null)
            {
                // If the dialog is closed clicking the close window button we may have no result.
                // In that case, try to find a cancelling button
                if (message.Buttons.Contains(Command.Cancel))
                {
                    return(Command.Cancel);
                }
                else if (message.Buttons.Contains(Command.No))
                {
                    return(Command.No);
                }
                else if (message.Buttons.Contains(Command.Close))
                {
                    return(Command.Close);
                }
            }
            return(res);
        }
Exemplo n.º 3
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            GtkAlertDialog alertDialog = new GtkAlertDialog (message);
            alertDialog.FocusButton (message.DefaultButton);
            var wb = (WindowFrameBackend)Toolkit.GetBackend (transientFor);
            var win = wb != null ? wb.Window : null;
            MessageService.ShowCustomDialog (alertDialog, win);
            if (alertDialog.ApplyToAll)
                ApplyToAll = true;
            var res = alertDialog.ResultButton;

            if (res == null) {
                // If the dialog is closed clicking the close window button we may have no result.
                // In that case, try to find a cancelling button
                if (message.Buttons.Contains (Command.Cancel))
                    return Command.Cancel;
                else if (message.Buttons.Contains (Command.No))
                    return Command.No;
                else if (message.Buttons.Contains (Command.Close))
                    return Command.Close;
            }
            return res;
        }