Skip to content

Commit bccf30f

Browse files
committed
Remove UxTheme session handling
1 parent 26fe346 commit bccf30f

3 files changed

Lines changed: 4 additions & 18 deletions

File tree

‎QuickLook/App.xaml.cs‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

18-
using Microsoft.Win32;
1918
using QuickLook.Common.Helpers;
2019
using QuickLook.Helpers;
2120
using QuickLook.NativeMethods;
@@ -228,8 +227,6 @@ protected override void OnStartup(StartupEventArgs e)
228227

229228
// Set initial theme based on system settings
230229
ThemeManager.Apply(OSThemeHelper.AppsUseDarkTheme() ? ApplicationTheme.Dark : ApplicationTheme.Light);
231-
UxTheme.ApplyPreferredAppMode(isTracked: true);
232-
SystemEvents.SessionEnding += OnSessionEnding;
233230

234231
// Initialize MessageBox patching
235232
MessageBoxPatcher.Initialize();
@@ -239,21 +236,8 @@ protected override void OnStartup(StartupEventArgs e)
239236
CheckAndRegisterPluginIcon();
240237
}
241238

242-
protected virtual void OnSessionEnding(object sender, SessionEndingEventArgs e)
243-
{
244-
SystemEvents.SessionEnding -= OnSessionEnding;
245-
246-
// You must unsubscribe from SystemEvents events before your application exits, or the application may crash
247-
// https://github.com/QL-Win/QuickLook/issues/1782
248-
UxTheme.ApplyPreferredAppMode(isTracked: false);
249-
}
250-
251239
protected override void OnExit(ExitEventArgs e)
252240
{
253-
// You must unsubscribe from SystemEvents events before your application exits, or the application may crash
254-
// https://github.com/QL-Win/QuickLook/issues/1782
255-
UxTheme.ApplyPreferredAppMode(isTracked: false);
256-
257241
base.OnExit(e);
258242

259243
if (!_cleanExit)

‎QuickLook/QuickLook.csproj‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@
101101
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.7.0">
102102
<PrivateAssets>all</PrivateAssets>
103103
</PackageReference>
104-
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135">
104+
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.142">
105105
<PrivateAssets>all</PrivateAssets>
106106
</PackageReference>
107-
<PackageReference Include="WPF-UI.Violeta" Version="4.2.0.4">
107+
<PackageReference Include="WPF-UI.Violeta" Version="4.2.0.11">
108108
<PrivateAssets>all</PrivateAssets>
109109
</PackageReference>
110110
<PackageReference Include="Lib.Harmony" Version="2.4.2">

‎QuickLook/TrayIconManager.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using System.IO;
2626
using System.Windows.Forms;
2727
using Wpf.Ui.Violeta.Win32;
28+
using OSThemeHelper = QuickLook.Common.Helpers.OSThemeHelper;
2829
using ToolTipIcon = Wpf.Ui.Violeta.Win32.ToolTipIcon;
2930

3031
namespace QuickLook;
@@ -44,6 +45,7 @@ private TrayIconManager()
4445
ToolTipText = string.Format(TranslationHelper.Get("Icon_ToolTip"),
4546
Application.ProductVersion),
4647
Icon = GetTrayIconByDPI(),
48+
ThemeMode = TrayThemeMode.System,
4749
Menu =
4850
[
4951
new TrayMenuItem()

0 commit comments

Comments
 (0)