上机测试优化2
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using UIShare.PubEvent;
|
||||
using UIShare.ViewModelBase;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace ADP.ViewModels.Dialogs
|
||||
{
|
||||
@@ -22,8 +23,8 @@ namespace ADP.ViewModels.Dialogs
|
||||
set => SetProperty(ref _Message, value);
|
||||
}
|
||||
|
||||
private string _Icon= $"pack://siteoforigin:,,,/Resources/Images/info.png";
|
||||
public string Icon
|
||||
private ImageSource _Icon = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("pack://application:,,,/Images/info.png"));
|
||||
public ImageSource Icon
|
||||
{
|
||||
get => _Icon;
|
||||
set => SetProperty(ref _Icon, value);
|
||||
@@ -101,13 +102,15 @@ namespace ADP.ViewModels.Dialogs
|
||||
Title = parameters.GetValue<string>("Title");
|
||||
Message = parameters.GetValue<string>("Message");
|
||||
var iconKey = parameters.GetValue<string>("Icon"); // info / error / warn
|
||||
Icon = iconKey switch
|
||||
var bmp = (ImageSource)new System.Windows.Media.Imaging.BitmapImage(new System.Uri(iconKey switch
|
||||
{
|
||||
"info" => $"pack://siteoforigin:,,,/Resources/Images/info.png",
|
||||
"error" => $"pack://siteoforigin:,,,/Resources/Images/error.png",
|
||||
"warn" => $"pack://siteoforigin:,,,/Resources/Images/warning.png",
|
||||
_ => $"pack://siteoforigin:,,,/Resources/Images/info.png" // 默认
|
||||
};
|
||||
"info" => "pack://application:,,,/Images/info.png",
|
||||
"error" => "pack://application:,,,/Images/error.png",
|
||||
"warn" => "pack://application:,,,/Images/warning.png",
|
||||
_ => "pack://application:,,,/Images/info.png"
|
||||
}));
|
||||
bmp.Freeze();
|
||||
Icon = bmp;
|
||||
|
||||
|
||||
ShowYes = parameters.GetValue<bool>("ShowYes");
|
||||
|
||||
Reference in New Issue
Block a user