feat: 给通知相关的套一层 Execute.OnUIThread

https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/2692
This commit is contained in:
zzyyyl
2022-11-10 14:28:37 +08:00
parent 11587f3f49
commit b9c563ca91

View File

@@ -24,6 +24,7 @@ using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Stylet;
using Microsoft.Toolkit.Uwp.Notifications;
using Microsoft.Win32;
using Notification.Wpf;
@@ -399,24 +400,27 @@ namespace MeoAsstGui
{
try
{
if (_buttonSystemEnabled)
Execute.OnUIThread(() =>
{
Uri burl = new Uri(ButtonSystemUrl);
new ToastContentBuilder()
.AddText(_notificationTitle)
.AddText(_contentCollection.ToString())
.AddButton(new ToastButton()
.SetContent(_buttonSystemText)
.SetProtocolActivation(burl))
.Show();
}
else
{
new ToastContentBuilder()
.AddText(_notificationTitle)
.AddText(_contentCollection.ToString())
.Show();
}
if (_buttonSystemEnabled)
{
Uri burl = new Uri(ButtonSystemUrl);
new ToastContentBuilder()
.AddText(_notificationTitle)
.AddText(_contentCollection.ToString())
.AddButton(new ToastButton()
.SetContent(_buttonSystemText)
.SetProtocolActivation(burl))
.Show();
}
else
{
new ToastContentBuilder()
.AddText(_notificationTitle)
.AddText(_contentCollection.ToString())
.Show();
}
});
}
catch (Exception e)
{