月更
This commit is contained in:
87
AntdWpfDemo/ViewModels/NotificationViewModel.cs
Normal file
87
AntdWpfDemo/ViewModels/NotificationViewModel.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
using AntDesignWPF.Controls;
|
||||
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace AntdWpfDemo.ViewModels
|
||||
{
|
||||
[Export(typeof(IScreen))]
|
||||
internal class NotificationViewModel : Screen
|
||||
{
|
||||
public NotificationViewModel()
|
||||
{
|
||||
DisplayName = "Notification";
|
||||
}
|
||||
public void SuccessClick()
|
||||
{
|
||||
NotificationManager.Show(
|
||||
"操作成功",
|
||||
"您的设置已保存,并已成功应用到系统中。",
|
||||
NotificationType.Success);
|
||||
}
|
||||
|
||||
public void InfoClick()
|
||||
{
|
||||
NotificationManager.Show(
|
||||
"系统提示",
|
||||
"这是一条普通的信息提示,用于通知用户。",
|
||||
NotificationType.Info,
|
||||
NotificationPlacement.BottomRight);
|
||||
}
|
||||
|
||||
public void WarningClick()
|
||||
{
|
||||
NotificationManager.Show(
|
||||
"警告",
|
||||
"您的磁盘空间即将用尽,请及时清理文件。",
|
||||
NotificationType.Warning,
|
||||
NotificationPlacement.BottomLeft);
|
||||
}
|
||||
|
||||
public void ErrorClick()
|
||||
{
|
||||
NotificationManager.Show(
|
||||
"发生错误",
|
||||
"无法连接到服务器,请检查您的网络连接。",
|
||||
NotificationType.Error,
|
||||
NotificationPlacement.TopLeft,
|
||||
durationSeconds: 5); // 自定义持续时间
|
||||
}
|
||||
public void thisSuccessClick()
|
||||
{
|
||||
NotificationManager.Show(
|
||||
"操作成功",
|
||||
"您的设置已保存,并已成功应用到系统中。",
|
||||
NotificationType.Success);
|
||||
}
|
||||
|
||||
public void thisInfoClick()
|
||||
{
|
||||
NotificationManager.Show(
|
||||
"系统提示",
|
||||
"这是一条普通的信息提示,用于通知用户。",
|
||||
NotificationType.Info,
|
||||
NotificationPlacement.BottomRight);
|
||||
}
|
||||
|
||||
public void thisWarningClick()
|
||||
{
|
||||
NotificationManager.Show(
|
||||
"警告",
|
||||
"您的磁盘空间即将用尽,请及时清理文件。",
|
||||
NotificationType.Warning,
|
||||
NotificationPlacement.BottomLeft);
|
||||
}
|
||||
|
||||
public void thisErrorClick()
|
||||
{
|
||||
NotificationManager.Show(
|
||||
"发生错误",
|
||||
"无法连接到服务器,请检查您的网络连接。",
|
||||
NotificationType.Error,
|
||||
NotificationPlacement.TopLeft,
|
||||
durationSeconds: 5); // 自定义持续时间
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user