Files
Pilz/Pilz.UI.Gtk/Dialogs/MessageBox.cs
2025-06-16 12:19:28 +02:00

24 lines
1001 B
C#

using Gtk;
namespace Pilz.UI.Gtk.Dialogs;
public static class MessageBox
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Nicht verwendete Parameter entfernen", Justification = "Can be used for easier migration from WinForms. However, the title get ignored as Gtk has no title parameter.")]
public static ResponseType Show(Window window, string message, string title, ButtonsType buttons, MessageType type)
{
var msgBox = new MessageDialog(window, DialogFlags.DestroyWithParent, type, buttons, message);
var result = msgBox.Run();
msgBox.Destroy();
return (ResponseType)result;
}
public static ResponseType Show(Window window, ButtonsType buttons, MessageType type, string format, params object[] args)
{
var msgBox = new MessageDialog(window, DialogFlags.DestroyWithParent, type, buttons, format, args);
var result = msgBox.Run();
msgBox.Destroy();
return (ResponseType)result;
}
}