优化代码

This commit is contained in:
2026-05-01 09:58:25 +08:00
parent 97dbedfed5
commit 13c73fbfe4
6 changed files with 5 additions and 49 deletions
-3
View File
@@ -1,5 +1,4 @@
using System; using System;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
using System.Windows.Interop; using System.Windows.Interop;
@@ -189,9 +188,7 @@ namespace Ink_Canvas.Helpers
/// <summary> /// <summary>
/// 确保窗口全屏的Hook /// 确保窗口全屏的Hook
/// 使用HandleProcessCorruptedStateExceptions,防止访问内存过程中因为一些致命异常导致程序崩溃
/// </summary> /// </summary>
[HandleProcessCorruptedStateExceptions]
private static IntPtr KeepFullScreenHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) private static IntPtr KeepFullScreenHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{ {
//处理WM_WINDOWPOSCHANGING消息 //处理WM_WINDOWPOSCHANGING消息
+5 -2
View File
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
@@ -32,7 +32,10 @@
<Configurations>Debug;Release</Configurations> <Configurations>Debug;Release</Configurations>
<Platforms>AnyCPU;x86;x64</Platforms> <Platforms>AnyCPU;x86;x64</Platforms>
<LangVersion>10</LangVersion> <LangVersion>10</LangVersion>
<NoWarn>CA1416</NoWarn> <NoWarn>$(NoWarn);CA1416;NU1701;MSB3270;CS8012;NETSDK1138</NoWarn>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>embedded</DebugType> <DebugType>embedded</DebugType>
-1
View File
@@ -1162,7 +1162,6 @@ namespace Ink_Canvas
public string _lastAppliedProfileName; public string _lastAppliedProfileName;
private bool isLoaded; private bool isLoaded;
private bool _suppressChickenSoupSourceSelectionChanged;
private bool forcePointEraser; private bool forcePointEraser;
private bool _pendingStartupAutoUpdateCheck; private bool _pendingStartupAutoUpdateCheck;
private bool _sliderTouchSupportInitialized; private bool _sliderTouchSupportInitialized;
-8
View File
@@ -20,13 +20,6 @@ namespace Ink_Canvas
{ {
#region Behavior #region Behavior
/// <summary>
/// 内部标记:是否正在内部更改更新通道
/// </summary>
private bool _isChangingUpdateChannelInternally;
/// <summary>内部标记:是否正在内部更改「更新包架构」(32/64 位 ZIP</summary>
private bool _isChangingUpdatePackageArchInternally;
/// <summary> /// <summary>
/// 处理PowerPoint支持开关状态更改事件 /// 处理PowerPoint支持开关状态更改事件
@@ -1299,7 +1292,6 @@ namespace Ink_Canvas
private void UpdatePackageArchitectureSelector_Checked(object sender, RoutedEventArgs e) private void UpdatePackageArchitectureSelector_Checked(object sender, RoutedEventArgs e)
{ {
if (!isLoaded) return; if (!isLoaded) return;
if (_isChangingUpdatePackageArchInternally) return;
if (!(sender is RadioButton radioButton) || radioButton.Tag == null) return; if (!(sender is RadioButton radioButton) || radioButton.Tag == null) return;
var newArch = string.Equals(radioButton.Tag.ToString(), "X64", StringComparison.OrdinalIgnoreCase) var newArch = string.Equals(radioButton.Tag.ToString(), "X64", StringComparison.OrdinalIgnoreCase)
-6
View File
@@ -585,12 +585,6 @@
<data name="InkRecog_ShapeEngineHint" xml:space="preserve"> <data name="InkRecog_ShapeEngineHint" xml:space="preserve">
<value> 自动:64 位进程使用 WinRTWindows 10+),32 位使用 IACore。可强制指定 IACore 或 WinRT。</value> <value> 自动:64 位进程使用 WinRTWindows 10+),32 位使用 IACore。可强制指定 IACore 或 WinRT。</value>
</data> </data>
<data name="InkRecog_HandwritingBeautify" xml:space="preserve">
<value>手写体纠正</value>
</data>
<data name="InkRecog_HandwritingBeautifyHint" xml:space="preserve">
<value># 开启后,将对手写笔画进行更平滑、更工整的纠正处理(基于 WinRT)。</value>
</data>
<data name="InkRecog_ShapeEngineAuto" xml:space="preserve"> <data name="InkRecog_ShapeEngineAuto" xml:space="preserve">
<value>自动</value> <value>自动</value>
</data> </data>
-29
View File
@@ -45,35 +45,6 @@
</application> </application>
</compatibility> </compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- dpiAwareness is recognized only on Win10 1607(aka RS1)+ -->
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
<!-- Prior to Win10 1607, WPF really doesn't support per-mon DPI. Do not specify true/pm - use just true -->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<!-- optional -->
<!--
<highResolutionScrollingAware>true</highResolutionScrollingAware>
<ultraHighResolutionScrollingAware>true</ultraHighResolutionScrollingAware>
-->
</windowsSettings>
</application>
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) --> <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<dependency> <dependency>