diff --git a/src/Ursa/Common/EventHelper.cs b/src/Ursa/Common/EventHelper.cs deleted file mode 100644 index 4b1dd09..0000000 --- a/src/Ursa/Common/EventHelper.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Interactivity; - -namespace Ursa.Common; - -internal static class EventHelper -{ - public static void RegisterClickEvent(EventHandler handler, params Button?[] buttons) - { - foreach (var button in buttons) - { - if(button is not null) button.Click += handler; - } - } - - public static void UnregisterClickEvent(EventHandler handler, params Button?[] buttons) - { - foreach (var button in buttons) - { - if(button is not null) button.Click -= handler; - } - } - - public static void RegisterEvent(RoutedEvent routedEvent, EventHandler handler, params Button?[] controls) - where TArgs : RoutedEventArgs - { - foreach (var control in controls) - { - control?.AddHandler(routedEvent, handler); - } - } - - public static void UnregisterEvent(RoutedEvent routedEvent, EventHandler handler, params Button?[] controls) - where TArgs : RoutedEventArgs - { - foreach (var control in controls) - { - control?.RemoveHandler(routedEvent, handler); - } - } -} \ No newline at end of file diff --git a/src/Ursa/Common/PropertyHelper.cs b/src/Ursa/Common/PropertyHelper.cs deleted file mode 100644 index c673e8b..0000000 --- a/src/Ursa/Common/PropertyHelper.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Avalonia; - -namespace Ursa.Common; - -public static class PropertyHelper -{ - public static void SetValue(AvaloniaProperty property, TValue value, params AvaloniaObject?[] elements) - { - foreach (var element in elements) - { - element?.SetValue(property, value); - } - } -} \ No newline at end of file diff --git a/src/Ursa/Controls/Dialog/DefaultDialogControl.cs b/src/Ursa/Controls/Dialog/DefaultDialogControl.cs index 0070925..ea21f32 100644 --- a/src/Ursa/Controls/Dialog/DefaultDialogControl.cs +++ b/src/Ursa/Controls/Dialog/DefaultDialogControl.cs @@ -4,6 +4,7 @@ using Avalonia.Controls.Metadata; using Avalonia.Controls.Primitives; using Avalonia.Input; using Avalonia.Interactivity; +using Irihi.Avalonia.Shared.Helpers; using Ursa.Common; using Ursa.EventArgs; @@ -55,12 +56,12 @@ public class DefaultDialogControl: DialogControlBase protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); - EventHelper.UnregisterClickEvent(DefaultButtonsClose, _okButton, _cancelButton, _yesButton, _noButton); + Button.ClickEvent.RemoveHandler(DefaultButtonsClose, _okButton, _cancelButton, _yesButton, _noButton); _okButton = e.NameScope.Find