mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 17:57:01 +08:00
chore: 更新至 .net 8
真搞不懂这个吐司)
This commit is contained in:
@@ -33,6 +33,8 @@ using Notification.Wpf.Controls;
|
||||
using Semver;
|
||||
using Serilog;
|
||||
using Stylet;
|
||||
using Windows.Data.Xml.Dom;
|
||||
using Windows.UI.Notifications;
|
||||
using Application = System.Windows.Forms.Application;
|
||||
using FontFamily = System.Windows.Media.FontFamily;
|
||||
|
||||
@@ -414,20 +416,28 @@ namespace MaaWpfGui.Helper
|
||||
if (_buttonSystemEnabled)
|
||||
{
|
||||
Uri burl = new Uri(ButtonSystemUrl);
|
||||
new ToastContentBuilder()
|
||||
var toastContent = new ToastContentBuilder()
|
||||
.AddText(_notificationTitle)
|
||||
.AddText(_contentCollection.ToString())
|
||||
.AddButton(new ToastButton()
|
||||
.SetContent(_buttonSystemText)
|
||||
.SetProtocolActivation(burl))
|
||||
.Show();
|
||||
.GetToastContent();
|
||||
var toastXmlDoc = new XmlDocument();
|
||||
toastXmlDoc.LoadXml(toastContent.GetContent());
|
||||
var toastNotification = new Windows.UI.Notifications.ToastNotification(toastXmlDoc);
|
||||
ToastNotificationManager.CreateToastNotifier().Show(toastNotification);
|
||||
}
|
||||
else
|
||||
{
|
||||
new ToastContentBuilder()
|
||||
var toastContent = new ToastContentBuilder()
|
||||
.AddText(_notificationTitle)
|
||||
.AddText(_contentCollection.ToString())
|
||||
.Show();
|
||||
.GetToastContent();
|
||||
var toastXmlDoc = new XmlDocument();
|
||||
toastXmlDoc.LoadXml(toastContent.GetContent());
|
||||
var toastNotification = new Windows.UI.Notifications.ToastNotification(toastXmlDoc);
|
||||
ToastNotificationManager.CreateToastNotifier().Show(toastNotification);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>MaaWpfGui</RootNamespace>
|
||||
<AssemblyName>MAA</AssemblyName>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<TargetFramework Condition="'$(Platform)' == 'ARM64'">net481</TargetFramework>
|
||||
<Platforms>x64;ARM64</Platforms>
|
||||
<Configurations>Release;RelWithDebInfo;Debug</Configurations>
|
||||
@@ -100,7 +100,7 @@
|
||||
<Version>1.1.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="gong-wpf-dragdrop">
|
||||
<Version>3.1.1</Version>
|
||||
<Version>3.2.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="HandyControls">
|
||||
<Version>3.4.5</Version>
|
||||
@@ -109,13 +109,13 @@
|
||||
<PackageReference Include="MdXaml.Html" Version="1.21.0" />
|
||||
<PackageReference Include="MdXaml.Plugins" Version="1.21.0" />
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications">
|
||||
<Version>7.1.2</Version>
|
||||
<Version>7.1.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>13.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Notification.Wpf">
|
||||
<Version>6.1.0.5</Version>
|
||||
<Version>7.0.0.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ObservableCollections">
|
||||
<Version>1.1.3</Version>
|
||||
@@ -125,10 +125,10 @@
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Semver">
|
||||
<Version>2.2.0</Version>
|
||||
<Version>2.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Serilog">
|
||||
<Version>2.12.0</Version>
|
||||
<Version>3.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Serilog.Enrichers.Thread">
|
||||
<Version>3.1.0</Version>
|
||||
@@ -147,16 +147,14 @@
|
||||
<PackageReference Include="Stylet">
|
||||
<Version>1.3.6</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="System.Management" Version="7.0.2" />
|
||||
<PackageReference Include="Uno.UI" Version="4.9.45" />
|
||||
<PackageReference Include="Vanara.PInvoke.ComCtl32" Version="3.4.16" />
|
||||
<PackageReference Include="Vanara.PInvoke.Shared" Version="3.4.16" />
|
||||
<PackageReference Include="Vanara.PInvoke.Shell32" Version="3.4.16" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||
<PackageReference Include="System.Text.Json">
|
||||
<Version>7.0.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Vanara.PInvoke.ComCtl32" Version="3.4.14" />
|
||||
<PackageReference Include="Vanara.PInvoke.Shell32" Version="3.4.14" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Management" />
|
||||
<PackageReference Include="System.Text.Json" Version="8.0.0-preview.7.23375.6" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="newlogo.ico" />
|
||||
|
||||
@@ -28,11 +28,11 @@ using MaaWpfGui.Services.RemoteControl;
|
||||
using MaaWpfGui.Services.Web;
|
||||
using MaaWpfGui.ViewModels.UI;
|
||||
using MaaWpfGui.Views.UI;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
using Serilog;
|
||||
using Serilog.Core;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
using Windows.UI.Notifications;
|
||||
|
||||
namespace MaaWpfGui.Main
|
||||
{
|
||||
@@ -227,7 +227,7 @@ namespace MaaWpfGui.Main
|
||||
var os = RuntimeInformation.OSDescription;
|
||||
if (string.Compare(os, "Microsoft Windows 10.0.10240", StringComparison.Ordinal) >= 0)
|
||||
{
|
||||
ToastNotificationManagerCompat.History.Clear();
|
||||
new ToastNotificationHistory().Clear();
|
||||
}
|
||||
|
||||
// 注销任务栏图标
|
||||
|
||||
@@ -44,12 +44,12 @@ namespace MaaWpfGui.Services
|
||||
_notifyIcon.MouseClick += NotifyIcon_MouseClick;
|
||||
_notifyIcon.MouseDoubleClick += OnNotifyIconDoubleClick;
|
||||
|
||||
MenuItem startMenu = new MenuItem(LocalizationHelper.GetString("Farming"));
|
||||
ToolStripMenuItem startMenu = new ToolStripMenuItem (LocalizationHelper.GetString("Farming"));
|
||||
startMenu.Click += StartTask;
|
||||
MenuItem stopMenu = new MenuItem(LocalizationHelper.GetString("Stop"));
|
||||
ToolStripMenuItem stopMenu = new ToolStripMenuItem(LocalizationHelper.GetString("Stop"));
|
||||
stopMenu.Click += StopTask;
|
||||
|
||||
MenuItem switchLangMenu = new MenuItem(LocalizationHelper.GetString("SwitchLanguage"));
|
||||
ToolStripMenuItem switchLangMenu = new ToolStripMenuItem(LocalizationHelper.GetString("SwitchLanguage"));
|
||||
|
||||
foreach (var lang in LocalizationHelper.SupportedLanguages)
|
||||
{
|
||||
@@ -58,21 +58,28 @@ namespace MaaWpfGui.Services
|
||||
continue;
|
||||
}
|
||||
|
||||
var langMenu = new MenuItem(lang.Value);
|
||||
var langMenu = new ToolStripMenuItem(lang.Value);
|
||||
langMenu.Click += (sender, e) =>
|
||||
{
|
||||
Instances.SettingsViewModel.Language = lang.Key;
|
||||
};
|
||||
switchLangMenu.MenuItems.Add(langMenu);
|
||||
switchLangMenu.DropDownItems.Add(langMenu);
|
||||
}
|
||||
|
||||
MenuItem forceShowMenu = new MenuItem(LocalizationHelper.GetString("ForceShow"));
|
||||
ToolStripMenuItem forceShowMenu = new ToolStripMenuItem(LocalizationHelper.GetString("ForceShow"));
|
||||
forceShowMenu.Click += ForceShow;
|
||||
|
||||
MenuItem exitMenu = new MenuItem(LocalizationHelper.GetString("Exit"));
|
||||
ToolStripMenuItem exitMenu = new ToolStripMenuItem(LocalizationHelper.GetString("Exit"));
|
||||
exitMenu.Click += AppExit;
|
||||
MenuItem[] menuItems = { startMenu, stopMenu, switchLangMenu, forceShowMenu, exitMenu };
|
||||
this._notifyIcon.ContextMenu = new ContextMenu(menuItems);
|
||||
|
||||
ToolStripMenuItem[] menuItems = new ToolStripMenuItem[] { startMenu, stopMenu, switchLangMenu, forceShowMenu, exitMenu };
|
||||
var contextMenuStrip = new ContextMenuStrip();
|
||||
foreach (var item in menuItems)
|
||||
{
|
||||
contextMenuStrip.Items.Add(item);
|
||||
}
|
||||
|
||||
this._notifyIcon.ContextMenuStrip = contextMenuStrip;
|
||||
}
|
||||
|
||||
private static void NotifyIcon_MouseClick(object sender, MouseEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user