[Deps]Upgrade WpfUI to preview.9 and fix Windows 10 background issue (#29884)

* Bumping to preview9
This commit is contained in:
Niels Laute
2023-11-16 17:37:21 +01:00
committed by GitHub
parent 468e55c7e1
commit 412550abcd
9 changed files with 36 additions and 12 deletions

View File

@@ -74,7 +74,7 @@
<PackageVersion Include="Vanara.PInvoke.User32" Version="3.4.11" /> <PackageVersion Include="Vanara.PInvoke.User32" Version="3.4.11" />
<PackageVersion Include="Vanara.PInvoke.Shell32" Version="3.4.11" /> <PackageVersion Include="Vanara.PInvoke.Shell32" Version="3.4.11" />
<PackageVersion Include="WinUIEx" Version="2.2.0" /> <PackageVersion Include="WinUIEx" Version="2.2.0" />
<PackageVersion Include="WPF-UI" Version="3.0.0-preview.4" /> <PackageVersion Include="WPF-UI" Version="3.0.0-preview.9" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(IsExperimentationLive)'!=''"> <ItemGroup Condition="'$(IsExperimentationLive)'!=''">
<!-- Additional dependencies used by experimentation --> <!-- Additional dependencies used by experimentation -->

View File

@@ -1332,5 +1332,5 @@ EXHIBIT A -Mozilla Public License.
- Vanara.PInvoke.Shell32 3.4.11 - Vanara.PInvoke.Shell32 3.4.11
- Vanara.PInvoke.User32 3.4.11 - Vanara.PInvoke.User32 3.4.11
- WinUIEx 2.2.0 - WinUIEx 2.2.0
- WPF-UI 3.0.0-preview.4 - WPF-UI 3.0.0-preview.9

View File

@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace Common.UI
{
public static class OSVersionHelper
{
public static bool IsWindows11()
{
return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= 22000;
}
}
}

View File

@@ -16,7 +16,6 @@
ExtendsContentIntoTitleBar="True" ExtendsContentIntoTitleBar="True"
Icon="/PowerToys.ImageResizer;component/Resources/ImageResizer.ico" Icon="/PowerToys.ImageResizer;component/Resources/ImageResizer.ico"
ResizeMode="NoResize" ResizeMode="NoResize"
WindowBackdropType="Mica"
WindowCornerPreference="Default" WindowCornerPreference="Default"
WindowStartupLocation="CenterScreen"> WindowStartupLocation="CenterScreen">

View File

@@ -5,6 +5,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Common.UI;
using ImageResizer.ViewModels; using ImageResizer.ViewModels;
using Microsoft.Win32; using Microsoft.Win32;
using Wpf.Ui.Controls; using Wpf.Ui.Controls;
@@ -17,7 +18,17 @@ namespace ImageResizer.Views
public MainWindow(MainViewModel viewModel) public MainWindow(MainViewModel viewModel)
{ {
DataContext = viewModel; DataContext = viewModel;
Wpf.Ui.Appearance.Watcher.Watch(this); Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this);
if (OSVersionHelper.IsWindows11())
{
WindowBackdropType = WindowBackdropType.Mica;
}
else
{
WindowBackdropType = WindowBackdropType.None;
}
InitializeComponent(); InitializeComponent();
} }

View File

@@ -150,10 +150,5 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
} }
public const uint VirtualKeyWindows = interop.Constants.VK_WIN_BOTH; public const uint VirtualKeyWindows = interop.Constants.VK_WIN_BOTH;
public static bool Windows11()
{
return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= 22000;
}
} }
} }

View File

@@ -6,6 +6,7 @@ using System;
using System.Globalization; using System.Globalization;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text.Json; using System.Text.Json;
using Common.UI;
using global::PowerToys.GPOWrapper; using global::PowerToys.GPOWrapper;
using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Helpers; using Microsoft.PowerToys.Settings.UI.Library.Helpers;
@@ -61,7 +62,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_doNotActivateOnGameMode = Settings.Properties.DoNotActivateOnGameMode.Value; _doNotActivateOnGameMode = Settings.Properties.DoNotActivateOnGameMode.Value;
_roundCornersEnabled = Settings.Properties.RoundCornersEnabled.Value; _roundCornersEnabled = Settings.Properties.RoundCornersEnabled.Value;
_excludedApps = Settings.Properties.ExcludedApps.Value; _excludedApps = Settings.Properties.ExcludedApps.Value;
_windows11 = Helper.Windows11(); _windows11 = OSVersionHelper.IsWindows11();
// set the callback functions value to handle outgoing IPC message. // set the callback functions value to handle outgoing IPC message.
SendConfigMSG = ipcMSGCallBackFunc; SendConfigMSG = ipcMSGCallBackFunc;

View File

@@ -4,6 +4,7 @@
using System; using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Common.UI;
using global::PowerToys.GPOWrapper; using global::PowerToys.GPOWrapper;
using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Helpers; using Microsoft.PowerToys.Settings.UI.Library.Helpers;
@@ -119,7 +120,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
InitializeEnabledValue(); InitializeEnabledValue();
_windows11 = Helper.Windows11(); _windows11 = OSVersionHelper.IsWindows11();
// Disable setting on windows 10 // Disable setting on windows 10
if (!_windows11 && DisableRoundCornersOnWindowSnap) if (!_windows11 && DisableRoundCornersOnWindowSnap)

View File

@@ -6,6 +6,7 @@ using System;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Timers; using System.Timers;
using Common.UI;
using Microsoft.PowerToys.Settings.UI.Library.Utilities; using Microsoft.PowerToys.Settings.UI.Library.Utilities;
namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout
@@ -39,7 +40,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels.Flyout
_hideTimer.Elapsed += HideTimer_Elapsed; _hideTimer.Elapsed += HideTimer_Elapsed;
_hideTimer.Interval = 1000; _hideTimer.Interval = 1000;
_hideTimer.Enabled = false; _hideTimer.Enabled = false;
_windows10 = !Helper.Windows11(); _windows10 = !OSVersionHelper.IsWindows11();
} }
private void HideTimer_Elapsed(object sender, ElapsedEventArgs e) private void HideTimer_Elapsed(object sender, ElapsedEventArgs e)