fixed csproj dependencies

This commit is contained in:
2021-01-01 22:38:09 +01:00
parent ff3ec4d9e6
commit 90b24e547d
8 changed files with 17 additions and 20 deletions

View File

@ -26,10 +26,12 @@ namespace Controls
/// <returns></returns>
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()
.GetField(enumValue.ToString())?.GetCustomAttributes(false)
.OfType<DescriptionAttribute>().FirstOrDefault();
.GetField(enumValue.ToString())?
.GetCustomAttributes(false)
.OfType<DescriptionAttribute>()
.FirstOrDefault();
return descriptionAttribute?.Description ?? value.ToString() ?? string.Empty;
}

View File

@ -36,11 +36,11 @@ namespace Controls
var data = value as string;
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))
{
var path = data.Substring(PathKeyword.Length);
var path = data[PathKeyword.Length..];
var icon = ObjectImageConverter.GetIcon(Geometry.Parse(path), Brushes.Black);
return new Image
{
@ -53,7 +53,7 @@ namespace Controls
if (data.StartsWith(DynResKeyword, StringComparison.Ordinal))
{
var resourceKey = data.Substring(DynResKeyword.Length);
var resourceKey = data[DynResKeyword.Length..];
//get icon from resource dictionary
return new Image
{

View File

@ -26,7 +26,7 @@ namespace Controls
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))
{
var resource = Application.Current.TryFindResource(strValue.Replace(dynResPrefix, string.Empty , StringComparison.InvariantCulture));