24 lines
916 B
C#
24 lines
916 B
C#
using Prism.Services.Dialogs;
|
|
using Store.Management.Framework.Controls;
|
|
namespace Store.Management.ViewModels;
|
|
public sealed class FrameworkTestDialogViewModel : ConfirmDialogViewModel
|
|
{
|
|
private string message = "";
|
|
public FrameworkTestDialogViewModel() => Title = "框架弹窗测试";
|
|
public string Message { get => message; set => SetProperty(ref message, value); }
|
|
public override void OnDialogOpened(IDialogParameters parameters)
|
|
{
|
|
Message = parameters.GetValue<string>("message") ?? "";
|
|
ErrorMsg = "";
|
|
}
|
|
protected override DialogResult Confirm()
|
|
{
|
|
if (string.IsNullOrWhiteSpace(Message))
|
|
{
|
|
ErrorMsg = "返回内容不能为空。";
|
|
return null!; // 基类约定:null 表示保持弹窗打开。
|
|
}
|
|
return new DialogResult(ButtonResult.OK, new DialogParameters { { "message", Message.Trim() } });
|
|
}
|
|
}
|