清理引用,将NavigatorServices更改为使用Message来实现导航的切换

This commit is contained in:
2025-06-23 17:01:06 +08:00
parent 8ee4b7bc05
commit 8fcd2fdf2a
62 changed files with 711 additions and 767 deletions

View File

@@ -1,5 +1,4 @@
using System.Windows.Interop;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;
using HandyControl.Controls;
using PMSWPF.Enums;
@@ -8,21 +7,23 @@ using Notification = PMSWPF.Models.Notification;
namespace PMSWPF.Services;
public class GrowlNotificationService :ObservableRecipient,IRecipient<NotificationMessage>
public class GrowlNotificationService : ObservableRecipient, IRecipient<NotificationMessage>
{
public GrowlNotificationService()
{
IsActive = true;
}
public void Receive(NotificationMessage message)
{
Show(message.Value, message.Type, message.IsGlobal);
}
public void Show(Notification notification)
{
if (notification == null )
{
return;
}
if (notification == null) return;
if (notification.IsGlobal)
{
switch (notification.Type)
{
case NotificationType.Info:
@@ -47,10 +48,7 @@ public class GrowlNotificationService :ObservableRecipient,IRecipient<Notificati
Growl.InfoGlobal(notification.Message);
break;
}
}
else
{
switch (notification.Type)
{
case NotificationType.Info:
@@ -75,16 +73,10 @@ public class GrowlNotificationService :ObservableRecipient,IRecipient<Notificati
Growl.Info(notification.Message);
break;
}
}
}
public void Show(string message, NotificationType type=NotificationType.Info,bool IsGlobal=true)
public void Show(string message, NotificationType type = NotificationType.Info, bool IsGlobal = true)
{
Show(new Notification(){Message = message,Type = type,IsGlobal = IsGlobal});
}
public void Receive(NotificationMessage message)
{
Show(message.Value,message.Type,message.IsGlobal);
Show(new Notification { Message = message, Type = type, IsGlobal = IsGlobal });
}
}