public DialogBoxAction Show(string msg, MessageBoxActions buttons) { Window parent = null; IDesktopView view = DesktopApplication.View; ResponseType messageDialogResponse = 0; if (buttons == MessageBoxActions.YesNoCancel) { throw new Exception("Button YesNoCancel not supported by GTK.ButtonsType"); } if(view != null && view is DesktopView) { parent = ((DesktopView)view).MainWindow; } MessageDialog mb = new MessageDialog(parent, DialogFlags.DestroyWithParent, MessageType.Info, _buttonMap[(int)buttons], msg); messageDialogResponse = (ResponseType)mb.Run(); mb.Destroy(); return (DialogBoxAction)_resultMap[messageDialogResponse]; }
/// <summary> /// Displays a message box. /// </summary> /// <remarks> /// Override this method if you need to customize the display of message boxes. /// </remarks> /// <param name="message"></param> /// <param name="buttons"></param> /// <param name="title"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, string title, MessageBoxActions buttons) { if (ApplicationContext.Current != null) { MessageBoxEntityHandler handler = EntityHandler.Create <MessageBoxEntityHandler>(); handler.SetModelObject(this); MessageBox box = handler.GetEntity(); box.Message = message; box.Title = title; switch (buttons) { case MessageBoxActions.Ok: box.Actions = WebMessageBoxActions.Ok; _result = DialogBoxAction.Ok; break; case MessageBoxActions.OkCancel: box.Actions = WebMessageBoxActions.OkCancel; _result = DialogBoxAction.Ok; break; case MessageBoxActions.YesNo: box.Actions = WebMessageBoxActions.YesNo; _result = DialogBoxAction.Yes; break; case MessageBoxActions.YesNoCancel: box.Actions = WebMessageBoxActions.YesNoCancel; _result = DialogBoxAction.Yes; break; } MessageBoxShownEvent @event = new MessageBoxShownEvent { Identifier = box.Identifier, MessageBox = box, SenderId = ApplicationContext.Current.ApplicationId, }; ApplicationContext.Current.FireEvent(@event); IWebSynchronizationContext context = (SynchronizationContext.Current as IWebSynchronizationContext); if (context != null) { context.RunModal(); } return(_result); } return(DialogBoxAction.Ok); }
public static DialogBoxAction ShowMessageBox(string message, MessageBoxActions buttons) { // create message box if does not exist if (_messageBox == null) { lock (_syncRoot) { if (_messageBox == null) { MessageBoxExtensionPoint xp = new MessageBoxExtensionPoint(); _messageBox = (IMessageBox)xp.CreateExtension(); } } } // must lock here, because we have no guarantee that the underlying _messageBox object is thread-safe // lock on the _messageBox itself, rather than _syncRoot, so that _syncRoot is free for other threads to lock on // (i.e the message box may block this thread for a long time, and all other threads would halt if we locked on _syncRoot) lock (_messageBox) { return(_messageBox.Show(message, buttons)); } }
public DialogBoxAction Show(string msg, MessageBoxActions buttons) { Window parent = null; IDesktopView view = DesktopApplication.View; ResponseType messageDialogResponse = 0; if (buttons == MessageBoxActions.YesNoCancel) { throw new Exception("Button YesNoCancel not supported by GTK.ButtonsType"); } if (view != null && view is DesktopView) { parent = ((DesktopView)view).MainWindow; } MessageDialog mb = new MessageDialog(parent, DialogFlags.DestroyWithParent, MessageType.Info, _buttonMap[(int)buttons], msg); messageDialogResponse = (ResponseType)mb.Run(); mb.Destroy(); return((DialogBoxAction)_resultMap[messageDialogResponse]); }
/// <summary> /// Shows a message box in front of this window. /// </summary> /// <param name="message">The message to show in the message box.</param> /// <param name="title">The title of the message box.</param> /// <param name="buttons">The buttons to display in the message box.</param> /// <returns>The button the user selected to dismiss the message box.</returns> public DialogBoxAction ShowMessageBox(string message, string title, MessageBoxActions buttons) { AssertState(new[] { DesktopObjectState.Open, DesktopObjectState.Closing }); return(this.DesktopWindowView.ShowMessageBox(message, title, buttons)); }
/// <summary> /// Shows a message box in the associated desktop window. /// </summary> /// <param name="message"></param> /// <param name="buttons"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, MessageBoxActions buttons) { return(this.DesktopWindow.ShowMessageBox(message, this.Title, buttons)); }
/// <summary> /// Shows a message box using the application name as the title. /// </summary> /// <remarks> /// It is preferable to use one of the <b>ClearCanvas.Desktop.DesktopWindow.ShowMessageBox</b> /// methods if a desktop window is available, since they will ensure that the message box window is /// associated with the parent desktop window. This method is provided for situations where a /// message box needs to be displayed prior to the creation of any desktop windows. /// </remarks> /// <param name="message">The message to display.</param> /// <param name="actions">The actions that the user may take.</param> /// <returns>The resulting action taken by the user.</returns> /// <seealso cref="ClearCanvas.Desktop.DesktopWindow.ShowMessageBox(string, MessageBoxActions)"/> /// <seealso cref="ClearCanvas.Desktop.DesktopWindow.ShowMessageBox(string, string, MessageBoxActions)"/> public static DialogBoxAction ShowMessageBox([param: Localizable(true)] string message, MessageBoxActions actions) { return(_instance.View.ShowMessageBox(message, actions)); }
/// <summary> /// Shows a message box in front of this window. /// </summary> /// <param name="message">The message to show in the message box.</param> /// <param name="buttons">The buttons to display in the message box.</param> /// <returns>The button the user selected to dismiss the message box.</returns> public DialogBoxAction ShowMessageBox(string message, MessageBoxActions buttons) { return(this.DesktopWindowView.ShowMessageBox(message, null, buttons)); }
/// <summary> /// Displays a message box. /// </summary> /// <remarks> /// Override this method if you need to customize the display of message boxes. /// </remarks> /// <param name="message"></param> /// <param name="actions"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, MessageBoxActions actions) { MessageBox mb = new MessageBox(); return(mb.Show(message, actions)); }
/// <summary> /// Shows a message box in the associated desktop window. /// </summary> /// <param name="message"></param> /// <param name="buttons"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox([param: Localizable(true)] string message, MessageBoxActions buttons) { return(this.DesktopWindow.ShowMessageBox(message, this.Title, buttons)); }
/// <summary> /// Displays a message box. /// </summary> /// <remarks> /// Override this method if you need to customize the display of message boxes. /// </remarks> /// <param name="message"></param> /// <param name="title"> </param> /// <param name="buttons"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, string title, MessageBoxActions buttons) { var mb = new MessageBox(); return mb.Show(message, title, buttons, _form); }
/// <summary> /// Displays a message box. /// </summary> /// <remarks> /// Override this method if you need to customize the display of message boxes. /// </remarks> /// <param name="message"></param> /// <param name="actions"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, MessageBoxActions actions) { return DialogBoxAction.Ok; }
/// <summary> /// Displays a message box. /// </summary> /// <remarks> /// Override this method if you need to customize the display of message boxes. /// </remarks> /// <param name="message"></param> /// <param name="actions"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, MessageBoxActions actions) { return(DialogBoxAction.Ok); }
/// <summary> /// Displays a message box. /// </summary> /// <remarks> /// Override this method if you need to customize the display of message boxes. /// </remarks> /// <param name="message"></param> /// <param name="buttons"></param> /// <param name="title"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, string title, MessageBoxActions buttons) { if (ApplicationContext.Current != null) { MessageBoxEntityHandler handler = EntityHandler.Create<MessageBoxEntityHandler>(); handler.SetModelObject(this); MessageBox box = handler.GetEntity(); box.Message = message; box.Title = title; switch (buttons) { case MessageBoxActions.Ok: box.Actions = WebMessageBoxActions.Ok; _result = DialogBoxAction.Ok; break; case MessageBoxActions.OkCancel: box.Actions = WebMessageBoxActions.OkCancel; _result = DialogBoxAction.Ok; break; case MessageBoxActions.YesNo: box.Actions = WebMessageBoxActions.YesNo; _result = DialogBoxAction.Yes; break; case MessageBoxActions.YesNoCancel: box.Actions = WebMessageBoxActions.YesNoCancel; _result = DialogBoxAction.Yes; break; } MessageBoxShownEvent @event = new MessageBoxShownEvent { Identifier = box.Identifier, MessageBox = box, SenderId = ApplicationContext.Current.ApplicationId, }; ApplicationContext.Current.FireEvent(@event); IWebSynchronizationContext context = (SynchronizationContext.Current as IWebSynchronizationContext); if (context != null) context.RunModal(); return _result; } return DialogBoxAction.Ok; }
/// <summary> /// Shows a message box using the application name as the title. /// </summary> /// <remarks> /// It is preferable to use one of the <b>ClearCanvas.Desktop.DesktopWindow.ShowMessageBox</b> /// methods if a desktop window is available, since they will ensure that the message box window is /// associated with the parent desktop window. This method is provided for situations where a /// message box needs to be displayed prior to the creation of any desktop windows. /// </remarks> /// <param name="message">The message to display.</param> /// <param name="actions">The actions that the user may take.</param> /// <returns>The resulting action taken by the user.</returns> /// <seealso cref="ClearCanvas.Desktop.DesktopWindow.ShowMessageBox(string, MessageBoxActions)"/> /// <seealso cref="ClearCanvas.Desktop.DesktopWindow.ShowMessageBox(string, string, MessageBoxActions)"/> public static DialogBoxAction ShowMessageBox(string message, MessageBoxActions actions) { return(_instance.View.ShowMessageBox(message, actions)); }
/// <summary> /// Shows a message box in the associated desktop window. /// </summary> /// <param name="message"></param> /// <param name="buttons"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox([param : Localizable(true)] string message, MessageBoxActions buttons) { return this.DesktopWindow.ShowMessageBox(message, this.Title, buttons); }
/// <summary> /// Displays a message box. /// </summary> /// <remarks> /// Override this method if you need to customize the display of message boxes. /// </remarks> /// <param name="message"></param> /// <param name="title"> </param> /// <param name="buttons"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, string title, MessageBoxActions buttons) { var mb = new MessageBox(); return(mb.Show(message, title, buttons, _form)); }
/// <summary> /// Shows a message box in the associated desktop window. /// </summary> /// <param name="message"></param> /// <param name="buttons"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, MessageBoxActions buttons) { return this.DesktopWindow.ShowMessageBox(message, this.Title, buttons); }
/// <summary> /// Displays a message box. /// </summary> /// <remarks> /// Override this method if you need to customize the display of message boxes. /// </remarks> /// <param name="message"></param> /// <param name="actions"></param> /// <returns></returns> public virtual DialogBoxAction ShowMessageBox(string message, MessageBoxActions actions) { MessageBox mb = new MessageBox(); return mb.Show(message, actions); }