2025-06-23 13:42:02 +08:00
|
|
|
using CommunityToolkit.Mvvm.Messaging;
|
2025-07-02 22:07:16 +08:00
|
|
|
using NLog;
|
2025-06-23 13:42:02 +08:00
|
|
|
using PMSWPF.Enums;
|
|
|
|
|
using PMSWPF.Message;
|
|
|
|
|
|
|
|
|
|
namespace PMSWPF.Helper;
|
|
|
|
|
|
|
|
|
|
public class NotificationHelper
|
|
|
|
|
{
|
2025-07-02 22:07:16 +08:00
|
|
|
private static readonly ILogger Logger = LogManager.GetCurrentClassLogger();
|
2025-07-03 12:55:00 +08:00
|
|
|
|
2025-06-23 17:01:06 +08:00
|
|
|
public static void ShowMessage(string msg, NotificationType notificationType = NotificationType.Info,
|
|
|
|
|
bool isGlobal = false)
|
2025-06-23 13:42:02 +08:00
|
|
|
{
|
2025-07-02 22:07:16 +08:00
|
|
|
|
|
|
|
|
if (notificationType==NotificationType.Error)
|
|
|
|
|
{
|
|
|
|
|
Logger.Error(msg);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Logger.Info(msg);
|
|
|
|
|
}
|
2025-06-23 13:42:02 +08:00
|
|
|
WeakReferenceMessenger.Default.Send<NotificationMessage>(
|
|
|
|
|
new NotificationMessage(msg, notificationType));
|
|
|
|
|
}
|
|
|
|
|
}
|