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-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-08-20 06:15:29 +00:00
|
|
|
|
MessageBus.Current.SendMessage(content, Global.CommandSendSnackMsg);
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
MessageBus.Current.SendMessage(content, Global.CommandSendMsgView);
|
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, bool time)
|
2023-01-01 11:42:01 +00:00
|
|
|
|
{
|
2024-07-14 02:59:36 +00:00
|
|
|
|
if (content.IsNullOrEmpty())
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
content = $"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} {content}";
|
|
|
|
|
|
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
|
|
|
|
}
|