add Pilz.UI & Pilz.UI.Gtk
This commit is contained in:
23
Pilz.UI.Gtk/Dialogs/MessageBox.cs
Normal file
23
Pilz.UI.Gtk/Dialogs/MessageBox.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user