From 1b5c674fd38499f82f2a47d9cfda4d1f54b39daa Mon Sep 17 00:00:00 2001 From: BoBoBaSs84 <73112377+BoBoBaSs84@users.noreply.github.com> Date: Mon, 20 May 2024 16:32:09 +0200 Subject: [PATCH] feat: make methods protected closes #96 --- src/BB84.Notifications/Commands/AsyncActionCommand.cs | 4 ++-- src/BB84.Notifications/NotifiableObject.cs | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/BB84.Notifications/Commands/AsyncActionCommand.cs b/src/BB84.Notifications/Commands/AsyncActionCommand.cs index a84e2c7..90de16b 100644 --- a/src/BB84.Notifications/Commands/AsyncActionCommand.cs +++ b/src/BB84.Notifications/Commands/AsyncActionCommand.cs @@ -19,7 +19,7 @@ public sealed class AsyncActionCommand(Func execute, Func? canExecut /// public bool CanExecute() - => !_isExecuting && (canExecute?.Invoke() ?? true); + => CanExecute(null); /// public async Task ExecuteAsync() @@ -42,7 +42,7 @@ public async Task ExecuteAsync() /// public bool CanExecute(object? parameter) - => CanExecute(); + => !_isExecuting && (canExecute?.Invoke() ?? true); /// public void Execute(object? parameter) diff --git a/src/BB84.Notifications/NotifiableObject.cs b/src/BB84.Notifications/NotifiableObject.cs index 8939d56..cd994ee 100644 --- a/src/BB84.Notifications/NotifiableObject.cs +++ b/src/BB84.Notifications/NotifiableObject.cs @@ -44,7 +44,7 @@ protected void SetProperty(ref T fieldValue, T newValue, [CallerMemberName] s /// Raises the event. /// /// The name of the calling property. - private void RaisePropertyChanged(string propertyName) + protected void RaisePropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new(propertyName)); /// @@ -53,22 +53,23 @@ private void RaisePropertyChanged(string propertyName) /// The type to work with. /// The name of the calling property. /// The value of the calling property. - private void RaisePropertyChanged(string propertyName, T value) + protected void RaisePropertyChanged(string propertyName, T value) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName, value)); /// /// Raises the event. /// /// The name of the calling property. - private void RaisePropertyChanging(string propertyName) + protected void RaisePropertyChanging(string propertyName) => PropertyChanging?.Invoke(this, new(propertyName)); /// /// Raises the event. /// + /// The type to work with. /// The name of the calling property. /// The value of the calling property. - private void RaisePropertyChanging(string propertyName, T value) + protected void RaisePropertyChanging(string propertyName, T value) => PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName, value)); ///