mirror of
				https://github.com/holgerb83/ModernWpfPlayground.git
				synced 2025-10-31 00:11:19 +01:00 
			
		
		
		
	fixed csproj dependencies
This commit is contained in:
		| @@ -7,9 +7,9 @@ namespace ModernWpfPlayground | |||||||
|         public static readonly DependencyProperty MessageProperty = DependencyProperty.Register( |         public static readonly DependencyProperty MessageProperty = DependencyProperty.Register( | ||||||
|             "Message", typeof(string), typeof(ContentDialogExample), new PropertyMetadata(default(string))); |             "Message", typeof(string), typeof(ContentDialogExample), new PropertyMetadata(default(string))); | ||||||
|  |  | ||||||
|         public string Message |         public string? Message | ||||||
|         { |         { | ||||||
|             get => (string) GetValue(MessageProperty); |             get => (string?) GetValue(MessageProperty); | ||||||
|             set => SetValue(MessageProperty, value); |             set => SetValue(MessageProperty, value); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -75,7 +75,7 @@ namespace ModernWpfPlayground | |||||||
|  |  | ||||||
|         public ICommand ShowDialogCommand { get; } |         public ICommand ShowDialogCommand { get; } | ||||||
|  |  | ||||||
|         public string WelcomeMessage |         public string? WelcomeMessage | ||||||
|         { |         { | ||||||
|             get => GetProperty("Shadow of the empire"); |             get => GetProperty("Shadow of the empire"); | ||||||
|             set => SetProperty(value); |             set => SetProperty(value); | ||||||
| @@ -137,7 +137,7 @@ namespace ModernWpfPlayground | |||||||
|         private void SaveViewModel() |         private void SaveViewModel() | ||||||
|         { |         { | ||||||
|             var contents = _serializer.Serialize(Values); |             var contents = _serializer.Serialize(Values); | ||||||
|             if (Path == null) |             if (Path is null) | ||||||
|             { |             { | ||||||
|                 var saveFileDialog = new SaveFileDialog {AddExtension = true, DefaultExt = "*.yaml"}; |                 var saveFileDialog = new SaveFileDialog {AddExtension = true, DefaultExt = "*.yaml"}; | ||||||
|                 var result = saveFileDialog.ShowDialog(Application.Current.MainWindow?.Owner); |                 var result = saveFileDialog.ShowDialog(Application.Current.MainWindow?.Owner); | ||||||
|   | |||||||
| @@ -15,8 +15,6 @@ | |||||||
|     <PackageReference Include="YamlDotNet" Version="9.1.0" /> |     <PackageReference Include="YamlDotNet" Version="9.1.0" /> | ||||||
|     <PackageReference Include="System.Drawing.Common" Version="5.0.0" /> |     <PackageReference Include="System.Drawing.Common" Version="5.0.0" /> | ||||||
|     <PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.8.0" /> |     <PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.8.0" /> | ||||||
|     <PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.1.0" /> |  | ||||||
|     <PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.18362.2005" /> |  | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|   | |||||||
| @@ -14,9 +14,9 @@ namespace ModernWpfPlayground.MvvmStuff | |||||||
|             ObjectAccessor = ObjectAccessor.Create(this); |             ObjectAccessor = ObjectAccessor.Create(this); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private readonly Dictionary<string, object?> _values = new Dictionary<string, object?>(); |         private readonly Dictionary<string, object?> _values = new(); | ||||||
|         protected readonly ObjectAccessor ObjectAccessor; |         protected readonly ObjectAccessor ObjectAccessor; | ||||||
|         private readonly Dictionary<string, object?> _defaultValues = new Dictionary<string, object?>(); |         private readonly Dictionary<string, object?> _defaultValues = new(); | ||||||
|  |  | ||||||
|         protected IReadOnlyDictionary<string, object?> Values => _values; |         protected IReadOnlyDictionary<string, object?> Values => _values; | ||||||
|  |  | ||||||
| @@ -32,7 +32,7 @@ namespace ModernWpfPlayground.MvvmStuff | |||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         protected T GetProperty<T>(T defaultValue = default, [CallerMemberName] string? propertyName = null) |         protected T? GetProperty<T>(T? defaultValue = default, [CallerMemberName] string? propertyName = null) | ||||||
|         { |         { | ||||||
|             if (propertyName == null) throw new ArgumentNullException(nameof(propertyName)); |             if (propertyName == null) throw new ArgumentNullException(nameof(propertyName)); | ||||||
|             if (Values.TryGetValue(propertyName, out var obj)) |             if (Values.TryGetValue(propertyName, out var obj)) | ||||||
|   | |||||||
| @@ -1,16 +1,13 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk"> | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|   <PropertyGroup> |   <PropertyGroup> | ||||||
|     <TargetFramework>net5.0-windows10.0.18362.0</TargetFramework> |     <TargetFramework>net5.0-windows</TargetFramework> | ||||||
|     <UseWPF>true</UseWPF> |     <UseWPF>true</UseWPF> | ||||||
|     <Nullable>enable</Nullable> |     <Nullable>enable</Nullable> | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.1.0" /> |  | ||||||
|     <PackageReference Include="ModernWpfUI" Version="0.9.3-preview.201204.0" /> |  | ||||||
|     <PackageReference Include="System.Drawing.Common" Version="5.0.0" /> |     <PackageReference Include="System.Drawing.Common" Version="5.0.0" /> | ||||||
|     <PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.18362.2005" /> |  | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
| </Project> | </Project> | ||||||
|   | |||||||
| @@ -26,10 +26,12 @@ namespace Controls | |||||||
|         /// <returns></returns> |         /// <returns></returns> | ||||||
|         private static string GetDescription(object value) |         private static string GetDescription(object value) | ||||||
|         { |         { | ||||||
|             if (!(value is Enum enumValue)) return string.Empty; |             if (value is not Enum enumValue) return string.Empty; | ||||||
|             var descriptionAttribute = enumValue.GetType() |             var descriptionAttribute = enumValue.GetType() | ||||||
|               .GetField(enumValue.ToString())?.GetCustomAttributes(false) |               .GetField(enumValue.ToString())? | ||||||
|               .OfType<DescriptionAttribute>().FirstOrDefault(); |               .GetCustomAttributes(false) | ||||||
|  |               .OfType<DescriptionAttribute>() | ||||||
|  |               .FirstOrDefault(); | ||||||
|  |  | ||||||
|             return descriptionAttribute?.Description ?? value.ToString() ?? string.Empty; |             return descriptionAttribute?.Description ?? value.ToString() ?? string.Empty; | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -36,11 +36,11 @@ namespace Controls | |||||||
|             var data = value as string; |             var data = value as string; | ||||||
|             if (string.IsNullOrWhiteSpace(data)) return value; //maybe not a string. eventually something else. |             if (string.IsNullOrWhiteSpace(data)) return value; //maybe not a string. eventually something else. | ||||||
|  |  | ||||||
|             if (data.StartsWith(NoParseKeyword, StringComparison.Ordinal)) return data.Substring(NoParseKeyword.Length); |             if (data.StartsWith(NoParseKeyword, StringComparison.Ordinal)) return data[NoParseKeyword.Length..]; | ||||||
|  |  | ||||||
|             if (data.StartsWith(PathKeyword, StringComparison.Ordinal)) |             if (data.StartsWith(PathKeyword, StringComparison.Ordinal)) | ||||||
|             { |             { | ||||||
|                 var path = data.Substring(PathKeyword.Length); |                 var path = data[PathKeyword.Length..]; | ||||||
|                 var icon = ObjectImageConverter.GetIcon(Geometry.Parse(path), Brushes.Black); |                 var icon = ObjectImageConverter.GetIcon(Geometry.Parse(path), Brushes.Black); | ||||||
|                 return new Image |                 return new Image | ||||||
|                 { |                 { | ||||||
| @@ -53,7 +53,7 @@ namespace Controls | |||||||
|  |  | ||||||
|             if (data.StartsWith(DynResKeyword, StringComparison.Ordinal)) |             if (data.StartsWith(DynResKeyword, StringComparison.Ordinal)) | ||||||
|             { |             { | ||||||
|                 var resourceKey = data.Substring(DynResKeyword.Length); |                 var resourceKey = data[DynResKeyword.Length..]; | ||||||
|                 //get icon from resource dictionary |                 //get icon from resource dictionary | ||||||
|                 return new Image |                 return new Image | ||||||
|                 { |                 { | ||||||
|   | |||||||
| @@ -26,7 +26,7 @@ namespace Controls | |||||||
|                 return System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(16, 16)); |                 return System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(16, 16)); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (!(value is string strValue)) return Binding.DoNothing; |             if (value is not string strValue) return Binding.DoNothing; | ||||||
|             if (strValue.StartsWith(dynResPrefix, StringComparison.Ordinal)) |             if (strValue.StartsWith(dynResPrefix, StringComparison.Ordinal)) | ||||||
|             { |             { | ||||||
|                 var resource = Application.Current.TryFindResource(strValue.Replace(dynResPrefix, string.Empty , StringComparison.InvariantCulture)); |                 var resource = Application.Current.TryFindResource(strValue.Replace(dynResPrefix, string.Empty , StringComparison.InvariantCulture)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user