public static uiMessageBox New(string message, DialogResultDelegate callback) { var bx = Create <uiMessageBox>(); bx.Text = message; bx.onResult += callback; return(bx); }
public static void Show(string message, DialogResultDelegate onClosedCallback) { DXDialog dlg = new DXDialog(); dlg.Content = new TextBlock() { Text = message }; dlg.Closed += (s, e) => { onClosedCallback(((DXDialog)s).DialogResult); }; dlg.ShowDialog(); }
public void HandleResult(bool positive) { IsShowing = false; if (dialogDelegate == null) { return; } dialogDelegate(this, positive); dialogDelegate = null; }
public void Show(string message, string positive, string negative, DialogResultDelegate resultDelegate) { if (IsShowing) { return; } IsShowing = true; dialogDelegate = resultDelegate; dialogImpl.Show(message, positive, negative, this); }
/// <summary> /// Displays the Cairo Message Dialog with custom control, OK/Cancel buttons, implicit settings, custom image and button text. /// </summary> /// <param name="message">The message to display.</param> /// <param name="title">The title of the dialog.</param> /// <param name="imageSource">The image source to display.</param> /// <param name="useShadow">Enable a drop shadow if the image may blend with the background.</param> /// <param name="control">The custom control to embed within the dialog.</param> /// <param name="OkButtonText">The text for the OK button.</param> /// <param name="CancelButtonText">The text for the cancel button.</param> /// <param name="resultCallback">The delegate to execute upon user action.</param> /// <returns>void</returns> public static void ShowControl(string message, string title, ImageSource imageSource, bool useShadow, UserControl control, string OkButtonText, string CancelButtonText, DialogResultDelegate resultCallback) { if (string.IsNullOrEmpty(CancelButtonText)) { CancelButtonText = Localization.DisplayString.sInterface_Cancel; } if (string.IsNullOrEmpty(OkButtonText)) { OkButtonText = Localization.DisplayString.sInterface_OK; } CairoMessage msgDialog = new CairoMessage(); msgDialog.Message = message; msgDialog.Title = title; msgDialog.Buttons = MessageBoxButton.OKCancel; msgDialog.MessageIconImage.Source = imageSource; if (useShadow) { msgDialog.MessageIconImage.Effect = new DropShadowEffect { Color = Colors.Black, Direction = 270, ShadowDepth = 2, BlurRadius = 10, Opacity = 0.5 }; } msgDialog.ResultCallback = resultCallback; msgDialog.OkButton.Content = OkButtonText; msgDialog.CancelButton.Content = CancelButtonText; msgDialog.ContentPanel.Children.Add(control); control.Focus(); msgDialog.Show(); }
/// <summary> /// Displays the Cairo Message Dialog with custom control, OK/Cancel buttons, implicit settings, custom image and button text. /// </summary> /// <param name="message">The message to display.</param> /// <param name="title">The title of the dialog.</param> /// <param name="image">The path to the image for the dialog.</param> /// <param name="control">The custom control to embed within the dialog.</param> /// <param name="OkButtonText">The text for the OK button.</param> /// <param name="CancelButtonText">The text for the cancel button.</param> /// <param name="resultCallback">The delegate to execute upon user action.</param> /// <returns>void</returns> public static void ShowControl(string message, string title, CairoMessageImage image, UserControl control, string OkButtonText, string CancelButtonText, DialogResultDelegate resultCallback) { if (string.IsNullOrEmpty(CancelButtonText)) { CancelButtonText = Localization.DisplayString.sInterface_Cancel; } if (string.IsNullOrEmpty(OkButtonText)) { OkButtonText = Localization.DisplayString.sInterface_OK; } CairoMessage msgDialog = new CairoMessage(); msgDialog.Message = message; msgDialog.Title = title; msgDialog.Buttons = MessageBoxButton.OKCancel; msgDialog.Image = image; msgDialog.ResultCallback = resultCallback; msgDialog.OkButton.Content = OkButtonText; msgDialog.CancelButton.Content = CancelButtonText; msgDialog.ContentPanel.Children.Add(control); control.Focus(); msgDialog.Show(); }
/// <summary> /// Displays the Cairo Message Dialog with implicit settings. /// </summary> /// <param name="message">The message to display.</param> /// <param name="title">The title of the dialog.</param> /// <param name="buttons">The buttons configuration to use.</param> /// <param name="image">The image to display.</param> /// <param name="resultCallback">The delegate to execute upon user action.</param> /// <returns>void</returns> public static void Show(string message, string title, MessageBoxButton buttons, CairoMessageImage image, DialogResultDelegate resultCallback) { CairoMessage msgDialog = new CairoMessage { Message = message, Title = title, Image = image, Buttons = buttons, ResultCallback = resultCallback }; msgDialog.Show(); }