Skip to content

Commit

Permalink
Invert WatchProperty(...) methods' watchInitialValue
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Jul 18, 2024
1 parent 281e0f6 commit 42e6de3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
3 changes: 1 addition & 2 deletions DiscordChatExporter.Gui/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ public App()
};

InitializeTheme();
},
false
}
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ public static IDisposable WatchProperty<TOwner, TProperty>(
this TOwner owner,
Expression<Func<TOwner, TProperty>> propertyExpression,
Action callback,
bool watchInitialValue = true
bool watchInitialValue = false
)
where TOwner : INotifyPropertyChanged
{
var memberExpression =
propertyExpression.Body as MemberExpression
// Property value might be boxed inside a conversion expression, if the types don't match
?? (propertyExpression.Body as UnaryExpression)?.Operand as MemberExpression;

var memberExpression = propertyExpression.Body as MemberExpression;
if (memberExpression?.Member is not PropertyInfo property)
throw new ArgumentException("Provided expression must reference a property.");

Expand All @@ -45,7 +41,7 @@ void OnPropertyChanged(object? sender, PropertyChangedEventArgs args)
public static IDisposable WatchAllProperties<TOwner>(
this TOwner owner,
Action callback,
bool watchInitialValues = true
bool watchInitialValues = false
)
where TOwner : INotifyPropertyChanged
{
Expand Down

0 comments on commit 42e6de3

Please sign in to comment.