From ed0d65d87353796a82b89dbc052ff5f3bd95a64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E6=80=A1=E9=A3=9E?= <363301617@qq.com> Date: Fri, 16 Aug 2024 15:11:50 +0800 Subject: [PATCH] Finish task and publish 4.6.816.0 version 1.Finish task and publish 4.6.816.0 version 2.Update Microsoft.Web.webView2 to 1.0.2651.64 version 3.Add more WebView2 data clean rule 4.Add ToggleSwitchHelper to get ToggleSwitch flowDirection --- GetStoreApp/GetStoreApp.csproj | 6 ++-- GetStoreApp/GetStoreApp.res | Bin 438024 -> 438024 bytes .../Extensions/ContentDialogHelper.cs | 2 +- .../Controls/Extensions/TeachingTipHelper.cs | 2 +- .../Controls/Extensions/ToggleSwitchHelper.cs | 18 ++++++++++++ GetStoreApp/Properties/AssemblyInfo.cs | 6 ++-- GetStoreApp/Views/Pages/SettingsPage.xaml | 13 +++++---- GetStoreApp/Views/Pages/SettingsPage.xaml.cs | 8 ------ GetStoreAppPackage/Package.appxmanifest | 2 +- GetStoreAppWebView/GetStoreAppWebView.csproj | 3 +- GetStoreAppWebView/Pages/MainPage.xaml.cs | 26 +++--------------- GetStoreAppWebView/Properties/AssemblyInfo.cs | 6 ++-- GetStoreAppWebView/UI/Controls/WebView2.cs | 5 +--- .../Properties/AssemblyInfo.cs | 6 ++-- 14 files changed, 46 insertions(+), 57 deletions(-) create mode 100644 GetStoreApp/Helpers/Controls/Extensions/ToggleSwitchHelper.cs diff --git a/GetStoreApp/GetStoreApp.csproj b/GetStoreApp/GetStoreApp.csproj index 11d2fbdc..a379ab07 100644 --- a/GetStoreApp/GetStoreApp.csproj +++ b/GetStoreApp/GetStoreApp.csproj @@ -22,15 +22,14 @@ False WinExe x86;x64;ARM64 + true FileSystem False true True - true PackageReference GetStoreApp win-x86;win-x64;win-arm64 - true GetStoreApp.Program net9.0-windows10.0.26100.0 10.0.19041.0 @@ -110,7 +109,8 @@ - + + diff --git a/GetStoreApp/GetStoreApp.res b/GetStoreApp/GetStoreApp.res index 20d4c0bdd5263d3b7eb709a15ab1031651fe413d..e07718a52820a509ed9f72a80f26135704a489c3 100644 GIT binary patch delta 89 zcmeCUC)IIJs-cCkg{g(Pg{6gc3!BU=el`Xc1_lNLW+**fdlp+Orx}ADg9U>jgW2?* Xv)DExxZ6u-vt=_P@n6nilNSO2$;uRT delta 89 zcmeCUC)IIJs-cCkg{g(Pg{6gc3!BU=epUt+1_lOwW+**fdlp+OrzwLTg9U>jgX#30 Xv)DExxZ6u-vt=_P@n6nilNSO2$T}2i diff --git a/GetStoreApp/Helpers/Controls/Extensions/ContentDialogHelper.cs b/GetStoreApp/Helpers/Controls/Extensions/ContentDialogHelper.cs index e8e074f0..d97e47cc 100644 --- a/GetStoreApp/Helpers/Controls/Extensions/ContentDialogHelper.cs +++ b/GetStoreApp/Helpers/Controls/Extensions/ContentDialogHelper.cs @@ -6,7 +6,7 @@ namespace GetStoreApp.Helpers.Controls.Extensions { /// - /// 扩展后的内容对话框辅助类,只允许在同一时间段内打开一个内容对话框 + /// 扩展后的内容对话框控件辅助类 /// public static class ContentDialogHelper { diff --git a/GetStoreApp/Helpers/Controls/Extensions/TeachingTipHelper.cs b/GetStoreApp/Helpers/Controls/Extensions/TeachingTipHelper.cs index 002fa3cb..3098420f 100644 --- a/GetStoreApp/Helpers/Controls/Extensions/TeachingTipHelper.cs +++ b/GetStoreApp/Helpers/Controls/Extensions/TeachingTipHelper.cs @@ -7,7 +7,7 @@ namespace GetStoreApp.Helpers.Controls.Extensions { /// - /// 扩展后的教学提示辅助类,使用教学提示来显示应用内通知 + /// 扩展后的教学提示控件辅助类 /// public static class TeachingTipHelper { diff --git a/GetStoreApp/Helpers/Controls/Extensions/ToggleSwitchHelper.cs b/GetStoreApp/Helpers/Controls/Extensions/ToggleSwitchHelper.cs new file mode 100644 index 00000000..4d0d5859 --- /dev/null +++ b/GetStoreApp/Helpers/Controls/Extensions/ToggleSwitchHelper.cs @@ -0,0 +1,18 @@ +using Microsoft.UI.Xaml; + +namespace GetStoreApp.Helpers.Controls.Extensions +{ + /// + /// 扩展后的切换开关控件辅助类 + /// + public static class ToggleSwitchHelper + { + /// + /// 获取 ToggleSwitch 的文字转向 + /// + public static FlowDirection GetFlowDirection(FlowDirection flowDirection) + { + return flowDirection is FlowDirection.LeftToRight ? FlowDirection.RightToLeft : FlowDirection.LeftToRight; + } + } +} diff --git a/GetStoreApp/Properties/AssemblyInfo.cs b/GetStoreApp/Properties/AssemblyInfo.cs index 94ca7295..5e39e7a0 100644 --- a/GetStoreApp/Properties/AssemblyInfo.cs +++ b/GetStoreApp/Properties/AssemblyInfo.cs @@ -6,11 +6,11 @@ [assembly: AssemblyCompany("高怡飞")] [assembly: AssemblyCopyright("Copyright ©2022-2024 高怡飞, All Rights Reserved.")] [assembly: AssemblyDescription("获取商店应用")] -[assembly: AssemblyFileVersion("4.5.815.0")] -[assembly: AssemblyInformationalVersion("4.5.815.0")] +[assembly: AssemblyFileVersion("4.6.816.0")] +[assembly: AssemblyInformationalVersion("4.6.816.0")] [assembly: AssemblyProduct("获取商店应用")] [assembly: AssemblyTitle("获取商店应用")] -[assembly: AssemblyVersion("4.5.815.0")] +[assembly: AssemblyVersion("4.6.816.0")] // 应用程序默认区域性的资源控制器设置 [assembly: NeutralResourcesLanguage("en-us")] diff --git a/GetStoreApp/Views/Pages/SettingsPage.xaml b/GetStoreApp/Views/Pages/SettingsPage.xaml index 4364f291..0a78e720 100644 --- a/GetStoreApp/Views/Pages/SettingsPage.xaml +++ b/GetStoreApp/Views/Pages/SettingsPage.xaml @@ -3,6 +3,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:collection="using:System.Collections" + xmlns:controlHelper="using:GetStoreApp.Helpers.Controls.Extensions" xmlns:converter="using:GetStoreApp.Helpers.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:helper="using:GetStoreApp.Helpers.Root" @@ -350,7 +351,7 @@ Grid.Column="2" MinWidth="0" Margin="0,-2,0,0" - FlowDirection="{x:Bind GetToggleSwitchDirection(service:LanguageService.FlowDirection)}" + FlowDirection="{x:Bind controlHelper:ToggleSwitchHelper.GetFlowDirection(service:LanguageService.FlowDirection)}" IsEnabled="{x:Bind converter:ValueCheckConverterHelper.ObjectCompareReverseConvert(Backdrop.Value, BackdropList[0].Value), Mode=OneWay}" IsEnabledChanged="{x:Bind OnIsEnabledChanged}" IsOn="{x:Bind AlwaysShowBackdropValue, Mode=OneWay}" @@ -520,7 +521,7 @@ Grid.Column="2" MinWidth="0" Margin="0,-2,0,0" - FlowDirection="{x:Bind GetToggleSwitchDirection(service:LanguageService.FlowDirection)}" + FlowDirection="{x:Bind controlHelper:ToggleSwitchHelper.GetFlowDirection(service:LanguageService.FlowDirection)}" IsOn="{x:Bind TopMostValue, Mode=OneWay}" OffContent="{x:Bind root:ResourceService.GetLocalized('Settings/TopMostOffContent')}" OnContent="{x:Bind root:ResourceService.GetLocalized('Settings/TopMostOnContent')}" @@ -604,7 +605,7 @@ Grid.Column="3" MinWidth="0" Margin="0,-2,0,0" - FlowDirection="{x:Bind GetToggleSwitchDirection(service:LanguageService.FlowDirection)}" + FlowDirection="{x:Bind controlHelper:ToggleSwitchHelper.GetFlowDirection(service:LanguageService.FlowDirection)}" IsOn="{x:Bind Notification, Mode=OneWay}" OffContent="{x:Bind root:ResourceService.GetLocalized('Settings/NotificationOffContent')}" OnContent="{x:Bind root:ResourceService.GetLocalized('Settings/NotificationOnContent')}" @@ -843,7 +844,7 @@ - /// 获取 ToggleSwitch 的文字转向 - /// - private FlowDirection GetToggleSwitchDirection(FlowDirection flowDirection) - { - return flowDirection is FlowDirection.LeftToRight ? FlowDirection.RightToLeft : FlowDirection.LeftToRight; - } - private string LocalizeDisplayNumber(DictionaryEntry selectedBackdrop) { int index = BackdropList.FindIndex(item => item.Value.Equals(selectedBackdrop.Value)); diff --git a/GetStoreAppPackage/Package.appxmanifest b/GetStoreAppPackage/Package.appxmanifest index 0143d447..274c515b 100644 --- a/GetStoreAppPackage/Package.appxmanifest +++ b/GetStoreAppPackage/Package.appxmanifest @@ -11,7 +11,7 @@ + Version="4.6.816.0" /> ms-resource:PackageDisplayName diff --git a/GetStoreAppWebView/GetStoreAppWebView.csproj b/GetStoreAppWebView/GetStoreAppWebView.csproj index d6281e47..9aa8d555 100644 --- a/GetStoreAppWebView/GetStoreAppWebView.csproj +++ b/GetStoreAppWebView/GetStoreAppWebView.csproj @@ -146,9 +146,8 @@ - + - 14.0 diff --git a/GetStoreAppWebView/Pages/MainPage.xaml.cs b/GetStoreAppWebView/Pages/MainPage.xaml.cs index 433d0a1e..2cb6be87 100644 --- a/GetStoreAppWebView/Pages/MainPage.xaml.cs +++ b/GetStoreAppWebView/Pages/MainPage.xaml.cs @@ -270,7 +270,9 @@ private async void OnClearWebCacheClicked(object sender, RoutedEventArgs args) { if (WebView2Browser is not null && WebView2Browser.CoreWebView2 is not null) { + WebView2Browser.CoreWebView2.CookieManager.DeleteAllCookies(); await WebView2Browser.CoreWebView2.Profile.ClearBrowsingDataAsync(); + await WebView2Browser.CoreWebView2.ClearServerCertificateErrorActionsAsync(); } } } @@ -373,6 +375,8 @@ private async void OnCoreProcessFailed(object sender, CoreWebView2ProcessFailedE /// private void OnCoreWebView2Initialized(object sender, CoreWebView2InitializedEventArgs args) { + WebView2Browser.CoreWebView2.Settings.AreDefaultScriptDialogsEnabled = false; + WebView2Browser.CoreWebView2.Settings.AreDevToolsEnabled = false; WebView2Browser.CoreWebView2.NewWindowRequested += OnCoreWebViewNewWindowRequested; WebView2Browser.CoreWebView2.SourceChanged += OnSourceChanged; IsEnabled = true; @@ -461,27 +465,5 @@ private void SetTitleBarTheme(ElementTheme theme) } #endregion 第五部分:窗口属性设置 - - /// - /// 关闭窗口时注销的事件 - /// - public void CloseWindow() - { - if (WebKernelService.WebKernel == WebKernelService.WebKernelList[1] && WebView2Browser is not null) - { - try - { - if (WebView2Browser.CoreWebView2 is not null) - { - WebView2Browser.CoreWebView2.NewWindowRequested -= OnCoreWebViewNewWindowRequested; - WebView2Browser.CoreWebView2.SourceChanged -= OnSourceChanged; - } - } - catch (Exception e) - { - LogService.WriteLog(LoggingLevel.Error, "WebView2 unloaded event failed", e); - } - } - } } } diff --git a/GetStoreAppWebView/Properties/AssemblyInfo.cs b/GetStoreAppWebView/Properties/AssemblyInfo.cs index af06a86d..0b2e4f1e 100644 --- a/GetStoreAppWebView/Properties/AssemblyInfo.cs +++ b/GetStoreAppWebView/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ [assembly: AssemblyCompany("高怡飞")] [assembly: AssemblyCopyright("Copyright ©2022-2024 高怡飞, All Rights Reserved.")] [assembly: AssemblyDescription("网页浏览器")] -[assembly: AssemblyFileVersion("4.5.815.0")] -[assembly: AssemblyInformationalVersion("4.5.815.0")] +[assembly: AssemblyFileVersion("4.6.816.0")] +[assembly: AssemblyInformationalVersion("4.6.816.0")] [assembly: AssemblyProduct("网页浏览器")] [assembly: AssemblyTitle("网页浏览器")] -[assembly: AssemblyVersion("4.5.815.0")] +[assembly: AssemblyVersion("4.6.816.0")] // 应用程序默认区域性的资源控制器设置 [assembly: NeutralResourcesLanguage("en-us")] diff --git a/GetStoreAppWebView/UI/Controls/WebView2.cs b/GetStoreAppWebView/UI/Controls/WebView2.cs index 4c2d06d5..a1505c0b 100644 --- a/GetStoreAppWebView/UI/Controls/WebView2.cs +++ b/GetStoreAppWebView/UI/Controls/WebView2.cs @@ -750,10 +750,7 @@ private void OnCursorChanged(CoreWebView2CompositionController sender, object ar private async void OnTextScaleFactorChanged(UISettings sender, object args) { // OnTextScaleFactorChanged 发生在非 UI 线程中,使用 Dispatcher 在 UI 线程中调用 UpdateCoreWebViewScale。 - await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => - { - UpdateCoreWebViewScale(); - }); + await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, UpdateCoreWebViewScale); } #endregion 第六部分:自定义事件 diff --git a/Microsoft.Management.Deployment.Projection/Properties/AssemblyInfo.cs b/Microsoft.Management.Deployment.Projection/Properties/AssemblyInfo.cs index 157d7eae..a421574c 100644 --- a/Microsoft.Management.Deployment.Projection/Properties/AssemblyInfo.cs +++ b/Microsoft.Management.Deployment.Projection/Properties/AssemblyInfo.cs @@ -4,10 +4,10 @@ // 程序集信息设置 [assembly: AssemblyCompany("高怡飞")] [assembly: AssemblyCopyright("©Copyright ©2022-2024 高怡飞, All Rights Reserved.")] -[assembly: AssemblyFileVersion("4.5.815.0")] -[assembly: AssemblyInformationalVersion("4.5.815.0")] +[assembly: AssemblyFileVersion("4.6.816.0")] +[assembly: AssemblyInformationalVersion("4.6.816.0")] [assembly: AssemblyProduct("获取商店应用 WinGet WinRT 扩展")] -[assembly: AssemblyVersion("4.5.815.0")] +[assembly: AssemblyVersion("4.6.816.0")] // 设置程序集仅允许在Windows平台上可用 [assembly: SupportedOSPlatform("windows10.0.26100")] \ No newline at end of file