From 761992d089dd6b636999c34b18f8c65eb197f7b4 Mon Sep 17 00:00:00 2001
From: CJKmkp <2564608840@qq.com>
Date: Sun, 26 Oct 2025 00:31:32 +0800
Subject: [PATCH 01/34] Delete PositionConverters.cs
---
Ink Canvas/Converters/PositionConverters.cs | 35 ---------------------
1 file changed, 35 deletions(-)
delete mode 100644 Ink Canvas/Converters/PositionConverters.cs
diff --git a/Ink Canvas/Converters/PositionConverters.cs b/Ink Canvas/Converters/PositionConverters.cs
deleted file mode 100644
index d97093e4..00000000
--- a/Ink Canvas/Converters/PositionConverters.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-using System.Globalization;
-using System.Windows.Data;
-
-namespace Ink_Canvas.Converters
-{
- ///
- /// 位置计算转换器
- ///
- public class PositionConverters
- {
- ///
- /// 减法转换器
- ///
- public class SubtractConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is double baseValue && parameter is string paramStr)
- {
- if (double.TryParse(paramStr, out double subtractValue))
- {
- return baseValue - subtractValue;
- }
- }
- return value;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
-}
From 10f55d5b6563b6486f8025daa865dafbdf3d38a8 Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Mon, 27 Oct 2025 17:45:41 +0800
Subject: [PATCH 02/34] =?UTF-8?q?fix:=E6=8A=BD=E9=80=89=E7=BB=93=E6=9E=9C?=
=?UTF-8?q?=E6=88=AA=E6=96=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Windows/NewStyleRollCallWindow.xaml | 201 +++++++++++-------
1 file changed, 121 insertions(+), 80 deletions(-)
diff --git a/Ink Canvas/Windows/NewStyleRollCallWindow.xaml b/Ink Canvas/Windows/NewStyleRollCallWindow.xaml
index 1a62ceef..85f7dc31 100644
--- a/Ink Canvas/Windows/NewStyleRollCallWindow.xaml
+++ b/Ink Canvas/Windows/NewStyleRollCallWindow.xaml
@@ -70,95 +70,135 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -212,6 +252,7 @@
Foreground="{DynamicResource NewRollCallWindowDigitForeground}"
Width="60" TextAlignment="Center"/>
+
From 16ae32bfd70e7445f57035869f1973dca19f9cf5 Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Sat, 1 Nov 2025 19:17:52 +0800
Subject: [PATCH 26/34] =?UTF-8?q?improve:=E7=82=B9=E5=90=8DUI?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Ink Canvas/Windows/NewStyleRollCallWindow.cs | 20 ++-
Ink Canvas/Windows/QuickDrawFloatingButton.cs | 141 +++++++++++++++++-
2 files changed, 154 insertions(+), 7 deletions(-)
diff --git a/Ink Canvas/Windows/NewStyleRollCallWindow.cs b/Ink Canvas/Windows/NewStyleRollCallWindow.cs
index b560159f..bfe85d88 100644
--- a/Ink Canvas/Windows/NewStyleRollCallWindow.cs
+++ b/Ink Canvas/Windows/NewStyleRollCallWindow.cs
@@ -1197,6 +1197,13 @@ namespace Ink_Canvas
{
List usedNames = new List();
+ // 确保动画期间主显示区域可见
+ Application.Current.Dispatcher.Invoke(() =>
+ {
+ MainResultDisplay.Visibility = Visibility.Visible;
+ MultiResultScrollViewer.Visibility = Visibility.Collapsed;
+ });
+
for (int i = 0; i < animationTimes; i++)
{
// 随机选择一个名字进行动画显示
@@ -1207,6 +1214,8 @@ namespace Ink_Canvas
Application.Current.Dispatcher.Invoke(() =>
{
+ // 确保主显示区域在动画期间保持可见
+ MainResultDisplay.Visibility = Visibility.Visible;
MainResultDisplay.Text = displayName;
});
}
@@ -1258,6 +1267,13 @@ namespace Ink_Canvas
{
List usedNumbers = new List();
+ // 确保动画期间主显示区域可见
+ Application.Current.Dispatcher.Invoke(() =>
+ {
+ MainResultDisplay.Visibility = Visibility.Visible;
+ MultiResultScrollViewer.Visibility = Visibility.Collapsed;
+ });
+
for (int i = 0; i < animationTimes; i++)
{
// 随机选择一个数字进行动画显示
@@ -1265,6 +1281,8 @@ namespace Ink_Canvas
Application.Current.Dispatcher.Invoke(() =>
{
+ // 确保主显示区域在动画期间保持可见
+ MainResultDisplay.Visibility = Visibility.Visible;
MainResultDisplay.Text = randomNumber.ToString();
});
@@ -1280,7 +1298,7 @@ namespace Ink_Canvas
// 更新历史记录
UpdateRollCallHistory(selectedNumbers);
- // 显示结果
+ // 显示结果(这里会根据结果数量决定显示主显示区域还是多结果区域)
ShowResults(selectedNumbers);
UpdateStatusDisplay($"抽选完成,共选择 {selectedNumbers.Count} 个数字");
diff --git a/Ink Canvas/Windows/QuickDrawFloatingButton.cs b/Ink Canvas/Windows/QuickDrawFloatingButton.cs
index 50d96931..6c5360bd 100644
--- a/Ink Canvas/Windows/QuickDrawFloatingButton.cs
+++ b/Ink Canvas/Windows/QuickDrawFloatingButton.cs
@@ -31,6 +31,13 @@ namespace Ink_Canvas
// 应用置顶
ApplyFloatingButtonTopmost();
+
+ // 如果主窗口在无焦点模式下,启动置顶维护
+ if (MainWindow.Settings?.Advanced?.IsNoFocusMode == true &&
+ MainWindow.Settings?.Advanced?.EnableUIAccessTopMost != true)
+ {
+ StartTopmostMaintenance();
+ }
}
private void SetPositionToBottomRight()
@@ -78,15 +85,39 @@ namespace Ink_Canvas
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
+ [DllImport("user32.dll")]
+ private static extern bool IsWindow(IntPtr hWnd);
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static extern bool IsWindowVisible(IntPtr hWnd);
+
+ [DllImport("user32.dll")]
+ private static extern bool IsIconic(IntPtr hWnd);
+
+ [DllImport("user32.dll")]
+ private static extern IntPtr GetForegroundWindow();
+
+ [DllImport("user32.dll")]
+ private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
+
+ [DllImport("kernel32.dll")]
+ private static extern uint GetCurrentProcessId();
+
private const int GWL_EXSTYLE = -20;
private const int WS_EX_TOPMOST = 0x00000008;
private static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
+ private static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
private const uint SWP_NOMOVE = 0x0002;
private const uint SWP_NOSIZE = 0x0001;
private const uint SWP_NOACTIVATE = 0x0010;
private const uint SWP_SHOWWINDOW = 0x0040;
private const uint SWP_NOOWNERZORDER = 0x0200;
+ // 添加定时器来维护置顶状态
+ private DispatcherTimer topmostMaintenanceTimer;
+ private bool isTopmostMaintenanceEnabled;
+
///
/// 应用悬浮按钮置顶
///
@@ -96,11 +127,6 @@ namespace Ink_Canvas
{
var hwnd = new WindowInteropHelper(this).Handle;
if (hwnd == IntPtr.Zero) return;
-
- // 强制激活窗口
- Activate();
- Focus();
-
// 设置WPF的Topmost属性
Topmost = true;
@@ -113,13 +139,116 @@ namespace Ink_Canvas
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER);
- LogHelper.WriteLogToFile("快抽悬浮按钮已应用置顶", LogHelper.LogType.Trace);
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"应用快抽悬浮按钮置顶失败: {ex.Message}", LogHelper.LogType.Error);
}
}
+
+ ///
+ /// 启动置顶维护定时器
+ ///
+ private void StartTopmostMaintenance()
+ {
+ if (MainWindow.Settings?.Advanced?.EnableUIAccessTopMost == true)
+ {
+ return;
+ }
+
+ if (isTopmostMaintenanceEnabled) return;
+
+ if (topmostMaintenanceTimer == null)
+ {
+ topmostMaintenanceTimer = new DispatcherTimer();
+ topmostMaintenanceTimer.Interval = TimeSpan.FromMilliseconds(500); // 每500ms检查一次
+ topmostMaintenanceTimer.Tick += TopmostMaintenanceTimer_Tick;
+ }
+
+ topmostMaintenanceTimer.Start();
+ isTopmostMaintenanceEnabled = true;
+ }
+
+ ///
+ /// 停止置顶维护定时器
+ ///
+ private void StopTopmostMaintenance()
+ {
+ if (topmostMaintenanceTimer != null && isTopmostMaintenanceEnabled)
+ {
+ topmostMaintenanceTimer.Stop();
+ isTopmostMaintenanceEnabled = false;
+ }
+ }
+
+ ///
+ /// 置顶维护定时器事件
+ ///
+ private void TopmostMaintenanceTimer_Tick(object sender, EventArgs e)
+ {
+ try
+ {
+ if (MainWindow.Settings?.Advanced?.EnableUIAccessTopMost == true)
+ {
+ StopTopmostMaintenance();
+ return;
+ }
+
+ if (MainWindow.Settings?.Advanced?.IsNoFocusMode != true)
+ {
+ StopTopmostMaintenance();
+ return;
+ }
+
+ var hwnd = new WindowInteropHelper(this).Handle;
+ if (hwnd == IntPtr.Zero) return;
+
+ // 检查窗口是否仍然可见且不是最小化状态
+ if (!IsWindow(hwnd) || !IsWindowVisible(hwnd) || IsIconic(hwnd))
+ {
+ return;
+ }
+
+ // 检查是否有子窗口在前景
+ var foregroundWindow = GetForegroundWindow();
+ if (foregroundWindow != hwnd)
+ {
+ // 检查前景窗口是否是当前应用程序的子窗口
+ var foregroundWindowProcessId = GetWindowThreadProcessId(foregroundWindow, out uint processId);
+ var currentProcessId = GetCurrentProcessId();
+
+ if (processId == currentProcessId)
+ {
+ // 如果有子窗口在前景,暂停置顶维护
+ return;
+ }
+
+ // 如果窗口不在最顶层且没有子窗口,重新设置置顶
+ SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER);
+
+ // 确保窗口样式正确
+ int exStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ if ((exStyle & WS_EX_TOPMOST) == 0)
+ {
+ SetWindowLong(hwnd, GWL_EXSTYLE, exStyle | WS_EX_TOPMOST);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLogToFile($"快抽悬浮按钮置顶维护定时器出错: {ex.Message}", LogHelper.LogType.Error);
+ }
+ }
+
+ ///
+ /// 窗口关闭时停止置顶维护定时器
+ ///
+ protected override void OnClosed(EventArgs e)
+ {
+ StopTopmostMaintenance();
+ base.OnClosed(e);
+ }
#endregion
}
}
From 8394e99127c932a397287864398b3f73c3af1b24 Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Sat, 1 Nov 2025 20:26:52 +0800
Subject: [PATCH 27/34] =?UTF-8?q?improve:=E4=B8=BB=E9=A2=98=E5=88=87?=
=?UTF-8?q?=E6=8D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Ink Canvas/InkCanvasForClass.csproj | 1 +
Ink Canvas/MainWindow.xaml | 2 +-
Ink Canvas/MainWindow_cs/MW_AutoTheme.cs | 21 +++++++++++++++++++
.../MainWindow_cs/MW_FloatingBarIcons.cs | 9 +++-----
Ink Canvas/Resources/Styles/Dark.xaml | 4 ++++
Ink Canvas/Resources/Styles/Light.xaml | 4 ++++
6 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/Ink Canvas/InkCanvasForClass.csproj b/Ink Canvas/InkCanvasForClass.csproj
index 1c25b961..921824a8 100644
--- a/Ink Canvas/InkCanvasForClass.csproj
+++ b/Ink Canvas/InkCanvasForClass.csproj
@@ -421,6 +421,7 @@
+
diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml
index c9d0d120..93032d3e 100644
--- a/Ink Canvas/MainWindow.xaml
+++ b/Ink Canvas/MainWindow.xaml
@@ -9434,7 +9434,7 @@
MouseUp="TwoFingerGestureBorder_MouseUp" Background="Transparent"
Orientation="Vertical" HorizontalAlignment="Center" Width="36" Margin="0">
-
+ /// 刷新手势按钮图标
+ ///
+ private void RefreshGestureButtonIcon()
+ {
+ try
+ {
+ // 调用手势按钮颜色和图标更新方法,该方法会根据当前主题和手势状态设置正确的图标
+ CheckEnableTwoFingerGestureBtnColorPrompt();
+ }
+ catch (Exception)
+ {
+ }
+ }
+
///
/// 刷新其他窗口的主题
///
diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
index 38b9ca94..c9bd64db 100644
--- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
+++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
@@ -80,8 +80,7 @@ namespace Ink_Canvas
// 多指书写模式启用时,手势功能被禁用
TwoFingerGestureSimpleStackPanel.Opacity = 0.5;
TwoFingerGestureSimpleStackPanel.IsHitTestVisible = false;
- EnableTwoFingerGestureBtn.Source =
- new BitmapImage(new Uri("/Resources/new-icons/gesture.png", UriKind.Relative));
+ EnableTwoFingerGestureBtn.Source = (BitmapImage)Application.Current.FindResource("GestureIcon");
// 根据主题设置颜色
if (Settings.Appearance.Theme == 1) // 深色主题
@@ -117,8 +116,7 @@ namespace Ink_Canvas
if (hasGestureEnabled)
{
- EnableTwoFingerGestureBtn.Source =
- new BitmapImage(new Uri("/Resources/new-icons/gesture-enabled.png", UriKind.Relative));
+ EnableTwoFingerGestureBtn.Source = (BitmapImage)Application.Current.FindResource("GestureIconEnabled");
BoardGesture.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardGestureGeometry.Brush = new SolidColorBrush(Colors.GhostWhite);
@@ -130,8 +128,7 @@ namespace Ink_Canvas
}
else
{
- EnableTwoFingerGestureBtn.Source =
- new BitmapImage(new Uri("/Resources/new-icons/gesture.png", UriKind.Relative));
+ EnableTwoFingerGestureBtn.Source = (BitmapImage)Application.Current.FindResource("GestureIcon");
// 根据主题设置颜色
if (Settings.Appearance.Theme == 1) // 深色主题
diff --git a/Ink Canvas/Resources/Styles/Dark.xaml b/Ink Canvas/Resources/Styles/Dark.xaml
index b9761ed8..a6cd8bf9 100644
--- a/Ink Canvas/Resources/Styles/Dark.xaml
+++ b/Ink Canvas/Resources/Styles/Dark.xaml
@@ -145,4 +145,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/Ink Canvas/Resources/Styles/Light.xaml b/Ink Canvas/Resources/Styles/Light.xaml
index 056d21bf..8f48ff49 100644
--- a/Ink Canvas/Resources/Styles/Light.xaml
+++ b/Ink Canvas/Resources/Styles/Light.xaml
@@ -145,4 +145,8 @@
+
+
+
+
\ No newline at end of file
From 0d790bbd80fe8557350c91adc1247fdcb5d89510 Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Sat, 1 Nov 2025 20:42:18 +0800
Subject: [PATCH 28/34] =?UTF-8?q?add:=E5=A2=A8=E8=BF=B9=E8=87=AA=E5=8A=A8?=
=?UTF-8?q?=E4=BF=9D=E5=AD=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Ink Canvas/MainWindow.xaml | 24 +++++++++
Ink Canvas/MainWindow.xaml.cs | 1 +
Ink Canvas/MainWindow_cs/MW_Settings.cs | 23 +++++++++
Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs | 17 +++++++
Ink Canvas/MainWindow_cs/MW_Timer.cs | 50 +++++++++++++++++++
Ink Canvas/Resources/Settings.cs | 6 +++
6 files changed, 121 insertions(+)
diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml
index 93032d3e..d910da66 100644
--- a/Ink Canvas/MainWindow.xaml
+++ b/Ink Canvas/MainWindow.xaml
@@ -3083,6 +3083,30 @@
Toggled="ToggleSwitchAutoSaveStrokesAtScreenshot_Toggled" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs
index d0f2ceaf..5e9b8d14 100644
--- a/Ink Canvas/MainWindow.xaml.cs
+++ b/Ink Canvas/MainWindow.xaml.cs
@@ -1853,6 +1853,7 @@ namespace Ink_Canvas
// 添加定时器来维护置顶状态
private DispatcherTimer topmostMaintenanceTimer;
+ private DispatcherTimer autoSaveStrokesTimer;
private bool isTopmostMaintenanceEnabled;
private void ApplyNoFocusMode()
diff --git a/Ink Canvas/MainWindow_cs/MW_Settings.cs b/Ink Canvas/MainWindow_cs/MW_Settings.cs
index 4624ac44..9f7b9907 100644
--- a/Ink Canvas/MainWindow_cs/MW_Settings.cs
+++ b/Ink Canvas/MainWindow_cs/MW_Settings.cs
@@ -1877,6 +1877,29 @@ namespace Ink_Canvas
SaveSettingsToFile();
}
+ private void ToggleSwitchEnableAutoSaveStrokes_Toggled(object sender, RoutedEventArgs e)
+ {
+ if (!isLoaded) return;
+ Settings.Automation.IsEnableAutoSaveStrokes = ToggleSwitchEnableAutoSaveStrokes.IsOn;
+ SaveSettingsToFile();
+ // 更新定时器状态
+ UpdateAutoSaveStrokesTimer();
+ }
+
+ private void ComboBoxAutoSaveStrokesInterval_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (!isLoaded || ComboBoxAutoSaveStrokesInterval.SelectedItem == null) return;
+
+ var selectedItem = ComboBoxAutoSaveStrokesInterval.SelectedItem as System.Windows.Controls.ComboBoxItem;
+ if (selectedItem?.Tag != null && int.TryParse(selectedItem.Tag.ToString(), out int intervalMinutes))
+ {
+ Settings.Automation.AutoSaveStrokesIntervalMinutes = intervalMinutes;
+ SaveSettingsToFile();
+ // 更新定时器间隔
+ UpdateAutoSaveStrokesTimer();
+ }
+ }
+
#endregion
#region Gesture
diff --git a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs
index 85e8ec86..0e51b58f 100644
--- a/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs
+++ b/Ink Canvas/MainWindow_cs/MW_SettingsToLoad.cs
@@ -1053,6 +1053,23 @@ namespace Ink_Canvas
ToggleSwitchSaveFullPageStrokes.IsOn = Settings.Automation.IsSaveFullPageStrokes;
+ // 加载定时保存墨迹设置
+ ToggleSwitchEnableAutoSaveStrokes.IsOn = Settings.Automation.IsEnableAutoSaveStrokes;
+ // 初始化保存间隔下拉框
+ if (ComboBoxAutoSaveStrokesInterval != null)
+ {
+ int intervalMinutes = Settings.Automation.AutoSaveStrokesIntervalMinutes;
+ if (intervalMinutes < 1) intervalMinutes = 5; // 默认5分钟
+ foreach (System.Windows.Controls.ComboBoxItem item in ComboBoxAutoSaveStrokesInterval.Items)
+ {
+ if (item.Tag != null && int.TryParse(item.Tag.ToString(), out int tagValue) && tagValue == intervalMinutes)
+ {
+ ComboBoxAutoSaveStrokesInterval.SelectedItem = item;
+ break;
+ }
+ }
+ }
+
SideControlMinimumAutomationSlider.Value = Settings.Automation.MinimumAutomationStrokeNumber;
AutoSavedStrokesLocation.Text = Settings.Automation.AutoSavedStrokesLocation;
diff --git a/Ink Canvas/MainWindow_cs/MW_Timer.cs b/Ink Canvas/MainWindow_cs/MW_Timer.cs
index afb21c29..3de74f33 100644
--- a/Ink Canvas/MainWindow_cs/MW_Timer.cs
+++ b/Ink Canvas/MainWindow_cs/MW_Timer.cs
@@ -12,6 +12,7 @@ using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Threading;
namespace Ink_Canvas
{
@@ -148,6 +149,55 @@ namespace Ink_Canvas
LogHelper.WriteLogToFile($"程序启动时NTP同步失败: {ex.Message}", LogHelper.LogType.Error);
}
});
+
+ // 初始化定时保存墨迹定时器
+ InitAutoSaveStrokesTimer();
+ }
+
+ // 初始化定时保存墨迹定时器
+ private void InitAutoSaveStrokesTimer()
+ {
+ if (autoSaveStrokesTimer == null)
+ {
+ autoSaveStrokesTimer = new DispatcherTimer();
+ autoSaveStrokesTimer.Tick += AutoSaveStrokesTimer_Tick;
+ }
+
+ // 根据设置更新定时器间隔和启动状态
+ UpdateAutoSaveStrokesTimer();
+ }
+
+ // 更新定时保存墨迹定时器状态
+ private void UpdateAutoSaveStrokesTimer()
+ {
+ if (autoSaveStrokesTimer == null) return;
+
+ autoSaveStrokesTimer.Stop();
+
+ if (Settings.Automation.IsEnableAutoSaveStrokes)
+ {
+ int intervalMinutes = Settings.Automation.AutoSaveStrokesIntervalMinutes;
+ if (intervalMinutes < 1) intervalMinutes = 1; // 最小间隔1分钟
+ autoSaveStrokesTimer.Interval = TimeSpan.FromMinutes(intervalMinutes);
+ autoSaveStrokesTimer.Start();
+ }
+ }
+
+ // 定时保存墨迹定时器事件处理
+ private void AutoSaveStrokesTimer_Tick(object sender, EventArgs e)
+ {
+ try
+ {
+ // 只有在画布可见且有墨迹时才保存
+ if (inkCanvas.Visibility == Visibility.Visible && inkCanvas.Strokes.Count > 0)
+ {
+ // 静默保存
+ SaveInkCanvasStrokes(false, false);
+ }
+ }
+ catch (Exception)
+ {
+ }
}
// NTP同步定时器事件处理
diff --git a/Ink Canvas/Resources/Settings.cs b/Ink Canvas/Resources/Settings.cs
index 395ea46d..ed819bd1 100644
--- a/Ink Canvas/Resources/Settings.cs
+++ b/Ink Canvas/Resources/Settings.cs
@@ -462,6 +462,12 @@ namespace Ink_Canvas
[JsonProperty("isAutoEnterAnnotationAfterKillHite")]
public bool IsAutoEnterAnnotationAfterKillHite { get; set; }
+ [JsonProperty("isEnableAutoSaveStrokes")]
+ public bool IsEnableAutoSaveStrokes { get; set; } = true;
+
+ [JsonProperty("autoSaveStrokesIntervalMinutes")]
+ public int AutoSaveStrokesIntervalMinutes { get; set; } = 5;
+
[JsonProperty("floatingWindowInterceptor")]
public FloatingWindowInterceptorSettings FloatingWindowInterceptor { get; set; } = new FloatingWindowInterceptorSettings();
}
From b7bff30445c5d5d3ff04a5ca7d9d2b6c2834909d Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Sat, 1 Nov 2025 20:49:37 +0800
Subject: [PATCH 29/34] improve:UI
---
Ink Canvas/MainWindow.xaml | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml
index d910da66..32a65bc6 100644
--- a/Ink Canvas/MainWindow.xaml
+++ b/Ink Canvas/MainWindow.xaml
@@ -2824,17 +2824,11 @@
TextWrapping="Wrap" Foreground="#a1a1aa" Margin="0,0,0,8" />
+ Padding="15,5" Margin="0,0,8,0" Click="BtnUnregisterFileAssociation_Click" />
+ Padding="15,5" Margin="0,0,8,0" Click="BtnCheckFileAssociation_Click" />
+ Padding="15,5" Click="BtnRegisterFileAssociation_Click" />
From b520d6a3342de8e5cef5f37fc416a5948d9c398a Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Sat, 1 Nov 2025 21:00:23 +0800
Subject: [PATCH 30/34] fix:issue #210
---
Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs | 2 --
1 file changed, 2 deletions(-)
diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
index c9bd64db..4b434877 100644
--- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
+++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
@@ -2025,8 +2025,6 @@ namespace Ink_Canvas
// 禁用高级橡皮擦系统
DisableEraserOverlay();
- ExitMultiTouchModeIfNeeded();
-
SetFloatingBarHighlightPosition("pen");
// 记录当前是否已经是批注模式且是否为高光显示模式
From 8f6f22ba7fba836889e9db0ec564f86b62bce02e Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Sat, 1 Nov 2025 21:37:55 +0800
Subject: [PATCH 31/34] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?=
=?UTF-8?q?=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
AutomaticUpdateVersionControl.txt | 2 +-
Ink Canvas/AssemblyInfo.cs | 4 ++--
Ink Canvas/Properties/AssemblyInfo.cs | 4 ++--
UpdateLog.md | 1 +
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/AutomaticUpdateVersionControl.txt b/AutomaticUpdateVersionControl.txt
index 80c8c54c..cca5748a 100644
--- a/AutomaticUpdateVersionControl.txt
+++ b/AutomaticUpdateVersionControl.txt
@@ -1 +1 @@
-1.7.16.0
+1.7.17.0
diff --git a/Ink Canvas/AssemblyInfo.cs b/Ink Canvas/AssemblyInfo.cs
index 25087510..93561d41 100644
--- a/Ink Canvas/AssemblyInfo.cs
+++ b/Ink Canvas/AssemblyInfo.cs
@@ -49,5 +49,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.7.16.0")]
-[assembly: AssemblyFileVersion("1.7.16.0")]
+[assembly: AssemblyVersion("1.7.17.0")]
+[assembly: AssemblyFileVersion("1.7.17.0")]
diff --git a/Ink Canvas/Properties/AssemblyInfo.cs b/Ink Canvas/Properties/AssemblyInfo.cs
index 25087510..93561d41 100644
--- a/Ink Canvas/Properties/AssemblyInfo.cs
+++ b/Ink Canvas/Properties/AssemblyInfo.cs
@@ -49,5 +49,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.7.16.0")]
-[assembly: AssemblyFileVersion("1.7.16.0")]
+[assembly: AssemblyVersion("1.7.17.0")]
+[assembly: AssemblyFileVersion("1.7.17.0")]
diff --git a/UpdateLog.md b/UpdateLog.md
index f899504d..102bf5da 100644
--- a/UpdateLog.md
+++ b/UpdateLog.md
@@ -102,3 +102,4 @@ ICC CE 1.7.X.X更新日志
101. 新增UIA窗口置顶
102. 新增新点名窗口
103. 新增点名快抽
+104. 新增墨迹自动保存
From 12e91927a51f1aa2fe028fe6ae72674dc81a82b5 Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Sat, 1 Nov 2025 21:56:31 +0800
Subject: [PATCH 32/34] fix:issue #210
---
Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs | 10 ----------
Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs | 3 ---
2 files changed, 13 deletions(-)
diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
index 4b434877..e9334f88 100644
--- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
+++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs
@@ -2894,16 +2894,6 @@ namespace Ink_Canvas
// 清空触摸点计数器
dec.Clear();
- // 重置单指拖动模式状态
- if (isSingleFingerDragMode)
- {
- isSingleFingerDragMode = false;
- if (BtnFingerDragMode != null)
- {
- BtnFingerDragMode.Content = "单指\n拖动";
- }
- }
-
// 重置手掌擦状态
if (isPalmEraserActive)
{
diff --git a/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs b/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
index 892527ad..df0121e2 100644
--- a/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
+++ b/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
@@ -354,7 +354,6 @@ namespace Ink_Canvas
private void BtnSelect_Click(object sender, RoutedEventArgs e)
{
- ExitMultiTouchModeIfNeeded();
forceEraser = true;
drawingShapeMode = 0;
inkCanvas.IsManipulationEnabled = false;
@@ -709,7 +708,6 @@ namespace Ink_Canvas
private void LassoSelect_Click(object sender, RoutedEventArgs e)
{
- ExitMultiTouchModeIfNeeded();
forceEraser = false;
forcePointEraser = false;
drawingShapeMode = 0;
@@ -720,7 +718,6 @@ namespace Ink_Canvas
private void BtnLassoSelect_Click(object sender, RoutedEventArgs e)
{
- ExitMultiTouchModeIfNeeded();
forceEraser = false;
forcePointEraser = false;
drawingShapeMode = 0;
From 637b6bb4f99de13a93787ef09e77290a7d3955f6 Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Sat, 1 Nov 2025 22:05:19 +0800
Subject: [PATCH 33/34] fix:issue #210
---
Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs b/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
index df0121e2..fd98c643 100644
--- a/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
+++ b/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
@@ -708,6 +708,7 @@ namespace Ink_Canvas
private void LassoSelect_Click(object sender, RoutedEventArgs e)
{
+ ExitMultiTouchModeIfNeeded();
forceEraser = false;
forcePointEraser = false;
drawingShapeMode = 0;
@@ -718,6 +719,7 @@ namespace Ink_Canvas
private void BtnLassoSelect_Click(object sender, RoutedEventArgs e)
{
+ ExitMultiTouchModeIfNeeded();
forceEraser = false;
forcePointEraser = false;
drawingShapeMode = 0;
From 16f80adb0dbf00c9e9ca3c3d2d32ba4538b19967 Mon Sep 17 00:00:00 2001
From: CJK_mkp <113243675+CJKmkp@users.noreply.github.com>
Date: Sat, 1 Nov 2025 22:12:47 +0800
Subject: [PATCH 34/34] fix:issue #210
---
Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs b/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
index fd98c643..892527ad 100644
--- a/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
+++ b/Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
@@ -354,6 +354,7 @@ namespace Ink_Canvas
private void BtnSelect_Click(object sender, RoutedEventArgs e)
{
+ ExitMultiTouchModeIfNeeded();
forceEraser = true;
drawingShapeMode = 0;
inkCanvas.IsManipulationEnabled = false;