Skip to content

Commit

Permalink
Merge pull request #24 from BoBoBaSs84/fix/bindable-property-and-noti…
Browse files Browse the repository at this point in the history
…fy-property-do-not-work-with-enums

fix: Bindable property and notify property do not work with enums
  • Loading branch information
BoBoBaSs84 authored Nov 3, 2023
2 parents bd76b79 + dc5aad2 commit 1b28f58
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<VersionMajor>1</VersionMajor>
<VersionMinor>3</VersionMinor>
<VersionPatch>1</VersionPatch>
<VersionMinor>4</VersionMinor>
<VersionPatch>0</VersionPatch>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
<VersionSuffix Condition="$(Configuration.Equals('Debug'))">Development</VersionSuffix>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/BB84.Notifications/BindableProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace BB84.Notifications;
/// The bindable property class.
/// </summary>
/// <typeparam name="T">The value type to work with.</typeparam>
public sealed class BindableProperty<T> : IBindableProperty<T> where T : IEquatable<T>
public sealed class BindableProperty<T> : IBindableProperty<T>
{
private T _value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace BB84.Notifications.Components;
/// The bindable property changed event args class.
/// </summary>
/// <typeparam name="T">The value type to work with.</typeparam>
public sealed class BindablePropertyChangedEventArgs<T> : EventArgs where T : IEquatable<T>
public sealed class BindablePropertyChangedEventArgs<T> : EventArgs
{
/// <summary>
/// Initializes a instance of the bindable property changed event args class.
Expand All @@ -30,4 +30,4 @@ public BindablePropertyChangedEventArgs(T value)
/// <param name="sender">The source of the event.</param>
/// <param name="e">The argument that contains the event data.</param>
[SuppressMessage("Naming", "CA1711", Justification = "Event Handler Naming Conventions")]
public delegate void BindablePropertyChangedEventHandler<T>(object? sender, BindablePropertyChangedEventArgs<T> e) where T : IEquatable<T>;
public delegate void BindablePropertyChangedEventHandler<T>(object? sender, BindablePropertyChangedEventArgs<T> e);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace BB84.Notifications.Components;
/// The bindable property changing event args class.
/// </summary>
/// <typeparam name="T">The value type to work with.</typeparam>
public class BindablePropertyChangingEventArgs<T> : EventArgs where T : IEquatable<T>
public class BindablePropertyChangingEventArgs<T> : EventArgs
{
/// <summary>
/// Initializes a instance of the bindable property changing event args class.
Expand All @@ -30,4 +30,4 @@ public BindablePropertyChangingEventArgs(T value)
/// <param name="sender">The source of the event.</param>
/// <param name="e">The argument that contains the event data.</param>
[SuppressMessage("Naming", "CA1711", Justification = "Event Handler Naming Conventions")]
public delegate void BindablePropertyChangingEventHandler<T>(object? sender, BindablePropertyChangingEventArgs<T> e) where T : IEquatable<T>;
public delegate void BindablePropertyChangingEventHandler<T>(object? sender, BindablePropertyChangingEventArgs<T> e);
2 changes: 1 addition & 1 deletion src/BB84.Notifications/Interfaces/IBindableProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace BB84.Notifications.Interfaces;
/// The bindable property interface.
/// </summary>
/// <typeparam name="T">The value type to work with.</typeparam>
public interface IBindableProperty<T> where T : IEquatable<T>
public interface IBindableProperty<T>
{
/// <summary>
/// The actual value of the bindable property.
Expand Down
6 changes: 3 additions & 3 deletions src/BB84.Notifications/NotifyPropertyBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public abstract class NotifyPropertyBase : INotifyPropertyBase
/// <param name="fieldValue">The referenced field.</param>
/// <param name="newValue">The new value for the property.</param>
/// <param name="propertyName">The name of the calling property.</param>
protected void SetProperty<T>(ref T fieldValue, T newValue, [CallerMemberName] string propertyName = "") where T : IEquatable<T>
protected void SetProperty<T>(ref T fieldValue, T newValue, [CallerMemberName] string propertyName = "")
{
if (!EqualityComparer<T>.Default.Equals(fieldValue, newValue))
{
Expand All @@ -44,7 +44,7 @@ protected void SetProperty<T>(ref T fieldValue, T newValue, [CallerMemberName] s
/// </remarks>
/// <param name="propertyName">The name of the calling property.</param>
/// <param name="value">The value of the calling property.</param>
private void RaisePropertyChanged(string propertyName, object value)
private void RaisePropertyChanged(string propertyName, object? value)
=> PropertyChanged?.Invoke(this, new(propertyName, value));

/// <summary>
Expand All @@ -55,6 +55,6 @@ private void RaisePropertyChanged(string propertyName, object value)
/// </remarks>
/// <param name="propertyName">The name of the calling property.</param>
/// <param name="value">The value of the calling property.</param>
private void RaisePropertyChanging(string propertyName, object value)
private void RaisePropertyChanging(string propertyName, object? value)
=> PropertyChanging?.Invoke(this, new(propertyName, value));
}

0 comments on commit 1b28f58

Please sign in to comment.