From 26094d25b4da82950906a8ebb403b8df2644909d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20B=C3=B6rchers?= Date: Fri, 1 May 2020 21:41:05 +0200 Subject: [PATCH] updated to latest preview --- App/ModernWpfPlayground.csproj | 2 +- App/MvvmStuff/BaseViewModel.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/App/ModernWpfPlayground.csproj b/App/ModernWpfPlayground.csproj index 136d159..feed22f 100644 --- a/App/ModernWpfPlayground.csproj +++ b/App/ModernWpfPlayground.csproj @@ -9,7 +9,7 @@ - + diff --git a/App/MvvmStuff/BaseViewModel.cs b/App/MvvmStuff/BaseViewModel.cs index d8f2b3a..33d927b 100644 --- a/App/MvvmStuff/BaseViewModel.cs +++ b/App/MvvmStuff/BaseViewModel.cs @@ -14,10 +14,10 @@ namespace ModernWpfPlayground.MvvmStuff ObjectAccessor = ObjectAccessor.Create(this); } - private readonly Dictionary _values = new Dictionary(); + private readonly Dictionary _values = new Dictionary(); protected readonly ObjectAccessor ObjectAccessor; - protected IReadOnlyDictionary Values => _values; + protected IReadOnlyDictionary Values => _values; protected bool SetProperty(T value, Action? onChanged = null, [CallerMemberName] string? propertyName = null) @@ -25,7 +25,7 @@ namespace ModernWpfPlayground.MvvmStuff if (propertyName == null) throw new ArgumentNullException(nameof(propertyName)); if (_values.TryGetValue(propertyName, out var obj) && Equals(value, obj)) return false; - _values[propertyName] = value!; + _values[propertyName] = value; RaisePropertyChanged(propertyName); onChanged?.Invoke(value); return true; @@ -34,7 +34,7 @@ namespace ModernWpfPlayground.MvvmStuff protected T GetProperty(T defaultValue = default, [CallerMemberName] string? propertyName = null) { if (propertyName == null) throw new ArgumentNullException(nameof(propertyName)); - return Values.TryGetValue(propertyName, out var obj) ? (T)obj : defaultValue; + return Values.TryGetValue(propertyName, out var obj) ? (T)obj! : defaultValue; } protected void ResetViewModel(Func? predicate = null)