From 7c0a551d699cbd5a3d4d26184ea634ef865e4772 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Tue, 29 Jun 2021 22:09:33 +0800 Subject: [PATCH] fixed an issue where resources could not be found in growl & messagebox --- build/build.nuspec | 6 +++--- src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs | 8 ++++---- src/Shared/HandyControl_Shared/Controls/Other/Gravatar.cs | 3 ++- .../HandyControl_Shared/Controls/Window/MessageBox.cs | 6 +++--- src/Shared/HandyControl_Shared/Data/Info/GrowlInfo.cs | 5 +++++ .../HandyControl_Shared/Data/Info/MessageBoxInfo.cs | 7 +++++++ 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/build/build.nuspec b/build/build.nuspec index 6c255e8d..87ee9de2 100644 --- a/build/build.nuspec +++ b/build/build.nuspec @@ -2,19 +2,19 @@ HandyControl - 3.1.0 + 3.2.0 HandyOrg HandyOrg HandyOrg true LICENSE icon.png - https://github.com/NaBian/HandyControl + https://github.com/HandyOrg/HandyControl Contains some simple and commonly used WPF controls Changes are detailed at https://github.com/HandyOrg/HandyControl/releases Copyright © HandyOrg 2018-2021 WPF C# Control - + diff --git a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs index 49e9b4db..33a51e1c 100644 --- a/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs +++ b/src/Shared/HandyControl_Shared/Controls/Growl/Growl.cs @@ -372,8 +372,8 @@ namespace HandyControl.Controls { Message = growlInfo.Message, Time = DateTime.Now, - Icon = ResourceHelper.GetResourceInternal(growlInfo.IconKey), - IconBrush = ResourceHelper.GetResourceInternal(growlInfo.IconBrushKey), + Icon = ResourceHelper.GetResource(growlInfo.IconKey) ?? growlInfo.Icon, + IconBrush = ResourceHelper.GetResource(growlInfo.IconBrushKey) ?? growlInfo.IconBrush, _showCloseButton = growlInfo.ShowCloseButton, ActionBeforeClose = growlInfo.ActionBeforeClose, _staysOpen = growlInfo.StaysOpen, @@ -408,8 +408,8 @@ namespace HandyControl.Controls { Message = growlInfo.Message, Time = DateTime.Now, - Icon = ResourceHelper.GetResourceInternal(growlInfo.IconKey), - IconBrush = ResourceHelper.GetResourceInternal(growlInfo.IconBrushKey), + Icon = ResourceHelper.GetResource(growlInfo.IconKey) ?? growlInfo.Icon, + IconBrush = ResourceHelper.GetResource(growlInfo.IconBrushKey) ?? growlInfo.IconBrush, _showCloseButton = growlInfo.ShowCloseButton, ActionBeforeClose = growlInfo.ActionBeforeClose, _staysOpen = growlInfo.StaysOpen, diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Gravatar.cs b/src/Shared/HandyControl_Shared/Controls/Other/Gravatar.cs index 7fb8029a..59350328 100644 --- a/src/Shared/HandyControl_Shared/Controls/Other/Gravatar.cs +++ b/src/Shared/HandyControl_Shared/Controls/Other/Gravatar.cs @@ -1,6 +1,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Media; +using HandyControl.Data; using HandyControl.Tools; namespace HandyControl.Controls @@ -45,7 +46,7 @@ namespace HandyControl.Controls { Stretch = Stretch.UniformToFill } - : ResourceHelper.GetResourceInternal("SecondaryRegionBrush"); + : ResourceHelper.GetResourceInternal(ResourceToken.SecondaryRegionBrush); } public ImageSource Source diff --git a/src/Shared/HandyControl_Shared/Controls/Window/MessageBox.cs b/src/Shared/HandyControl_Shared/Controls/Window/MessageBox.cs index c8bc8fc4..577a7de2 100644 --- a/src/Shared/HandyControl_Shared/Controls/Window/MessageBox.cs +++ b/src/Shared/HandyControl_Shared/Controls/Window/MessageBox.cs @@ -375,13 +375,13 @@ namespace HandyControl.Controls if (!string.IsNullOrEmpty(info.IconKey)) { messageBox.ShowImage = true; - messageBox.Image = ResourceHelper.GetResourceInternal(info.IconKey); - messageBox.ImageBrush = ResourceHelper.GetResourceInternal(info.IconBrushKey); + messageBox.Image = ResourceHelper.GetResource(info.IconKey) ?? info.Icon; + messageBox.ImageBrush = ResourceHelper.GetResource(info.IconBrushKey) ?? info.IconBrush; } if (info.StyleKey != null) { - messageBox.Style = ResourceHelper.GetResourceInternal