2024-08-20 06:15:29 +00:00
|
|
|
|
using ReactiveUI;
|
2023-01-01 11:42:01 +00:00
|
|
|
|
|
2024-08-20 06:15:29 +00:00
|
|
|
|
namespace ServiceLib.Handler
|
2023-01-01 11:42:01 +00:00
|
|
|
|
{
|
|
|
|
|
|
public class NoticeHandler
|
|
|
|
|
|
{
|
2024-10-07 02:59:13 +00:00
|
|
|
|
private static readonly Lazy<NoticeHandler> _instance = new(() => new());
|
|
|
|
|
|
public static NoticeHandler Instance => _instance.Value;
|
|
|
|
|
|
|
2024-07-14 02:59:36 +00:00
|
|
|
|
public void Enqueue(string? content)
|
2023-01-01 11:42:01 +00:00
|
|
|
|
{
|
2024-03-07 03:51:45 +00:00
|
|
|
|
if (content.IsNullOrEmpty())
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2024-10-11 02:17:44 +00:00
|
|
|
|
MessageBus.Current.SendMessage(content, EMsgCommand.SendSnackMsg.ToString());
|
2023-01-01 11:42:01 +00:00
|
|
|
|
}
|
2023-04-14 12:49:36 +00:00
|
|
|
|
|
2024-07-14 02:59:36 +00:00
|
|
|
|
public void SendMessage(string? content)
|
2023-01-01 11:42:01 +00:00
|
|
|
|
{
|
2024-07-14 02:59:36 +00:00
|
|
|
|
if (content.IsNullOrEmpty())
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2024-10-11 02:17:44 +00:00
|
|
|
|
MessageBus.Current.SendMessage(content, EMsgCommand.SendMsgView.ToString());
|
2023-01-01 11:42:01 +00:00
|
|
|
|
}
|
2023-04-14 12:49:36 +00:00
|
|
|
|
|
2024-09-07 06:52:33 +00:00
|
|
|
|
public void SendMessageEx(string? content)
|
2023-01-01 11:42:01 +00:00
|
|
|
|
{
|
2024-07-14 02:59:36 +00:00
|
|
|
|
if (content.IsNullOrEmpty())
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2024-09-05 02:02:26 +00:00
|
|
|
|
content = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss} {content}";
|
2024-07-14 02:59:36 +00:00
|
|
|
|
SendMessage(content);
|
2023-01-01 11:42:01 +00:00
|
|
|
|
}
|
2024-03-04 02:41:42 +00:00
|
|
|
|
|
2024-07-14 02:59:36 +00:00
|
|
|
|
public void SendMessageAndEnqueue(string? msg)
|
2024-03-04 02:41:42 +00:00
|
|
|
|
{
|
2024-03-07 03:51:45 +00:00
|
|
|
|
Enqueue(msg);
|
|
|
|
|
|
SendMessage(msg);
|
2024-03-04 02:41:42 +00:00
|
|
|
|
}
|
2023-01-01 11:42:01 +00:00
|
|
|
|
}
|
2023-04-14 12:49:36 +00:00
|
|
|
|
}
|