Remove UxTheme session handling

This commit is contained in:
ema
2026-04-13 22:57:18 +08:00
parent 26fe346198
commit bccf30fa0a
3 changed files with 4 additions and 18 deletions
-16
View File
@@ -15,7 +15,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using Microsoft.Win32;
using QuickLook.Common.Helpers;
using QuickLook.Helpers;
using QuickLook.NativeMethods;
@@ -228,8 +227,6 @@ public partial class App : Application
// Set initial theme based on system settings
ThemeManager.Apply(OSThemeHelper.AppsUseDarkTheme() ? ApplicationTheme.Dark : ApplicationTheme.Light);
UxTheme.ApplyPreferredAppMode(isTracked: true);
SystemEvents.SessionEnding += OnSessionEnding;
// Initialize MessageBox patching
MessageBoxPatcher.Initialize();
@@ -239,21 +236,8 @@ public partial class App : Application
CheckAndRegisterPluginIcon();
}
protected virtual void OnSessionEnding(object sender, SessionEndingEventArgs e)
{
SystemEvents.SessionEnding -= OnSessionEnding;
// You must unsubscribe from SystemEvents events before your application exits, or the application may crash
// https://github.com/QL-Win/QuickLook/issues/1782
UxTheme.ApplyPreferredAppMode(isTracked: false);
}
protected override void OnExit(ExitEventArgs e)
{
// You must unsubscribe from SystemEvents events before your application exits, or the application may crash
// https://github.com/QL-Win/QuickLook/issues/1782
UxTheme.ApplyPreferredAppMode(isTracked: false);
base.OnExit(e);
if (!_cleanExit)
+2 -2
View File
@@ -101,10 +101,10 @@
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.7.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135">
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.142">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="WPF-UI.Violeta" Version="4.2.0.4">
<PackageReference Include="WPF-UI.Violeta" Version="4.2.0.11">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Lib.Harmony" Version="2.4.2">
+2
View File
@@ -25,6 +25,7 @@ using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using Wpf.Ui.Violeta.Win32;
using OSThemeHelper = QuickLook.Common.Helpers.OSThemeHelper;
using ToolTipIcon = Wpf.Ui.Violeta.Win32.ToolTipIcon;
namespace QuickLook;
@@ -44,6 +45,7 @@ internal partial class TrayIconManager : IDisposable
ToolTipText = string.Format(TranslationHelper.Get("Icon_ToolTip"),
Application.ProductVersion),
Icon = GetTrayIconByDPI(),
ThemeMode = TrayThemeMode.System,
Menu =
[
new TrayMenuItem()