feat: ultimate refactoring to separate default dialog and custom dialog.
This commit is contained in:
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