mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-04-25 22:29:47 +08:00
fix notify bug
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Drawing;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.Service.Notification.Converter;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BetterGenshinImpact.Service.Notification.Model;
|
||||
|
||||
@@ -21,13 +22,13 @@ public class BaseNotificationData
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public NotificationEventResult Result { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 事件触发时间
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(DateTimeJsonConverter))]
|
||||
public DateTime Timestamp { get; set; } = DateTime.Now;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 事件触发时的截图
|
||||
/// </summary>
|
||||
@@ -46,14 +47,28 @@ public class BaseNotificationData
|
||||
|
||||
public void Send()
|
||||
{
|
||||
if (TaskContext.Instance().Config.NotificationConfig.IncludeScreenShot)
|
||||
try
|
||||
{
|
||||
Screenshot = (Bitmap)TaskControl.CaptureToRectArea().SrcBitmap.Clone();
|
||||
if (TaskContext.Instance().Config.NotificationConfig.IncludeScreenShot)
|
||||
{
|
||||
Screenshot = (Bitmap)TaskControl.CaptureToRectArea().SrcBitmap.Clone();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
TaskControl.Logger.LogDebug(e, "补充通知截图失败");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
NotificationService.Instance().NotifyAllNotifiers(this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
TaskControl.Logger.LogDebug(e, "发送通知失败");
|
||||
}
|
||||
|
||||
NotificationService.Instance().NotifyAllNotifiers(this);
|
||||
}
|
||||
|
||||
|
||||
public void Send(string message)
|
||||
{
|
||||
Message = message;
|
||||
|
||||
Reference in New Issue
Block a user