add Pilz.UI & Pilz.UI.Gtk

This commit is contained in:
2025-06-16 12:19:28 +02:00
parent 299867a910
commit 6f7bb5d92c
14 changed files with 175 additions and 32 deletions

View File

@@ -0,0 +1,23 @@
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;
}
}