/// <summary> /// Displays a message with a title allowing the choice of two responses /// as dictated by the dialogStyle parameter. /// </summary> /// <param name="message">The message to display.</param> /// <param name="title">The title of the dialog.</param> /// <param name="dialogStyle"> /// A SimpleBooleanDialogStyle that determines which choices appear. /// </param> /// <returns>True if accepted, false otherwise.</returns> /// <exception cref="InvalidOperationException"> /// A dialog handler has not been registered. /// </exception> public static bool SimpleBooleanDialog(string message, string title, SimpleBooleanDialogStyle dialogStyle) { var simpleBooleanDialog = _SimpleBooleanDialog; if (simpleBooleanDialog != null) { var state = new { simpleBooleanDialog, message, title, dialogStyle, returnValue = new Ref <bool>() }; SendSyncMessage(state, s => s.returnValue.Value = s.simpleBooleanDialog(s.message, s.title, s.dialogStyle)); return(state.returnValue.Value); } throw new InvalidOperationException("A dialog expecting a return value must be registered before use."); }
/// <summary> /// Displays a message allowing the choice of two responses as dictated /// by the dialogStyle parameter. /// </summary> /// <param name="message">The message to display.</param> /// <param name="dialogStyle"> /// A SimpleBooleanDialogStyle that determines which choices appear. /// </param> /// <returns>True if accepted, false otherwise.</returns> /// <exception cref="InvalidOperationException"> /// A dialog handler has not been registered. /// </exception> public static bool SimpleBooleanDialog(string message, SimpleBooleanDialogStyle dialogStyle) { return(_SimpleBooleanDialog(message, string.Empty, dialogStyle)); }