优化代码

This commit is contained in:
2026-04-30 14:29:06 +08:00
parent 988af60a30
commit d30ed9e726
35 changed files with 46 additions and 85 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
using System; using System;
using System.Globalization; using System.Globalization;
using System.Windows; using System.Windows;
using System.Windows.Data; using System.Windows.Data;
@@ -1,5 +1,4 @@
using OSVersionExtension; using OSVersionExtension;
using System;
using System.Windows; using System.Windows;
using System.Windows.Ink; using System.Windows.Ink;
using System.Windows.Media; using System.Windows.Media;
@@ -15,7 +15,7 @@ namespace Ink_Canvas.Helpers
internal class ModernInkAnalyzer : IDisposable internal class ModernInkAnalyzer : IDisposable
{ {
public static readonly Guid ShapeStrokePropertyGuid = new Guid("11111111-2222-3333-4444-555555555555"); public static readonly Guid ShapeStrokePropertyGuid = new Guid("11111111-2222-3333-4444-555555555555");
private global::Windows.UI.Input.Inking.Analysis.InkAnalyzer _internalAnalyzer; private global::Windows.UI.Input.Inking.Analysis.InkAnalyzer _internalAnalyzer;
private readonly Dictionary<Stroke, uint> _strokeIdMap = new Dictionary<Stroke, uint>(); private readonly Dictionary<Stroke, uint> _strokeIdMap = new Dictionary<Stroke, uint>();
private readonly Dictionary<uint, Stroke> _reverseIdMap = new Dictionary<uint, Stroke>(); private readonly Dictionary<uint, Stroke> _reverseIdMap = new Dictionary<uint, Stroke>();
@@ -41,7 +41,7 @@ namespace Ink_Canvas.Helpers
_internalAnalyzer.SetStrokeDataKind( _internalAnalyzer.SetStrokeDataKind(
inkStroke.Id, inkStroke.Id,
global::Windows.UI.Input.Inking.Analysis.InkAnalysisStrokeKind.Drawing); global::Windows.UI.Input.Inking.Analysis.InkAnalysisStrokeKind.Drawing);
_strokeIdMap[stroke] = inkStroke.Id; _strokeIdMap[stroke] = inkStroke.Id;
_reverseIdMap[inkStroke.Id] = stroke; _reverseIdMap[inkStroke.Id] = stroke;
} }
+1 -3
View File
@@ -1,6 +1,6 @@
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using Ink_Canvas.Windows.SettingsViews.Helpers;
using Ink_Canvas.Windows; using Ink_Canvas.Windows;
using Ink_Canvas.Windows.SettingsViews.Helpers;
using iNKORE.UI.WPF.Modern; using iNKORE.UI.WPF.Modern;
using iNKORE.UI.WPF.Modern.Controls; using iNKORE.UI.WPF.Modern.Controls;
using Microsoft.Win32; using Microsoft.Win32;
@@ -13,7 +13,6 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@@ -32,7 +31,6 @@ using Cursor = System.Windows.Input.Cursor;
using Cursors = System.Windows.Input.Cursors; using Cursors = System.Windows.Input.Cursors;
using DpiChangedEventArgs = System.Windows.DpiChangedEventArgs; using DpiChangedEventArgs = System.Windows.DpiChangedEventArgs;
using File = System.IO.File; using File = System.IO.File;
using GroupBox = System.Windows.Controls.GroupBox;
using HorizontalAlignment = System.Windows.HorizontalAlignment; using HorizontalAlignment = System.Windows.HorizontalAlignment;
using MessageBox = iNKORE.UI.WPF.Modern.Controls.MessageBox; using MessageBox = iNKORE.UI.WPF.Modern.Controls.MessageBox;
using Point = System.Windows.Point; using Point = System.Windows.Point;
-1
View File
@@ -4,7 +4,6 @@ using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
@@ -3,10 +3,8 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace Ink_Canvas namespace Ink_Canvas
{ {
-2
View File
@@ -1,13 +1,11 @@
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Ink; using System.Windows.Ink;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
namespace Ink_Canvas namespace Ink_Canvas
@@ -1,6 +1,5 @@
using Ink_Canvas.Controls; using Ink_Canvas.Controls;
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using Ink_Canvas.Windows.SettingsViews.Helpers;
using iNKORE.UI.WPF.Modern; using iNKORE.UI.WPF.Modern;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
@@ -1,6 +1,5 @@
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using System; using System;
using System.Linq;
using System.Windows; using System.Windows;
namespace Ink_Canvas namespace Ink_Canvas
+1 -1
View File
@@ -217,7 +217,7 @@ namespace Ink_Canvas
public static string ScreenshotIconGeometry = "F0 M24,24z M0,0z M9,3C8.46957,3,7.96086,3.21071,7.58579,3.58579,7.21071,3.96086,7,4.46957,7,5,7,5.26522,6.89464,5.51957,6.70711,5.70711,6.51957,5.89464,6.26522,6,6,6L5,6C4.20435,6,3.44129,6.31607,2.87868,6.87868,2.31607,7.44129,2,8.20435,2,9L2,18C2,18.7956,2.31607,19.5587,2.87868,20.1213,3.44129,20.6839,4.20435,21,5,21L19,21C19.7957,21,20.5587,20.6839,21.1213,20.1213,21.6839,19.5587,22,18.7957,22,18L22,9C22,8.20435,21.6839,7.44129,21.1213,6.87868,20.5587,6.31607,19.7957,6,19,6L18,6C17.7348,6,17.4804,5.89464,17.2929,5.70711,17.1054,5.51957,17,5.26522,17,5,17,4.46957,16.7893,3.96086,16.4142,3.58579,16.0391,3.21071,15.5304,3,15,3L9,3z M9,5L15,5C15,5.79565,15.3161,6.55871,15.8787,7.12132,16.4413,7.68393,17.2044,8,18,8L19,8C19.2652,8,19.5196,8.10536,19.7071,8.29289,19.8946,8.48043,20,8.73478,20,9L20,18C20,18.2652,19.8946,18.5196,19.7071,18.7071,19.5196,18.8946,19.2652,19,19,19L5,19C4.73478,19,4.48043,18.8946,4.29289,18.7071,4.10536,18.5196,4,18.2652,4,18L4,9C4,8.73478,4.10536,8.48043,4.29289,8.29289,4.48043,8.10536,4.73478,8,5,8L6,8C6.79565,8,7.55871,7.68393,8.12132,7.12132,8.68393,6.55871,9,5.79565,9,5z M12,9C10.9391,9,9.92172,9.42143,9.17157,10.1716,8.42143,10.9217,8,11.9391,8,13,8,14.0609,8.42143,15.0783,9.17157,15.8284,9.92172,16.5786,10.9391,17,12,17,13.0609,17,14.0783,16.5786,14.8284,15.8284,15.5786,15.0783,16,14.0609,16,13,16,11.9391,15.5786,10.9217,14.8284,10.1716,14.0783,9.42143,13.0609,9,12,9z M10.5858,11.5858C10.9609,11.2107,11.4696,11,12,11,12.5304,11,13.0391,11.2107,13.4142,11.5858,13.7893,11.9609,14,12.4696,14,13,14,13.5304,13.7893,14.0391,13.4142,14.4142,13.0391,14.7893,12.5304,15,12,15,11.4696,15,10.9609,14.7893,10.5858,14.4142,10.2107,14.0391,10,13.5304,10,13,10,12.4696,10.2107,11.9609,10.5858,11.5858z"; public static string ScreenshotIconGeometry = "F0 M24,24z M0,0z M9,3C8.46957,3,7.96086,3.21071,7.58579,3.58579,7.21071,3.96086,7,4.46957,7,5,7,5.26522,6.89464,5.51957,6.70711,5.70711,6.51957,5.89464,6.26522,6,6,6L5,6C4.20435,6,3.44129,6.31607,2.87868,6.87868,2.31607,7.44129,2,8.20435,2,9L2,18C2,18.7956,2.31607,19.5587,2.87868,20.1213,3.44129,20.6839,4.20435,21,5,21L19,21C19.7957,21,20.5587,20.6839,21.1213,20.1213,21.6839,19.5587,22,18.7957,22,18L22,9C22,8.20435,21.6839,7.44129,21.1213,6.87868,20.5587,6.31607,19.7957,6,19,6L18,6C17.7348,6,17.4804,5.89464,17.2929,5.70711,17.1054,5.51957,17,5.26522,17,5,17,4.46957,16.7893,3.96086,16.4142,3.58579,16.0391,3.21071,15.5304,3,15,3L9,3z M9,5L15,5C15,5.79565,15.3161,6.55871,15.8787,7.12132,16.4413,7.68393,17.2044,8,18,8L19,8C19.2652,8,19.5196,8.10536,19.7071,8.29289,19.8946,8.48043,20,8.73478,20,9L20,18C20,18.2652,19.8946,18.5196,19.7071,18.7071,19.5196,18.8946,19.2652,19,19,19L5,19C4.73478,19,4.48043,18.8946,4.29289,18.7071,4.10536,18.5196,4,18.2652,4,18L4,9C4,8.73478,4.10536,8.48043,4.29289,8.29289,4.48043,8.10536,4.73478,8,5,8L6,8C6.79565,8,7.55871,7.68393,8.12132,7.12132,8.68393,6.55871,9,5.79565,9,5z M12,9C10.9391,9,9.92172,9.42143,9.17157,10.1716,8.42143,10.9217,8,11.9391,8,13,8,14.0609,8.42143,15.0783,9.17157,15.8284,9.92172,16.5786,10.9391,17,12,17,13.0609,17,14.0783,16.5786,14.8284,15.8284,15.5786,15.0783,16,14.0609,16,13,16,11.9391,15.5786,10.9217,14.8284,10.1716,14.0783,9.42143,13.0609,9,12,9z M10.5858,11.5858C10.9609,11.2107,11.4696,11,12,11,12.5304,11,13.0391,11.2107,13.4142,11.5858,13.7893,11.9609,14,12.4696,14,13,14,13.5304,13.7893,14.0391,13.4142,14.4142,13.0391,14.7893,12.5304,15,12,15,11.4696,15,10.9609,14.7893,10.5858,14.4142,10.2107,14.0391,10,13.5304,10,13,10,12.4696,10.2107,11.9609,10.5858,11.5858z";
public static string ManualIconGeometry = "F0 M24,24z M0,0z M8.17317,2.7612C9.38642,2.25866 10.6868,2 12,2 13.3132,2 14.6136,2.25866 15.8268,2.7612 17.0401,3.26375 18.1425,4.00035 19.0711,4.92893 19.9997,5.85752 20.7362,6.95991 21.2388,8.17317 21.7413,9.38642 22,10.6868 22,12 22,13.3132 21.7413,14.6136 21.2388,15.8268 20.7362,17.0401 19.9997,18.1425 19.0711,19.0711 18.1425,19.9997 17.0401,20.7362 15.8268,21.2388 14.6136,21.7413 13.3132,22 12,22 10.6868,22 9.38642,21.7413 8.17317,21.2388 6.95991,20.7362 5.85752,19.9997 4.92893,19.0711 4.00035,18.1425 3.26375,17.0401 2.7612,15.8268 2.25866,14.6136 2,13.3132 2,12 2,10.6868 2.25866,9.38642 2.7612,8.17317 3.26375,6.95991 4.00035,5.85752 4.92893,4.92893 5.85752,4.00035 6.95991,3.26375 8.17317,2.7612z M12,4C10.9494,4 9.90914,4.20693 8.93853,4.60896 7.96793,5.011 7.08601,5.60028 6.34315,6.34315 5.60028,7.08601 5.011,7.96793 4.60896,8.93853 4.20693,9.90914 4,10.9494 4,12 4,13.0506 4.20693,14.0909 4.60896,15.0615 5.011,16.0321 5.60028,16.914 6.34315,17.6569 7.08601,18.3997 7.96793,18.989 8.93853,19.391 9.90914,19.7931 10.9494,20 12,20 13.0506,20 14.0909,19.7931 15.0615,19.391 16.0321,18.989 16.914,18.3997 17.6569,17.6569 18.3997,16.914 18.989,16.0321 19.391,15.0615 19.7931,14.0909 20,13.0506 20,12 20,10.9494 19.7931,9.90914 19.391,8.93853 18.989,7.96793 18.3997,7.08602 17.6569,6.34315 16.914,5.60028 16.0321,5.011 15.0615,4.60896 14.0909,4.20693 13.0506,4 12,4z M12,16C12.5523,16,13,16.4477,13,17L13,17.01C13,17.5623 12.5523,18.01 12,18.01 11.4477,18.01 11,17.5623 11,17.01L11,17C11,16.4477,11.4477,16,12,16z M12.0813,5.97153C11.5241,5.96998 10.9742,6.09779 10.4748,6.3449 9.97535,6.59201 9.54013,6.95167 9.20334,7.39557 8.86952,7.83555 8.95559,8.46284 9.39557,8.79666 9.83555,9.13047 10.4628,9.04441 10.7967,8.60443 10.9463,8.40714 11.1398,8.24729 11.3617,8.13746 11.5837,8.02764 11.8281,7.97083 12.0758,7.97152 12.3234,7.97221 12.5675,8.03037 12.7888,8.14142 13.0102,8.25248 13.2027,8.4134 13.3513,8.61151 13.4999,8.80963 13.6005,9.03953 13.6451,9.28311 13.6897,9.5267 13.6772,9.77732 13.6086,10.0152 13.5399,10.2532 13.4169,10.4719 13.2493,10.6542 13.084,10.8341 12.8798,10.9736 12.6524,11.0623 12.1479,11.2435 11.7149,11.5821 11.4175,12.0283 11.1169,12.4792 10.9709,13.0156 11.0016,13.5566 11.0329,14.108 11.5052,14.5297 12.0566,14.4984 12.608,14.4671 13.0297,13.9948 12.9984,13.4434 12.9923,13.3352 13.0214,13.2279 13.0816,13.1377 13.1417,13.0475 13.2295,12.9793 13.3317,12.9434 13.3403,12.9404 13.3487,12.9373 13.3572,12.934 13.8776,12.735 14.3448,12.4179 14.7218,12.0077 15.0989,11.5974 15.3756,11.1053 15.5301,10.5699 15.6846,10.0346 15.7128,9.47068 15.6124,8.92261 15.5119,8.37454 15.2856,7.85727 14.9513,7.41151 14.617,6.96576 14.1838,6.60369 13.6857,6.35381 13.1877,6.10393 12.6385,5.97307 12.0813,5.97153z" ; public static string ManualIconGeometry = "F0 M24,24z M0,0z M8.17317,2.7612C9.38642,2.25866 10.6868,2 12,2 13.3132,2 14.6136,2.25866 15.8268,2.7612 17.0401,3.26375 18.1425,4.00035 19.0711,4.92893 19.9997,5.85752 20.7362,6.95991 21.2388,8.17317 21.7413,9.38642 22,10.6868 22,12 22,13.3132 21.7413,14.6136 21.2388,15.8268 20.7362,17.0401 19.9997,18.1425 19.0711,19.0711 18.1425,19.9997 17.0401,20.7362 15.8268,21.2388 14.6136,21.7413 13.3132,22 12,22 10.6868,22 9.38642,21.7413 8.17317,21.2388 6.95991,20.7362 5.85752,19.9997 4.92893,19.0711 4.00035,18.1425 3.26375,17.0401 2.7612,15.8268 2.25866,14.6136 2,13.3132 2,12 2,10.6868 2.25866,9.38642 2.7612,8.17317 3.26375,6.95991 4.00035,5.85752 4.92893,4.92893 5.85752,4.00035 6.95991,3.26375 8.17317,2.7612z M12,4C10.9494,4 9.90914,4.20693 8.93853,4.60896 7.96793,5.011 7.08601,5.60028 6.34315,6.34315 5.60028,7.08601 5.011,7.96793 4.60896,8.93853 4.20693,9.90914 4,10.9494 4,12 4,13.0506 4.20693,14.0909 4.60896,15.0615 5.011,16.0321 5.60028,16.914 6.34315,17.6569 7.08601,18.3997 7.96793,18.989 8.93853,19.391 9.90914,19.7931 10.9494,20 12,20 13.0506,20 14.0909,19.7931 15.0615,19.391 16.0321,18.989 16.914,18.3997 17.6569,17.6569 18.3997,16.914 18.989,16.0321 19.391,15.0615 19.7931,14.0909 20,13.0506 20,12 20,10.9494 19.7931,9.90914 19.391,8.93853 18.989,7.96793 18.3997,7.08602 17.6569,6.34315 16.914,5.60028 16.0321,5.011 15.0615,4.60896 14.0909,4.20693 13.0506,4 12,4z M12,16C12.5523,16,13,16.4477,13,17L13,17.01C13,17.5623 12.5523,18.01 12,18.01 11.4477,18.01 11,17.5623 11,17.01L11,17C11,16.4477,11.4477,16,12,16z M12.0813,5.97153C11.5241,5.96998 10.9742,6.09779 10.4748,6.3449 9.97535,6.59201 9.54013,6.95167 9.20334,7.39557 8.86952,7.83555 8.95559,8.46284 9.39557,8.79666 9.83555,9.13047 10.4628,9.04441 10.7967,8.60443 10.9463,8.40714 11.1398,8.24729 11.3617,8.13746 11.5837,8.02764 11.8281,7.97083 12.0758,7.97152 12.3234,7.97221 12.5675,8.03037 12.7888,8.14142 13.0102,8.25248 13.2027,8.4134 13.3513,8.61151 13.4999,8.80963 13.6005,9.03953 13.6451,9.28311 13.6897,9.5267 13.6772,9.77732 13.6086,10.0152 13.5399,10.2532 13.4169,10.4719 13.2493,10.6542 13.084,10.8341 12.8798,10.9736 12.6524,11.0623 12.1479,11.2435 11.7149,11.5821 11.4175,12.0283 11.1169,12.4792 10.9709,13.0156 11.0016,13.5566 11.0329,14.108 11.5052,14.5297 12.0566,14.4984 12.608,14.4671 13.0297,13.9948 12.9984,13.4434 12.9923,13.3352 13.0214,13.2279 13.0816,13.1377 13.1417,13.0475 13.2295,12.9793 13.3317,12.9434 13.3403,12.9404 13.3487,12.9373 13.3572,12.934 13.8776,12.735 14.3448,12.4179 14.7218,12.0077 15.0989,11.5974 15.3756,11.1053 15.5301,10.5699 15.6846,10.0346 15.7128,9.47068 15.6124,8.92261 15.5119,8.37454 15.2856,7.85727 14.9513,7.41151 14.617,6.96576 14.1838,6.60369 13.6857,6.35381 13.1877,6.10393 12.6385,5.97307 12.0813,5.97153z";
public static string SettingsIconGeometry = "F0 M24,24z M0,0z M4.66591,7.13141L11.4017,3.15976C11.5957,3.0552,11.8126,3.00041,12.033,3.00041,12.2534,3.00041,12.4704,3.0552,12.6643,3.15977L19.2182,7.02415C19.2676,7.06721,19.3219,7.10586,19.3806,7.13926,19.5699,7.24687,19.727,7.40296,19.8358,7.59146,19.9447,7.77997,20.0014,7.99407,20,8.21175L20,8.21175,20,8.218,20,15.502C20,15.943,19.7585,16.3548,19.3603,16.5737,19.3424,16.5835,19.3247,16.5939,19.3074,16.6049L12.5874,20.8559C12.4062,20.9506,12.2047,21.0001,12,21.0001,11.7953,21.0001,11.5938,20.9506,11.4126,20.8559L4.69261,16.6049C4.6746,16.5935,4.65624,16.5827,4.63755,16.5725,4.44494,16.4672,4.28416,16.3122,4.172,16.1235,4.05999,15.9351,4.00059,15.72,4,15.5008L4,8.217C4,7.77653,4.24107,7.36544,4.63968,7.14635,4.6485,7.1415,4.65724,7.13652,4.66591,7.13141z M20.4159,5.40859C20.4791,5.44583,20.5369,5.4892,20.589,5.53759,20.9895,5.81003,21.3244,6.16988,21.5678,6.59125,21.8538,7.08656,22.003,7.649,22,8.22093L22,15.502C22,16.6678,21.3677,17.7387,20.353,18.31L13.6266,22.5651C13.6092,22.5761,13.5914,22.5866,13.5733,22.5966,13.0911,22.8613,12.55,23.0001,12,23.0001,11.45,23.0001,10.9089,22.8613,10.4267,22.5966,10.4086,22.5866,10.3908,22.5761,10.3734,22.5651L3.64791,18.3106C3.15439,18.0339,2.74214,17.6322,2.45282,17.1455,2.15755,16.6488,2.00116,16.0818,2,15.504L2,15.502,2,8.217C2,7.04497,2.63892,5.97063,3.6619,5.40163L10.4001,1.42859C10.4084,1.4237,10.4167,1.41894,10.4252,1.41429,10.9176,1.1428,11.4707,1.00041,12.033,1.00041,12.5953,1.00041,13.1484,1.1428,13.6408,1.41429,13.6493,1.41894,13.6576,1.4237,13.6659,1.42859L20.4159,5.40859z M12,8C10.9391,8,9.92172,8.42143,9.17157,9.17157,8.42143,9.92172,8,10.9391,8,12,8,13.0609,8.42143,14.0783,9.17157,14.8284,9.92172,15.5786,10.9391,16,12,16,13.0609,16,14.0783,15.5786,14.8284,14.8284,15.5786,14.0783,16,13.0609,16,12,16,10.9391,15.5786,9.92172,14.8284,9.17157,14.0783,8.42143,13.0609,8,12,8z M10.5858,10.5858C10.9609,10.2107,11.4696,10,12,10,12.5304,10,13.0391,10.2107,13.4142,10.5858,13.7893,10.9609,14,11.4696,14,12,14,12.5304,13.7893,13.0391,13.4142,13.4142,13.0391,13.7893,12.5304,14,12,14,11.4696,14,10.9609,13.7893,10.5858,13.4142,10.2107,13.0391,10,12.5304,10,12,10,11.4696,10.2107,10.9609,10.5858,10.5858z"; public static string SettingsIconGeometry = "F0 M24,24z M0,0z M4.66591,7.13141L11.4017,3.15976C11.5957,3.0552,11.8126,3.00041,12.033,3.00041,12.2534,3.00041,12.4704,3.0552,12.6643,3.15977L19.2182,7.02415C19.2676,7.06721,19.3219,7.10586,19.3806,7.13926,19.5699,7.24687,19.727,7.40296,19.8358,7.59146,19.9447,7.77997,20.0014,7.99407,20,8.21175L20,8.21175,20,8.218,20,15.502C20,15.943,19.7585,16.3548,19.3603,16.5737,19.3424,16.5835,19.3247,16.5939,19.3074,16.6049L12.5874,20.8559C12.4062,20.9506,12.2047,21.0001,12,21.0001,11.7953,21.0001,11.5938,20.9506,11.4126,20.8559L4.69261,16.6049C4.6746,16.5935,4.65624,16.5827,4.63755,16.5725,4.44494,16.4672,4.28416,16.3122,4.172,16.1235,4.05999,15.9351,4.00059,15.72,4,15.5008L4,8.217C4,7.77653,4.24107,7.36544,4.63968,7.14635,4.6485,7.1415,4.65724,7.13652,4.66591,7.13141z M20.4159,5.40859C20.4791,5.44583,20.5369,5.4892,20.589,5.53759,20.9895,5.81003,21.3244,6.16988,21.5678,6.59125,21.8538,7.08656,22.003,7.649,22,8.22093L22,15.502C22,16.6678,21.3677,17.7387,20.353,18.31L13.6266,22.5651C13.6092,22.5761,13.5914,22.5866,13.5733,22.5966,13.0911,22.8613,12.55,23.0001,12,23.0001,11.45,23.0001,10.9089,22.8613,10.4267,22.5966,10.4086,22.5866,10.3908,22.5761,10.3734,22.5651L3.64791,18.3106C3.15439,18.0339,2.74214,17.6322,2.45282,17.1455,2.15755,16.6488,2.00116,16.0818,2,15.504L2,15.502,2,8.217C2,7.04497,2.63892,5.97063,3.6619,5.40163L10.4001,1.42859C10.4084,1.4237,10.4167,1.41894,10.4252,1.41429,10.9176,1.1428,11.4707,1.00041,12.033,1.00041,12.5953,1.00041,13.1484,1.1428,13.6408,1.41429,13.6493,1.41894,13.6576,1.4237,13.6659,1.42859L20.4159,5.40859z M12,8C10.9391,8,9.92172,8.42143,9.17157,9.17157,8.42143,9.92172,8,10.9391,8,12,8,13.0609,8.42143,14.0783,9.17157,14.8284,9.92172,15.5786,10.9391,16,12,16,13.0609,16,14.0783,15.5786,14.8284,14.8284,15.5786,14.0783,16,13.0609,16,12,16,10.9391,15.5786,9.92172,14.8284,9.17157,14.0783,8.42143,13.0609,8,12,8z M10.5858,10.5858C10.9609,10.2107,11.4696,10,12,10,12.5304,10,13.0391,10.2107,13.4142,10.5858,13.7893,10.9609,14,11.4696,14,12,14,12.5304,13.7893,13.0391,13.4142,13.4142,13.0391,13.7893,12.5304,14,12,14,11.4696,14,10.9609,13.7893,10.5858,13.4142,10.2107,13.0391,10,12.5304,10,12,10,11.4696,10.2107,10.9609,10.5858,10.5858z";
@@ -1,6 +1,5 @@
using Ink_Canvas.Controls; using Ink_Canvas.Controls;
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using iNKORE.UI.WPF.Controls;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
-15
View File
@@ -1,32 +1,17 @@
using H.NotifyIcon;
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using Ink_Canvas.Windows.SettingsViews.Helpers; using Ink_Canvas.Windows.SettingsViews.Helpers;
using Newtonsoft.Json;
using OSVersionExtension;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Threading; using System.Windows.Threading;
using Application = System.Windows.Application;
using CheckBox = System.Windows.Controls.CheckBox;
using ComboBox = System.Windows.Controls.ComboBox;
using File = System.IO.File;
using MessageBox = iNKORE.UI.WPF.Modern.Controls.MessageBox;
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
using OperatingSystem = OSVersionExtension.OperatingSystem;
using RadioButton = System.Windows.Controls.RadioButton; using RadioButton = System.Windows.Controls.RadioButton;
namespace Ink_Canvas namespace Ink_Canvas
@@ -1,11 +1,9 @@
using H.NotifyIcon;
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OSVersionExtension; using OSVersionExtension;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Ink; using System.Windows.Ink;
@@ -9,7 +9,6 @@ using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Ink; using System.Windows.Ink;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using System.Windows.Threading; using System.Windows.Threading;
using MessageBox = iNKORE.UI.WPF.Modern.Controls.MessageBox; using MessageBox = iNKORE.UI.WPF.Modern.Controls.MessageBox;
@@ -623,7 +623,7 @@ namespace Ink_Canvas
var shapeMode = ShapeRecognitionRouter.FromSettingsInt(Settings.InkToShape.ShapeRecognitionEngine); var shapeMode = ShapeRecognitionRouter.FromSettingsInt(Settings.InkToShape.ShapeRecognitionEngine);
InkShapeRecognitionResult result = InkShapeRecognitionResult.Empty; InkShapeRecognitionResult result = InkShapeRecognitionResult.Empty;
if (ShapeRecognitionRouter.ResolveUseWinRt(shapeMode) && Helpers.WinRtInkShapeRecognizer.IsApiAvailable) if (ShapeRecognitionRouter.ResolveUseWinRt(shapeMode) && Helpers.WinRtInkShapeRecognizer.IsApiAvailable)
{ {
result = await ModernInkAnalyzer.AnalyzeAsync(newStrokes); result = await ModernInkAnalyzer.AnalyzeAsync(newStrokes);
+22 -22
View File
@@ -1043,13 +1043,13 @@ namespace Ink_Canvas
{ {
unfoldFloatingBarByUser = false; unfoldFloatingBarByUser = false;
} }
else else
{ {
// schedule unfold if dispatcher still running // schedule unfold if dispatcher still running
if (Dispatcher.HasShutdownStarted || Dispatcher.HasShutdownFinished) return; if (Dispatcher.HasShutdownStarted || Dispatcher.HasShutdownFinished) return;
UnFoldFloatingBar_MouseUp(new object(), null); UnFoldFloatingBar_MouseUp(new object(), null);
unfoldFloatingBarByUser = false; unfoldFloatingBarByUser = false;
} }
} }
} }
} }
@@ -1172,28 +1172,28 @@ namespace Ink_Canvas
if (Dispatcher.HasShutdownStarted || Dispatcher.HasShutdownFinished) return; if (Dispatcher.HasShutdownStarted || Dispatcher.HasShutdownFinished) return;
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
try try
{
// 判断是否处于批注模式(inkCanvas.EditingMode == InkCanvasEditingMode.Ink
// 判断是否处于画板模式(!Topmost)
if (inkCanvas.EditingMode != InkCanvasEditingMode.Ink && Topmost)
{ {
// 检查是否有未保存的内容或正在进行的操作 // 判断是否处于批注模式(inkCanvas.EditingMode == InkCanvasEditingMode.Ink
if (!isHidingSubPanelsWhenInking) // 判断是否处于画板模式(!Topmost)
if (inkCanvas.EditingMode != InkCanvasEditingMode.Ink && Topmost)
{ {
canSafelyUpdate = true; // 检查是否有未保存的内容或正在进行的操作
LogHelper.WriteLogToFile("AutoUpdate | Application is in a safe state for update - not in ink or board mode"); if (!isHidingSubPanelsWhenInking)
{
canSafelyUpdate = true;
LogHelper.WriteLogToFile("AutoUpdate | Application is in a safe state for update - not in ink or board mode");
}
else
{
LogHelper.WriteLogToFile("AutoUpdate | Application is currently performing operations");
}
} }
else else
{ {
LogHelper.WriteLogToFile("AutoUpdate | Application is currently performing operations"); LogHelper.WriteLogToFile("AutoUpdate | Application is in ink or board mode, cannot update now");
} }
} }
else
{
LogHelper.WriteLogToFile("AutoUpdate | Application is in ink or board mode, cannot update now");
}
}
catch (Exception ex) catch (Exception ex)
{ {
LogHelper.WriteLogToFile($"AutoUpdate | Error checking application state: {ex.Message}", LogHelper.LogType.Error); LogHelper.WriteLogToFile($"AutoUpdate | Error checking application state: {ex.Message}", LogHelper.LogType.Error);
-1
View File
@@ -1,5 +1,4 @@
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using Ink_Canvas.Plugins;
namespace Ink_Canvas.Plugins namespace Ink_Canvas.Plugins
{ {
-2
View File
@@ -1,7 +1,5 @@
using Ink_Canvas.Plugins;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Threading;
namespace Ink_Canvas.Plugins namespace Ink_Canvas.Plugins
{ {
+2 -2
View File
@@ -60,7 +60,7 @@ namespace Ink_Canvas.Plugins
Log(string.Format("Loading plugins from: {0}", _pluginsDirectory)); Log(string.Format("Loading plugins from: {0}", _pluginsDirectory));
var pluginFiles = new List<string>(); var pluginFiles = new List<string>();
try try
{ {
var topLevelFiles = Directory.GetFiles(_pluginsDirectory, "*.dll", SearchOption.TopDirectoryOnly); var topLevelFiles = Directory.GetFiles(_pluginsDirectory, "*.dll", SearchOption.TopDirectoryOnly);
@@ -123,7 +123,7 @@ namespace Ink_Canvas.Plugins
Log(string.Format("Loading plugin: {0}", fileName)); Log(string.Format("Loading plugin: {0}", fileName));
var alc = new PluginAssemblyLoadContext(pluginFile, isCollectible: true); var alc = new PluginAssemblyLoadContext(pluginFile, isCollectible: true);
try try
{ {
var assembly = alc.LoadFromAssemblyPath(pluginFile); var assembly = alc.LoadFromAssemblyPath(pluginFile);
@@ -5,7 +5,6 @@ using System.IO;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Interop; using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Threading; using System.Windows.Threading;
@@ -1,6 +1,5 @@
using IWshRuntimeLibrary; using IWshRuntimeLibrary;
using System; using System;
using System.IO;
using File = System.IO.File; using File = System.IO.File;
namespace Ink_Canvas.Windows.SettingsViews.Helpers namespace Ink_Canvas.Windows.SettingsViews.Helpers
@@ -1,10 +1,10 @@
using Ink_Canvas.Helpers;
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security.Principal; using System.Security.Principal;
using System.Windows; using System.Windows;
using System.Windows.Interop; using System.Windows.Interop;
using System.Windows.Threading; using System.Windows.Threading;
using Ink_Canvas.Helpers;
namespace Ink_Canvas.Windows.SettingsViews.Helpers namespace Ink_Canvas.Windows.SettingsViews.Helpers
{ {
@@ -7,7 +7,6 @@ using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Threading;
using ContentDialog = iNKORE.UI.WPF.Modern.Controls.ContentDialog; using ContentDialog = iNKORE.UI.WPF.Modern.Controls.ContentDialog;
using MessageBox = System.Windows.MessageBox; using MessageBox = System.Windows.MessageBox;
using Page = iNKORE.UI.WPF.Modern.Controls.Page; using Page = iNKORE.UI.WPF.Modern.Controls.Page;
@@ -354,7 +354,9 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
{ {
var checkBox = new CheckBox var checkBox = new CheckBox
{ {
Content = category.Value, Tag = category.Key, FontSize = 13, Content = category.Value,
Tag = category.Key,
FontSize = 13,
IsChecked = implicitAllCategories || savedHitokoto.Contains(category.Key), IsChecked = implicitAllCategories || savedHitokoto.Contains(category.Key),
Margin = new Thickness(0, 0, 0, 8) Margin = new Thickness(0, 0, 0, 8)
}; };
@@ -89,7 +89,12 @@ namespace Ink_Canvas.Windows.SettingsViews.Pages
CardAutoDelSavedFiles.IsOn = auto.AutoDelSavedFiles; CardAutoDelSavedFiles.IsOn = auto.AutoDelSavedFiles;
ComboBoxAutoDelSavedFilesDaysThreshold.SelectedIndex = auto.AutoDelSavedFilesDaysThreshold switch ComboBoxAutoDelSavedFilesDaysThreshold.SelectedIndex = auto.AutoDelSavedFilesDaysThreshold switch
{ {
7 => 0, 14 => 1, 30 => 2, 60 => 3, 90 => 4, _ => 2 7 => 0,
14 => 1,
30 => 2,
60 => 3,
90 => 4,
_ => 2
}; };
SideControlMinimumAutomationSlider.Value = auto.MinimumAutomationStrokeNumber; SideControlMinimumAutomationSlider.Value = auto.MinimumAutomationStrokeNumber;
@@ -1,6 +1,4 @@
using Ink_Canvas.Helpers;
using Ink_Canvas.Windows.SettingsViews.Helpers; using Ink_Canvas.Windows.SettingsViews.Helpers;
using System;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media; using System.Windows.Media;
@@ -6,7 +6,6 @@ using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Interop; using System.Windows.Interop;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Media;
using MessageBox = System.Windows.MessageBox; using MessageBox = System.Windows.MessageBox;
using Screen = System.Windows.Forms.Screen; using Screen = System.Windows.Forms.Screen;
@@ -495,7 +494,7 @@ namespace Ink_Canvas.Windows.SettingsViews
if (settingsView != null) if (settingsView != null)
{ {
var pageTag = string.Format("PluginSettings_{0}", plugin.Id); var pageTag = string.Format("PluginSettings_{0}", plugin.Id);
_pageTypes[pageTag] = typeof(PluginSettingsPage); _pageTypes[pageTag] = typeof(PluginSettingsPage);
_pluginPages[pageTag] = plugin; _pluginPages[pageTag] = plugin;
@@ -47,7 +47,7 @@ namespace Ink_Canvas
private void YesOrNoNotificationWindow_Loaded(object sender, RoutedEventArgs e) private void YesOrNoNotificationWindow_Loaded(object sender, RoutedEventArgs e)
{ {
_hwnd = new WindowInteropHelper(this).Handle; _hwnd = new WindowInteropHelper(this).Handle;
Topmost = true; Topmost = true;
Activate(); Activate();
Focus(); Focus();
@@ -71,13 +71,13 @@ namespace Ink_Canvas
if (_hwnd == IntPtr.Zero) return; if (_hwnd == IntPtr.Zero) return;
var foregroundWindow = GetForegroundWindow(); var foregroundWindow = GetForegroundWindow();
if (foregroundWindow != _hwnd && IsWindowVisible(_hwnd)) if (foregroundWindow != _hwnd && IsWindowVisible(_hwnd))
{ {
Topmost = true; Topmost = true;
Activate(); Activate();
Focus(); Focus();
SetWindowPos(_hwnd, HWND_TOPMOST, 0, 0, 0, 0, SetWindowPos(_hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER); SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER);
} }
@@ -67,7 +67,7 @@ namespace Ink_Canvas.Controls
{ {
var button = (CircularColorButton)d; var button = (CircularColorButton)d;
if (button.ButtonBorder == null || button.ColorOverlay == null) return; if (button.ButtonBorder == null || button.ColorOverlay == null) return;
var size = (double)e.NewValue; var size = (double)e.NewValue;
button.ButtonBorder.Width = size; button.ButtonBorder.Width = size;
button.ButtonBorder.Height = size; button.ButtonBorder.Height = size;
@@ -1,4 +1,3 @@
using System;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
@@ -1,7 +1,7 @@
using iNKORE.UI.WPF.Modern.Common.IconKeys;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media; using System.Windows.Media;
using iNKORE.UI.WPF.Modern.Common.IconKeys;
namespace Ink_Canvas.Controls namespace Ink_Canvas.Controls
{ {
@@ -1,5 +1,3 @@
using System;
namespace Ink_Canvas.Plugins namespace Ink_Canvas.Plugins
{ {
public interface IAppRestartService public interface IAppRestartService
-1
View File
@@ -1,4 +1,3 @@
using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Ink_Canvas.Plugins namespace Ink_Canvas.Plugins
-2
View File
@@ -1,5 +1,3 @@
using System;
namespace Ink_Canvas.Plugins namespace Ink_Canvas.Plugins
{ {
public interface IPlugin public interface IPlugin
-2
View File
@@ -1,5 +1,3 @@
using System;
namespace Ink_Canvas.Plugins namespace Ink_Canvas.Plugins
{ {
public class PluginInfo public class PluginInfo