Пример #1
0
        public void Show(ButtonsType btntype, string msg)
        {
            var md = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, btntype, msg);

            md.Run();
            md.Destroy();
        }
Пример #2
0
        public void Show(DialogFlags flags, MessageType msgtype, ButtonsType btntype, string msg)
        {
            var md = new MessageDialog(null, flags, msgtype, btntype, msg);

            md.Run();
            md.Destroy();
        }
Пример #3
0
        public static ResponseType Show(string message, MessageType type, ButtonsType bType, bool AddCancel)
        {
            MessageDialog md = new MessageDialog(null, DialogFlags.Modal, type, bType, message);
            switch (type)
            {
                case MessageType.Error:
                    md.Title = "Error";
                    break;

                case MessageType.Info:
                    md.Title = "Info";
                    break;

                case MessageType.Other:
                    md.Title = "Message";
                    break;

                case MessageType.Question:
                    md.Title = "Question";
                    break;

                case MessageType.Warning:
                    md.Title = "Warning";
                    break;
            }
            if (AddCancel) { md.AddButton("Cancel", ResponseType.Cancel); }
			md.WindowPosition = WindowPosition.CenterOnParent;
            ResponseType result = (ResponseType)md.Run();
            md.Destroy();
            return result;
        }
Пример #4
0
        MsgBoxResult SafeMsgBox(string prompt, string title,
                                MsgBoxStyle buttons)
        {
            MsgBoxResult result   = MsgBoxResult.Cancel;
            ButtonsType  buttons2 = Convert(buttons);
            EventHandler dlgt     = delegate {
                var dlg = new MessageDialog(_parent, DialogFlags.Modal,
                                            MessageType.Question, buttons2, prompt + "  [ " + GetDefaultString(buttons) + " ]");
                var dflt = GetDefaultResponse(buttons);
                dlg.DefaultResponse = dflt;
                while (true)
                {
                    var resultG = (Gtk.ResponseType)dlg.Run();
                    result = Convert(resultG);
                    bool isYN = (result == MsgBoxResult.Yes || result == MsgBoxResult.No);
                    bool isC  = (result == MsgBoxResult.Cancel);
                    if (isYN ||
                        (Enum_FlagEquals(buttons, MsgBoxStyle.YesNoCancel) &&
                         isC)
                        )
                    {
                        break;
                    }
                }//while
                dlg.Destroy();
            };

            SafeInvoke(this.tb, dlgt);
            return(result);
        }
Пример #5
0
        protected static void Message(Window parentWindow, MessageType pMessageType, ButtonsType pButtonsType, string pMessage)
        {
            var md = new MessageDialog(parentWindow, DialogFlags.Modal, pMessageType, pButtonsType, pMessage);

            md.Run();
            md.Destroy();
        }
Пример #6
0
        // Message box
        public static ResponseType ShowMessageBox(Window parent,
            MessageType mtype,
            ButtonsType buttons,
            string title,
            string message,
            params string[] args)
        {
            MessageDialog msgDlg =
                new MessageDialog(parent,
                                  DialogFlags.Modal,
                                  mtype,
                                  buttons,
                                  message,
                                  args);
            msgDlg.Title = title;
            msgDlg.UseMarkup = false;

            ResponseType response = ResponseType.None;
            msgDlg.Response += (object o, ResponseArgs args2) =>
            {
                msgDlg.Destroy();
                response = args2.ResponseId;
            };
            msgDlg.Run();
            return response;
        }
Пример #7
0
        public static ResponseType Show(string message, MessageType type, ButtonsType bType)
        {
            MessageDialog md = new MessageDialog(null, DialogFlags.Modal, type, bType, message);

            switch (type)
            {
            case MessageType.Error:
                md.Title = "Error";
                break;

            case MessageType.Info:
                md.Title = "Info";
                break;

            case MessageType.Other:
                md.Title = "Message";
                break;

            case MessageType.Question:
                md.Title = "Question";
                break;

            case MessageType.Warning:
                md.Title = "Warning";
                break;
            }
            md.WindowPosition = WindowPosition.CenterOnParent;
            ResponseType result = (ResponseType)md.Run();

            md.Destroy();
            return(result);
        }
Пример #8
0
 public static ResponseType show(Window parent_window, DialogFlags dialogFlags, MessageType messageType, ButtonsType buttonsType,string  message)
 {
     _dlg = new MessageDialog (parent_window, dialogFlags,messageType, buttonsType, message);
     ResponseType response = (ResponseType) _dlg.Run ();
     _dlg.Destroy ();
     return response;
 }
Пример #9
0
        public static void Show(string msg, string title, ButtonsType buttons, MessageType type)
        {
            MessageDialog md = new MessageDialog(null, DialogFlags.Modal, type, buttons, msg);

            md.Title = title;
            md.Run();
            md.Destroy();
        }
Пример #10
0
        public static ResponseType Show(Window window, string message, ButtonsType buttons, MessageType type)
        {
            var md     = new MessageDialog(window, DialogFlags.DestroyWithParent, type, buttons, false, message);
            var result = (ResponseType)md.Run();

            md.Destroy();
            return(result);
        }
Пример #11
0
    /// <summary>
    /// Display a popup message window
    /// </summary>tLev
    /// <param name="type">Type of popup window (question, error, information,...)</param>
    /// <param name="buttons">Buttons available on popup window</param>
    /// <param name="title">Title of window</param>
    /// <param name="message">Message</param>
    private void MessagePopup(MessageType type, ButtonsType buttons, string title, string message)
    {
        MessageDialog md = new MessageDialog(this, DialogFlags.DestroyWithParent, type, buttons, message);

        md.Title = title;
        md.Run();
        md.Destroy();
    }
Пример #12
0
        void ShowMessageDialog(string title, string message, MessageType msgType, ButtonsType btnType)
        {
            MessageDialog md = new MessageDialog(null, DialogFlags.Modal, msgType, btnType, message);

            md.Title = title;
            md.Run();
            md.Destroy();
        }
Пример #13
0
        public static void Show(Gtk.Window parrent_window, DialogFlags flag, MessageType msgtype,
                                ButtonsType btntype, string msg)
        {
            MessageDialog md = new MessageDialog(parrent_window, flag, msgtype, btntype, msg);

            md.Run();
            md.Destroy();
        }
Пример #14
0
        private void Show(MessageDialogType type, string caption, string text, ButtonsType buttons, Action <ResponseType> callback)
        {
            Application.Invoke(delegate {
                using var dialog = CreateMessageDialog(type, caption, text, buttons);

                ResponseType result = (ResponseType)dialog.Run();
                dialog.Hide();
                callback.Invoke(result);
            });
Пример #15
0
        //Envía un mensaje en un cuadro de diálogo personalizado.
        public ResponseType Mensaje(string Msj, ButtonsType Tb, MessageType Tm, string titulo)
        {
            MessageDialog Men       = new MessageDialog(Ven, DialogFlags.DestroyWithParent, Tm, Tb, Msj);
            ResponseType  Respuesta = (ResponseType)Men.Run();

            Men.Title = titulo;
            Men.Destroy();
            return(Respuesta);
        }
Пример #16
0
 private static void ShowGeneric(string message, object[] args, MessageType messageType, ButtonsType buttonsType)
 {
     var dlg = CreateDialog(message, args, messageType, buttonsType);
     dlg.Response += (sender, e) =>
     {
         dlg.Destroy();
     };
     dlg.ShowAll();
 }
Пример #17
0
        public BaseMessageDialog(Window parent, string msg, DialogFlags flags,
            MessageType mtype, ButtonsType btype, bool wrap)
        {
            dialog = new MessageDialog(parent, flags, mtype, btype, GLib.Markup.EscapeText(msg));

            try {
                ((Label)((Container)((Container)dialog.VBox.Children[0]).Children[1]).Children[0]).Wrap = wrap;
            } catch { }
        }
Пример #18
0
        public ResponseType Mensaje(string Msj, ButtonsType Tb, MessageType Tm)
        {
            MessageDialog Dialogo = new MessageDialog(this, DialogFlags.DestroyWithParent, Tm, Tb, Msj);

            Dialogo.ModifyBg(StateType.Normal, Est.LigthSteelBlue);
            ResponseType Respuesta = (ResponseType)Dialogo.Run();

            Dialogo.Destroy();
            return(Respuesta);
        }
Пример #19
0
    private ResponseType Message(string text, string title, MessageType MType, ButtonsType Buttons, bool Markup = false)
    {
        var Dialog = new MessageDialog(this, DialogFlags.DestroyWithParent, MType, Buttons, Markup, text);

        Dialog.Title = title;
        var Response = (ResponseType)Dialog.Run();

        Dialog.Destroy();
        return(Response);
    }
Пример #20
0
 /// <summary>
 /// Creates a new message box
 /// </summary>
 /// <param name="parentWindow">Window this box belongs to</param>
 /// <param name="messageType">Type of box</param>
 /// <param name="buttons">Buttons</param>
 /// <param name="message">Value</param>
 /// <param name="title">Title</param>
 public MessageBox(Window parentWindow, MessageType messageType, ButtonsType buttons, string message, string title)
 {
     Message = new MessageDialog(parentWindow, DialogFlags.Modal, messageType, buttons, false, null);
     Message.WindowPosition = WindowPosition.Center;
     Message.Text = message;
     Message.Icon = Gdk.Pixbuf.LoadFromResource("Client.Resources.pigeon_clip_art_hight.ico");
     Message.Title = title;
     result = (ResponseType)Message.Run();
     Message.Destroy();
 }
        public static int InfoDialog(Window parent, ButtonsType button, string text)
        {
            MessageDialog dialog = new MessageDialog(parent, DialogFlags.DestroyWithParent, MessageType.Info,
                                                     button, text);
            int result = dialog.Run();

            dialog.Destroy();

            return(result);
        }
        public async Task <ButtonsResult> ShowWithButtons(string title, string text, ButtonsType buttonsType,
                                                          int?timeShow = 5000)
        {
            var w = new NotificationWindow();

            switch (buttonsType)
            {
            case ButtonsType.Ok:
                w.DataContext = new NotificationWindowViewModel(title, text, w, NotificationType.Ok);
                break;

            case ButtonsType.YesNo:
                w.DataContext = new NotificationWindowViewModel(title, text, w, NotificationType.YesNo);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(buttonsType), buttonsType, null);
            }

            w.Closed += delegate { Reposition(); };
            w.Show();
            Add(w);
            if (timeShow != null)
            {
                await Task.Run(async() =>
                {
                    for (int i = 0; i < timeShow / 100; i++)
                    {
                        await Task.Delay(100);
                        if (w.IsClosed)
                        {
                            break;
                        }
                    }
                });

                if (!w.IsClosed)
                {
                    w.Close();
                }
            }
            else
            {
                while (true)
                {
                    await Task.Delay(100);

                    if (w.IsClosed)
                    {
                        break;
                    }
                }
            }
            return(w.ButtonsResult);
        }
Пример #23
0
    int MsgBox(string text, string title, MessageType msgtype, ButtonsType buttontype)
    {
        var dialog = new MessageDialog(this, DialogFlags.Modal, msgtype, buttontype, text);

        dialog.Title = title;
        dialog.Show();
        int result = dialog.Run();

        dialog.Destroy();
        return(result);
    }
Пример #24
0
        public static ResponseType Show(Window parentWindow, DialogFlags flags, MessageType type, ButtonsType bt, bool useMarkup, string title, string format, params object[] args)
        {
            if (args == null)
                args = new object[0];

            MessageDialog md = new MessageDialog(parentWindow, flags, type, bt, useMarkup, format, args);
            md.Title = title;
            int result = md.Run();
            md.Destroy();
            return (ResponseType)result;
        }
Пример #25
0
    public static Gtk.ResponseType  Show(Gtk.Window window, Gtk.DialogFlags dialogflags,
                                         MessageType msgType, ButtonsType btnType, string Message, String caption)
    {
        MessageDialog md = new MessageDialog(window, dialogflags, msgType, btnType, Message);

        md.Title = caption;
        ResponseType tp = (Gtk.ResponseType)md.Run();

        md.Destroy();
        return(tp);
    }            //end  Show
Пример #26
0
        private GtkDialog(string title, string mainText, string secondaryText,
                          MessageType messageType = MessageType.Other, ButtonsType buttonsType = ButtonsType.Ok) : base(null, DialogFlags.Modal, messageType, buttonsType, null)
        {
            Title          = title;
            Icon           = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png");
            Text           = mainText;
            SecondaryText  = secondaryText;
            WindowPosition = WindowPosition.Center;
            Response      += GtkDialog_Response;

            SetSizeRequest(100, 20);
        }
Пример #27
0
 protected ResponseType ShowMessageBox(string formatMessage, ButtonsType buttons,
                                       MessageType msgType, string fileName)
 {
     using (var messageBox = new MessageDialog(m_dlg, DialogFlags.Modal,
                                               msgType, buttons, formatMessage, fileName))
     {
         messageBox.Title = Title;
         int retVal = messageBox.Run();
         messageBox.Destroy();
         return((ResponseType)retVal);
     }
 }
Пример #28
0
        private static ResponseType MessageBox(string texto, string titulo, ButtonsType tipoBotao, MessageType tipoMsg)
        {
            MessageDialog dialog = new MessageDialog(null,
                                                     DialogFlags.Modal | DialogFlags.DestroyWithParent,
                                                     tipoMsg, tipoBotao, texto);

            dialog.Title = titulo;
            dialog.SetPosition(WindowPosition.Center);
            ResponseType retorno = (ResponseType)dialog.Run();

            dialog.Destroy();
            return(retorno);
        }
Пример #29
0
    private void ShowMessageBox(string message, MessageType type)
    {
        ButtonsType   buttons = type == MessageType.Error ? ButtonsType.Close : ButtonsType.Ok;
        MessageDialog msg     = new MessageDialog(
            this,
            DialogFlags.Modal,
            type,
            buttons,
            message
            );

        msg.Run();
        msg.Destroy();
    }
Пример #30
0
        /// <summary>
        /// Show the specified text, caption, _Buttons and _Type.
        /// </summary>
        /// <param name='text'>
        /// Text.
        /// </param>
        /// <param name='caption'>
        /// Caption.
        /// </param>
        /// <param name='_Buttons'>
        /// The Buttons of the MessageDialog
        /// </param>
        /// <param name='_Type'>
        /// The Type of the MessageDialog.
        /// </param>
        public static ResponseType Show(string text, string caption, ButtonsType _Buttons = ButtonsType.Ok, MessageType _Type = MessageType.Info, Gdk.Window parent = null)
        {
            if (text.Contains ("not set")) {
                cLogger.Log (text, new StackTrace ().GetFrame (0).GetMethod ().Name);
                return ResponseType.None;
            } else {
                MessageDialog md = new MessageDialog (null, DialogFlags.Modal, _Type, _Buttons, text);
                md.Title = caption;
                ResponseType result = (ResponseType)md.Run ();
                md.Destroy ();
                return result;

            }
        }
Пример #31
0
        public static ResponseType Show(Window parent, MessageType msgtype, ButtonsType buttontype, string format, params object[] args)
        {
            if (parent == null && ComponentManager != null)
            {
                parent = ComponentManager;
            }
            MessageDialog md = new MessageDialog(parent, DialogFlags.Modal, msgtype, buttontype, format, args);

            if (Platform.IsWindows) // replace Gtk's private icons by Windows standard icons
            {
                switch (msgtype)
                {
                case MessageType.Info:     ((Gtk.Image)md.Image).Pixbuf = PIXBUF_INFO;     break;

                case MessageType.Warning:  ((Gtk.Image)md.Image).Pixbuf = PIXBUF_WARNING;  break;

                case MessageType.Question: ((Gtk.Image)md.Image).Pixbuf = PIXBUF_QUESTION; break;

                case MessageType.Error:    ((Gtk.Image)md.Image).Pixbuf = PIXBUF_ERROR;    break;
                }
            }

            md.SetPosition(parent == null ? WindowPosition.Center : WindowPosition.CenterOnParent);
            if (ComponentManager != null)
            {
                md.Title = ComponentManager.ApplicationName;
                md.Icon  = ComponentManager.Icon;
            }
            else
            {
                md.Title = "";
                md.Icon  = null;
            }

            // localize button texts
            foreach (Gtk.Widget w in md.ActionArea.Children)
            {
                Gtk.Button b = w as Gtk.Button;
                if (b != null)
                {
                    b.Label = b.Label.Localized("Docking.Components");
                }
            }

            ResponseType result = (ResponseType)md.Run();

            md.Destroy();
            return(result);
        }
Пример #32
0
    public static MessageBox Show(string text, ButtonsType type, ButtonHandler button1 = null, ButtonHandler button2 = null, ButtonHandler button3 = null)
    {
        MessageBox bx = Utils.CreateObjectWithScript <MessageBox>();

        if (type == ButtonsType.AbortRetryIgnore)
        {
            bx.Width = 3;
        }
        bx.Text           = text;
        bx.Type           = type;
        bx.OnButton1Click = button1;
        bx.OnButton2Click = button2;
        bx.OnButton3Click = button3;
        return(bx);
    }
Пример #33
0
		public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, bool use_markup, string format, params object[] args)
		{
			IntPtr p = (parent_window != null) ? parent_window.Handle : IntPtr.Zero;

			if (format == null) {
				Raw = gtk_message_dialog_new (p, flags, type, bt, IntPtr.Zero, IntPtr.Zero);
				return;
			}

			IntPtr nmsg = GLib.Marshaller.StringToPtrGStrdup (GLib.Marshaller.StringFormat (format, args));
			if (use_markup)
				Raw = gtk_message_dialog_new_with_markup (p, flags, type, bt, nmsg, IntPtr.Zero);
			else
				Raw = gtk_message_dialog_new (p, flags, type, bt, nmsg, IntPtr.Zero);
			GLib.Marshaller.Free (nmsg);
		}
Пример #34
0
 /// <summary>
 /// Show the specified text, caption, _Buttons and _Type.
 /// </summary>
 /// <param name='text'>
 /// Text.
 /// </param>
 /// <param name='caption'>
 /// Caption.
 /// </param>
 /// <param name='_Buttons'>
 /// The Buttons of the MessageDialog
 /// </param>
 /// <param name='_Type'>
 /// The Type of the MessageDialog.
 /// </param>
 public static ResponseType Show(string text, string caption, ButtonsType _Buttons = ButtonsType.Ok, MessageType _Type = MessageType.Info, Gdk.Window parent = null)
 {
     if (text.Contains("not set"))
     {
         cLogger.Log(text, new StackTrace().GetFrame(0).GetMethod().Name);
         return(ResponseType.None);
     }
     else
     {
         MessageDialog md = new MessageDialog(null, DialogFlags.Modal, _Type, _Buttons, text);
         md.Title = caption;
         ResponseType result = (ResponseType)md.Run();
         md.Destroy();
         return(result);
     }
 }
Пример #35
0
        public static bool RunWarningDialog(string title, string warning, ButtonsType buttons = ButtonsType.YesNo)
        {
            MessageDialog md = new MessageDialog(null,
                                                 DialogFlags.Modal,
                                                 MessageType.Warning,
                                                 buttons,
                                                 warning);

            md.SetPosition(WindowPosition.Center);
            md.Title = title;
            md.ShowAll();
            bool result = md.Run() == (int)ResponseType.Yes;

            md.Destroy();
            return(result);
        }
Пример #36
0
        protected override void OnUpdate()
        {
            _input = World.GetExistingSystem <InputSystem>();
            var physicsWorld = World.GetExistingSystem <PhysicsWorldSystem>().PhysicsWorld;

            if (InputUtil.GetInputUp(_input))
            {
                float2 pos    = CameraUtil.ScreenPointToWorldPoint(World, InputUtil.GetInputPosition(_input));
                Entity entity = DrawBordersSystem.GetInputEntity(physicsWorld, pos);
                if (entity == Entity.Null)
                {
                    return;
                }
                ButtonsType buttonsType = EntityManager.GetComponentData <ButtonsComponent>(entity).ButtonsType;
                Button(buttonsType);
            }
        }
Пример #37
0
        private static void SetButtonText(string text, ButtonsType type, MessageDialog messageDialog)
        {
            string gtkLabel = string.Empty;

            switch (type)
            {
            case ButtonsType.Ok:
                gtkLabel = "gtk-ok";
                break;

            case ButtonsType.Cancel:
                gtkLabel = "gtk-cancel";
                break;
            }

            var buttonsBox = messageDialog.GetDescendants()
                             .OfType <HButtonBox>()
                             .FirstOrDefault();

            if (buttonsBox == null)
            {
                return;
            }

            var targetButton = buttonsBox.GetDescendants()
                               .OfType <Gtk.Button>()
                               .FirstOrDefault(x => x.Label == gtkLabel);

            if (targetButton == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(text))
            {
                targetButton.Hide();
            }
            else
            {
                targetButton.Label = text;
            }
        }
Пример #38
0
        public static ResponseType ShowMessageBox(string message, string title, ButtonsType buttonsType, MessageType messageType)
        {
            MessageDialog dialog = null;

            try
            {
                dialog = new MessageDialog(GetForegroundWindow(), DialogFlags.Modal, messageType, buttonsType,
                                           false, "{0}", message);
                dialog.Title = title;
                dialog.SetPosition(WindowPosition.CenterOnParent);
                return((ResponseType)dialog.Run());
            }
            finally
            {
                if (dialog != null)
                {
                    dialog.Destroy();
                }
            }
        }
Пример #39
0
        private void Button(ButtonsType buttonsType)
        {
            Debug.Log("ButtonButtonButtonButtonButton");
            Entity mainEntity = GetSingletonEntity <GamePrefabsComponent>();

            EntityManager.AddComponent <InputActivationComponent>(mainEntity);
            EntityManager.DestroyEntity(_checkResultSystem.WindowEntity);
            int currentLevel = GetSingleton <CurrentLevelComponent>().Level;

            RemoveCurrentLevelEntity();
            switch (buttonsType)
            {
            case ButtonsType.Next:
                ButtonNext(currentLevel, mainEntity);
                break;

            case ButtonsType.Restart:
                ButtonRestart(currentLevel, mainEntity);
                break;
            }
        }
Пример #40
0
 public static ResponseType Show(Window parentWindow, MessageType type, ButtonsType bt, string title, string format)
 {
     return Show(parentWindow, type, bt, title, format, null);
 }
Пример #41
0
 public static ResponseType Show(Window parentWindow, MessageType type, ButtonsType bt, string title, string format, params object[] args)
 {
     return Show(parentWindow, DialogFlags.Modal | DialogFlags.DestroyWithParent, type, bt, false, title, format, args);
 }
Пример #42
0
 /// <summary>
 /// Display a new message box
 /// </summary>
 /// <param name="parentWindow">Window this box belongs to</param>
 /// <param name="messageType">Type of box</param>
 /// <param name="buttons">Buttons</param>
 /// <param name="message">Message</param>
 /// <param name="title">Title</param>
 /// <returns></returns>
 public static MessageBox Show(Window parentWindow, MessageType messageType, ButtonsType buttons, string message, string title)
 {
     MessageBox mb = new MessageBox(parentWindow, messageType, buttons, message, title);
     return mb;
 }
Пример #43
0
 public static ResponseType Show(Window window, string message, ButtonsType buttons, MessageType type) {
     var md = new MessageDialog(window, DialogFlags.DestroyWithParent, type, buttons, false, message);
     var result = (ResponseType) md.Run();
     md.Destroy();
     return result;
 }
Пример #44
0
 private static Gtk.MessageDialog CreateDialog(string message, object[] args, MessageType messageType, ButtonsType buttonsType)
 {
     var dlg = new Gtk.MessageDialog(null, DialogFlags.Modal, messageType, buttonsType, message, args);
     dlg.Title = "xCom - CamManager needs your attention";
     return dlg;
 }
Пример #45
0
 public InfoDialog(Window parent, string msg, ButtonsType type)
     : base(parent, msg, DialogFlags.DestroyWithParent, MessageType.Info, type)
 {
 }
Пример #46
0
 public static ResponseType Show(MessageType msgtype, ButtonsType buttontype, string s)
 {
     return Show(null, msgtype, buttontype, "{0}", s);
 }
Пример #47
0
 public static ResponseType Show(MessageType msgtype, ButtonsType buttontype, string format, params object[] args)
 {
     return Show(null, msgtype, buttontype, format, args);
 }
Пример #48
0
		public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, string format, params object[] args) : this (parent_window, flags, type, bt, true, format, args) {}
Пример #49
0
        //--------------------//

        #region MessageDialog
        /// <summary>Displays a message using a <see cref="MessageDialog"/>.</summary>
        /// <param name="owner">The parent window the displayed window is modal to; can be <c>null</c>.</param>
        /// <param name="text">The message to be displayed.</param>
        /// <param name="severity">How severe/important the message is.</param>
        /// <param name="buttons">The buttons the user can click.</param>
        /// <param name="addCancel">Add an additional "Cancel" button.</param>
        private static ResponseType ShowMessageDialog([CanBeNull] Window owner, [NotNull, Localizable(true)] string text, MsgSeverity severity, ButtonsType buttons, bool addCancel = false)
        {
            // Select icon based on message severity
            MessageType type;
            switch (severity)
            {
                case MsgSeverity.Warn:
                    type = MessageType.Warning;
                    break;
                case MsgSeverity.Error:
                    type = MessageType.Error;
                    break;
                default:
                case MsgSeverity.Info:
                    type = buttons.HasFlag(ButtonsType.YesNo) ? MessageType.Question : MessageType.Info;
                    break;
            }

            // Display MessageDialog
            using (var dialog = new MessageDialog(owner, DialogFlags.Modal, type, buttons, text))
            {
                if (addCancel) dialog.AddButton(Stock.Cancel, 2);
                dialog.Title = AppInfo.Current.ProductName;
                var response = (ResponseType)dialog.Run();
                dialog.Destroy();
                return response;
            }
        }
Пример #50
0
		static extern IntPtr gtk_message_dialog_new_with_markup (IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, IntPtr msg, IntPtr args);
Пример #51
0
		protected ResponseType ShowMessageBox(string formatMessage, ButtonsType buttons,
			MessageType msgType, string fileName)
		{
			using (var messageBox = new MessageDialog(m_dlg, DialogFlags.Modal,
				msgType, buttons, formatMessage, fileName))
			{
				messageBox.Title = Title;
				int retVal = messageBox.Run();
				messageBox.Destroy();
				return (ResponseType)retVal;
			}
		}
Пример #52
0
	public static void Show(Gtk.Window parent_window, DialogFlags flags, MessageType msgtype, ButtonsType btntype, string msg) 
    { 
        MessageDialog md = new MessageDialog (parent_window, flags, msgtype, btntype, msg); 
        md.Run (); 
        md.Destroy(); 
    } 
Пример #53
0
        public static ResponseType Show(Window parent, MessageType msgtype, ButtonsType buttontype, string format, params object[] args)
        {
            if(ComponentManager!=null && !ComponentManager.IsMainThread)
            throw new Exception("message boxes may only be popped up from the main GUI thread, i.e., they need a surrounding Gtk.Application.Invoke(delegate {}); block");

             if(ComponentManager!=null)
            ComponentManager.MessageWriteLine(format, args);

             #region treat batch mode case
             if(ComponentManager!=null && ComponentManager.OperateInBatchMode && ComponentManager.Visible==false)
             {
            switch(buttontype)
            {
            case ButtonsType.None:
               ComponentManager.MessageWriteLine("[NONE]");
               return ResponseType.None;

            case ButtonsType.Ok:
               ComponentManager.MessageWriteLine("[OK]");
               return ResponseType.Ok;

            case ButtonsType.Close:
               ComponentManager.MessageWriteLine("[CLOSE]");
               return ResponseType.Close;

            case ButtonsType.Cancel:
               ComponentManager.MessageWriteLine("[CANCEL]");
               return ResponseType.Cancel;

            case ButtonsType.YesNo:
               throw new Exception("sorry, but a yes/no messagebox cannot be decided in batch mode :(");

            case ButtonsType.OkCancel:
               #if true
               throw new Exception("are we sure here we want an automatic [OK] click in batch mode???");
               #else
               // be BOLD and assume an automated "OK" in script mode???? hmmm........... might be dangerous.....
               // "Do you really want to delete the internet? [OK]/[CANCEL]"......
               ComponentManager.MessageWriteLine("[OK]");
               return ResponseType.Ok;
               #endif
            }
            throw new Exception("unknown message box button type");
             }
             #endregion

             if(parent==null && ComponentManager!=null)
            parent = ComponentManager;
             MessageDialog md = new MessageDialog(parent, DialogFlags.Modal, msgtype, buttontype, format, args);

             if(Platform.IsWindows) // replace Gtk's private icons by Windows standard icons
             {
            switch(msgtype)
            {
            case MessageType.Info:     ((Gtk.Image) md.Image).Pixbuf = PIXBUF_INFO;     break;
            case MessageType.Warning:  ((Gtk.Image) md.Image).Pixbuf = PIXBUF_WARNING;  break;
            case MessageType.Question: ((Gtk.Image) md.Image).Pixbuf = PIXBUF_QUESTION; break;
            case MessageType.Error:    ((Gtk.Image) md.Image).Pixbuf = PIXBUF_ERROR;    break;
            }
             }

             md.SetPosition(parent==null ? WindowPosition.Center : WindowPosition.CenterOnParent);
             if(ComponentManager!=null)
             {
            md.Title = ComponentManager.ApplicationName;
            md.Icon  = ComponentManager.Icon;
             }
             else
             {
            md.Title = "";
            md.Icon  = null;
             }

             // localize button texts
             foreach(Gtk.Widget w in md.ActionArea.Children)
             {
            Gtk.Button b = w as Gtk.Button;
            if(b!=null)
               b.Label = b.Label.Localized("Docking.Components");
             }

             ResponseType result = (ResponseType) md.Run();
             md.Destroy();
             return result;
        }
Пример #54
0
        public static ResponseType Show(string message, string title, MessageType type, ButtonsType bType, bool AddCancel)
        {
            MessageDialog md = new MessageDialog(null, DialogFlags.Modal, type, bType, message);
            md.Title = title;
			md.WindowPosition = WindowPosition.CenterOnParent;
            if (AddCancel) { md.AddButton("Cancel", ResponseType.Cancel); }
            ResponseType result = (ResponseType)md.Run();
            md.Destroy();
            return result;
        }
Пример #55
0
	protected void showErrorDialog( MessageType typeOfMessage, ButtonsType typeOfButtons, string errorMessage )
	{
		MessageDialog errorDialog = new MessageDialog ( null, DialogFlags.Modal, typeOfMessage, typeOfButtons, errorMessage);
		errorDialog.Run ();
		errorDialog.Destroy ();
	}
Пример #56
0
 /// <summary>
 /// shows an modal info message dialog with given buttons
 /// </summary>
 /// <returns>
 /// The info message.
 /// </returns>
 /// <param name='message'>
 /// Message.
 /// </param>
 /// <param name='parent'>
 /// Parent.
 /// </param>
 /// <param name='buttonstype'>
 /// Buttonstype.
 /// </param>
 public static ResponseType ShowInfoMessage(String message, Gtk.Window parent, ButtonsType buttonstype)
 {
     return ShowMessage(message, parent,Gtk.DialogFlags.Modal,MessageType.Info,buttonstype);
 }
Пример #57
0
        /// <summary>
        /// show a message dialog
        /// </summary>
        /// <returns>
        /// The message.
        /// </returns>
        /// <param name='message'>
        /// Message.
        /// </param>
        /// <param name='parent'>
        /// Parent.
        /// </param>
        /// <param name='flags'>
        /// Flags.
        /// </param>
        /// <param name='messagetype'>
        /// Messagetype.
        /// </param>
        /// <param name='buttonstype'>
        /// Buttonstype.
        /// </param>
        public static ResponseType ShowMessage(String message, Gtk.Window parent, Gtk.DialogFlags flags,Gtk.MessageType messagetype,ButtonsType buttonstype)
        {
            var dialog = new MessageDialog(parent,flags,messagetype,buttonstype,message,new object[0]);

            try
            {
                int res = dialog.Run ();
                return (ResponseType)res;
            }
            finally
            {
                dialog.Destroy();
            }
        }
 static extern IntPtr gtk_message_dialog_new(IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, string msg, IntPtr args);
Пример #59
0
 public BaseMessageDialog(Window parent, string msg, DialogFlags flags,
     MessageType mtype, ButtonsType btype)
     : this(parent, msg, flags, mtype, btype, false)
 {
 }