Merge pull request #71 from irihitech/dialog
Dialog System, and MessageBox remake
This commit is contained in:
11
src/Ursa/Common/DialogButton.cs
Normal file
11
src/Ursa/Common/DialogButton.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Ursa.Common;
|
||||
|
||||
public enum DialogButton
|
||||
{
|
||||
None,
|
||||
OK,
|
||||
OKCancel,
|
||||
YesNo,
|
||||
YesNoCancel,
|
||||
}
|
||||
|
||||
10
src/Ursa/Common/DialogResult.cs
Normal file
10
src/Ursa/Common/DialogResult.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Ursa.Common;
|
||||
|
||||
public enum DialogResult
|
||||
{
|
||||
Cancel,
|
||||
No,
|
||||
None,
|
||||
OK,
|
||||
Yes,
|
||||
}
|
||||
23
src/Ursa/Common/EventHelper.cs
Normal file
23
src/Ursa/Common/EventHelper.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace Ursa.Common;
|
||||
|
||||
internal static class EventHelper
|
||||
{
|
||||
public static void RegisterClickEvent(EventHandler<RoutedEventArgs> handler, params Button?[] buttons)
|
||||
{
|
||||
foreach (var button in buttons)
|
||||
{
|
||||
if(button is not null) button.Click += handler;
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnregisterClickEvent(EventHandler<RoutedEventArgs> handler, params Button?[] buttons)
|
||||
{
|
||||
foreach (var button in buttons)
|
||||
{
|
||||
if(button is not null) button.Click -= handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user