public static DialogResult MessageBox(string text, string title, MessageBoxButtons buttons, MessageBoxIcon icon = MessageBoxIcon.None) { #if FAMISTUDIO_MACOS return(MacUtils.ShowAlert(text, title, buttons)); #else if (buttons == MessageBoxButtons.YesNoCancel) { buttons = MessageBoxButtons.YesNo; text += " (Close or ESC to cancel)"; } MessageDialog md = new MessageDialog(null, DialogFlags.Modal | DialogFlags.DestroyWithParent, icon == MessageBoxIcon.Error ? MessageType.Error : MessageType.Info, buttons == MessageBoxButtons.YesNo ? ButtonsType.YesNo : ButtonsType.Ok, text); md.KeepAbove = true; md.Modal = true; md.SkipTaskbarHint = true; md.TypeHint = Gdk.WindowTypeHint.Dialog; md.Title = title; int ret = md.Run(); ProcessPendingEvents(); md.Destroy(); ProcessPendingEvents(); if (buttons == MessageBoxButtons.YesNo) { return(ret == -8 ? DialogResult.Yes : ret == -9 ? DialogResult.No : DialogResult.Cancel); } else { return(DialogResult.OK); } #endif }
public static DialogResult MessageBox(string text, string title, MessageBoxButtons buttons, MessageBoxIcon icons = MessageBoxIcon.None) { return(MacUtils.ShowAlert(text, title, buttons)); }