优化代码

This commit is contained in:
2026-03-03 16:04:20 +08:00
parent 62e79ff5b3
commit a948c0d7fb
73 changed files with 944 additions and 997 deletions
+5 -5
View File
@@ -17,7 +17,7 @@ namespace Ink_Canvas
/// 浮动栏是否折叠的标志。
/// </summary>
public bool isFloatingBarFolded;
/// <summary>
/// 浮动栏正在改变隐藏模式的标志,用于防止重复操作。
/// </summary>
@@ -100,7 +100,7 @@ namespace Ink_Canvas
if (sender == Fold_Icon && lastBorderMouseDownObject != Fold_Icon) isShouldRejectAction = true;
});
if (isShouldRejectAction)
if (isShouldRejectAction)
{
return;
}
@@ -114,7 +114,7 @@ namespace Ink_Canvas
if (isFloatingBarFolded) return;
if (isFloatingBarChangingHideMode)
if (isFloatingBarChangingHideMode)
{
return;
}
@@ -384,12 +384,12 @@ namespace Ink_Canvas
unfoldFloatingBarByUser = true;
foldFloatingBarByUser = false;
if (isFloatingBarChangingHideMode)
if (isFloatingBarChangingHideMode)
{
return;
}
await Dispatcher.InvokeAsync(() =>
{
isFloatingBarChangingHideMode = true;
+4 -5
View File
@@ -1,7 +1,6 @@
using Ink_Canvas.Helpers;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@@ -236,8 +235,8 @@ namespace Ink_Canvas
var elementsToProcess = new List<UIElement>();
foreach (var item in TimeMachineHistories[0])
{
if (item.CommitType == TimeMachineHistoryType.ElementInsert &&
!item.StrokeHasBeenCleared &&
if (item.CommitType == TimeMachineHistoryType.ElementInsert &&
!item.StrokeHasBeenCleared &&
item.InsertedElement != null &&
!removed0.Contains(item.InsertedElement))
{
@@ -255,8 +254,8 @@ namespace Ink_Canvas
var elementsToProcess = new List<UIElement>();
foreach (var item in TimeMachineHistories[CurrentWhiteboardIndex])
{
if (item.CommitType == TimeMachineHistoryType.ElementInsert &&
!item.StrokeHasBeenCleared &&
if (item.CommitType == TimeMachineHistoryType.ElementInsert &&
!item.StrokeHasBeenCleared &&
item.InsertedElement != null &&
!removed.Contains(item.InsertedElement))
{
@@ -5,7 +5,6 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Forms;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Interop;
@@ -1161,10 +1161,10 @@ namespace Ink_Canvas
{
// 每次打开计时器窗口时重置计时器
TimerControl.ResetTimerState();
// 根据DPI缩放因子调整TimerContainer的尺寸
AdjustTimerContainerSize();
TimerContainer.Visibility = Visibility.Visible;
if (MinimizedTimerContainer != null)
{
+21 -21
View File
@@ -73,22 +73,22 @@ namespace Ink_Canvas
/// PowerPoint应用程序实例,用于与PowerPoint进行交互。
/// </summary>
public static Microsoft.Office.Interop.PowerPoint.Application pptApplication;
/// <summary>
/// 当前活动的PowerPoint演示文稿。
/// </summary>
public static Presentation presentation;
/// <summary>
/// 当前演示文稿的幻灯片集合。
/// </summary>
public static Slides slides;
/// <summary>
/// 当前活动的幻灯片。
/// </summary>
public static Slide slide;
/// <summary>
/// 当前演示文稿的幻灯片总数。
/// </summary>
@@ -99,8 +99,8 @@ namespace Ink_Canvas
/// <summary>
/// 幻灯片放映结束事件重入保护标志,防止重复处理放映结束事件。
/// </summary>
private bool isEnteredSlideShowEndEvent;
private bool isEnteredSlideShowEndEvent;
/// <summary>
/// 演示文稿是否有黑边的指示标志。
/// </summary>
@@ -111,17 +111,17 @@ namespace Ink_Canvas
/// 用于处理长按翻页功能的定时器。
/// </summary>
private DispatcherTimer _longPressTimer;
/// <summary>
/// 长按翻页方向标志,true表示下一页,false表示上一页。
/// </summary>
private bool _isLongPressNext = true; // true为下一页,false为上一页
/// <summary>
/// 长按延迟时间(毫秒),即用户需要按住按钮多长时间才开始连续翻页。
/// </summary>
private const int LongPressDelay = 500; // 长按延迟时间(毫秒)
/// <summary>
/// 长按翻页间隔(毫秒),即连续翻页的时间间隔。
/// </summary>
@@ -132,7 +132,7 @@ namespace Ink_Canvas
/// 用于监控PowerPoint应用程序状态的定时器。
/// </summary>
private DispatcherTimer _powerPointProcessMonitorTimer;
/// <summary>
/// 应用程序监控间隔(毫秒),即每隔多长时间检查一次PowerPoint应用程序状态。
/// </summary>
@@ -143,12 +143,12 @@ namespace Ink_Canvas
/// 上次播放的幻灯片页码。
/// </summary>
private int _lastPlaybackPage = 0;
/// <summary>
/// 是否应该导航到上次播放页码的标志。
/// </summary>
private bool _shouldNavigateToLastPage = false;
// 当前播放页码跟踪
/// <summary>
/// 当前幻灯片放映的位置(页码)。
@@ -162,11 +162,11 @@ namespace Ink_Canvas
/// 用于在PowerPoint连接断开后延迟退出PPT模式的定时器。
/// </summary>
private DispatcherTimer _exitPPTModeAfterDisconnectTimer;
/// <summary>
/// 断开连接后退出PPT模式的延迟时间(毫秒),即连接断开后多长时间才退出PPT模式。
/// </summary>
private const int ExitPPTModeAfterDisconnectDelayMs = 1200;
private const int ExitPPTModeAfterDisconnectDelayMs = 1200;
#endregion
#region PPT Managers
@@ -174,12 +174,12 @@ namespace Ink_Canvas
/// PPT链接管理器,用于管理与PowerPoint的连接和事件处理。
/// </summary>
private IPPTLinkManager _pptManager;
/// <summary>
/// PPT墨迹管理器,用于管理PowerPoint幻灯片上的墨迹。
/// </summary>
private PPTInkManager _singlePPTInkManager;
/// <summary>
/// PPT UI管理器,用于管理与PowerPoint相关的用户界面元素。
/// </summary>
@@ -1432,7 +1432,7 @@ namespace Ink_Canvas
if (GridTransparencyFakeBackground.Background != Brushes.Transparent)
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
SetCurrentToolMode(InkCanvasEditingMode.None);
UpdateCurrentToolMode("cursor");
SetFloatingBarHighlightPosition("cursor");
}
@@ -1785,7 +1785,7 @@ namespace Ink_Canvas
// 重置上次播放位置相关字段
_lastPlaybackPage = 0;
_shouldNavigateToLastPage = false;
// 重置当前播放页码跟踪
_currentSlideShowPosition = 0;
_previousSlideID = 0;
@@ -1922,7 +1922,7 @@ namespace Ink_Canvas
{
Settings.PowerPointSettings.PowerPointSupport = true;
ToggleSwitchSupportPowerPoint.IsOn = true;
// 启动PPT监控
if (_pptManager == null)
{
@@ -1973,7 +1973,7 @@ namespace Ink_Canvas
/// 指示是否正在显示恢复隐藏幻灯片的窗口
/// </summary>
public static bool IsShowingRestoreHiddenSlidesWindow;
/// <summary>
/// 指示是否正在显示自动播放提示窗口
/// </summary>
@@ -2305,7 +2305,7 @@ namespace Ink_Canvas
{
PureViewboxFloatingBarMarginAnimationInDesktopMode();
if (Settings.Automation.IsAutoEnterAnnotationModeWhenExitFoldMode)
{
{
await Task.Delay(350);
if (!isFloatingBarFolded)
{
+15 -15
View File
@@ -147,7 +147,7 @@ namespace Ink_Canvas
{
// 检查是否是PPT模式
bool isPPTMode = BtnPPTSlideShowEnd.Visibility == Visibility.Visible && _pptManager?.IsConnected == true;
if (isPPTMode)
{
// PPT模式:保存为多个XML文件
@@ -593,22 +593,22 @@ namespace Ink_Canvas
}
// 创建ZIP文件
if (File.Exists(zipFileName))
File.Delete(zipFileName);
if (File.Exists(zipFileName))
File.Delete(zipFileName);
ZipFile.CreateFromDirectory(tempDir, zipFileName);
ZipFile.CreateFromDirectory(tempDir, zipFileName);
// 异步上传ZIP文件到Dlass
_ = Task.Run(async () =>
{
try
// 异步上传ZIP文件到Dlass
_ = Task.Run(async () =>
{
await Helpers.UploadHelper.UploadFileAsync(zipFileName);
}
catch (Exception)
{
}
});
try
{
await Helpers.UploadHelper.UploadFileAsync(zipFileName);
}
catch (Exception)
{
}
});
if (newNotice)
{
@@ -1087,7 +1087,7 @@ namespace Ink_Canvas
{
StrokeCollection strokes = null;
string extension = Path.GetExtension(file).ToLower();
if (extension == ".xml")
{
// 从XML文件加载
+2 -2
View File
@@ -1,3 +1,4 @@
using Ink_Canvas.Helpers;
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
@@ -6,9 +7,8 @@ using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Media.Imaging;
using System.Windows.Ink;
using Ink_Canvas.Helpers;
using System.Windows.Media.Imaging;
namespace Ink_Canvas
{
@@ -790,7 +790,7 @@ namespace Ink_Canvas
var touchPoint = e.GetTouchPoint(null);
centerPoint = touchPoint.Position;
lastTouchPointOnGridInkCanvasCover = touchPoint.Position;
var touchPointInCanvas = e.GetTouchPoint(inkCanvas);
lastDragPointInCanvas = touchPointInCanvas.Position;
}
@@ -806,15 +806,15 @@ namespace Ink_Canvas
dec.Remove(e.TouchDevice.Id);
if (dec.Count >= 1) return;
isProgramChangeStrokeSelection = false;
lastDragPointInCanvas = new Point(0, 0);
var touchUpPoint = e.GetTouchPoint(null).Position;
if (lastTouchPointOnGridInkCanvasCover == touchUpPoint)
{
var touchPointInCanvas = e.GetTouchPoint(inkCanvas).Position;
var selectionBounds = inkCanvas.GetSelectionBounds();
if (!(touchPointInCanvas.X < selectionBounds.Left) &&
!(touchPointInCanvas.Y < selectionBounds.Top) &&
!(touchPointInCanvas.X > selectionBounds.Right) &&
@@ -1025,8 +1025,8 @@ namespace Ink_Canvas
{
// 四个边选择点,向外扩展8像素
TopHandle.Margin = new Thickness(bounds.Left + bounds.Width / 2 - 4, bounds.Top - 12, 0, 0);
BottomHandle.Margin = new Thickness(bounds.Left + bounds.Width / 2 - 4, bounds.Bottom + 4 , 0, 0);
LeftHandle.Margin = new Thickness(bounds.Left - 12 , bounds.Top + bounds.Height / 2 - 4, 0, 0);
BottomHandle.Margin = new Thickness(bounds.Left + bounds.Width / 2 - 4, bounds.Bottom + 4, 0, 0);
LeftHandle.Margin = new Thickness(bounds.Left - 12, bounds.Top + bounds.Height / 2 - 4, 0, 0);
RightHandle.Margin = new Thickness(bounds.Right + 4, bounds.Top + bounds.Height / 2 - 4, 0, 0);
// 四个角选择点,完全位于选择框外部
+15 -15
View File
@@ -187,7 +187,7 @@ namespace Ink_Canvas
// 用户同意,保存设置
Settings.Startup.HasAcceptedTelemetryPrivacy = true;
Settings.Startup.TelemetryUploadLevel = TelemetryUploadLevel.Basic;
// 更新UI,即使 isLoaded 为 false(启动时)
// 使用标志避免触发事件处理程序
// 使用 Dispatcher 确保在 UI 线程上更新
@@ -245,7 +245,7 @@ namespace Ink_Canvas
Settings.Startup.UpdateChannel = UpdateChannel.Release;
DeviceIdentifier.UpdateUsageChannel(UpdateChannel.Release);
SaveSettingsToFile();
Dispatcher.BeginInvoke(new Action(() =>
{
_isChangingUpdateChannelInternally = true;
@@ -288,7 +288,7 @@ namespace Ink_Canvas
if (result == MessageBoxResult.Yes)
{
Settings.Startup.TelemetryUploadLevel = TelemetryUploadLevel.Basic;
if (isLoaded && ComboBoxTelemetryUploadLevel != null)
{
ComboBoxTelemetryUploadLevel.SelectedIndex = 1;
@@ -303,7 +303,7 @@ namespace Ink_Canvas
Settings.Startup.UpdateChannel = UpdateChannel.Release;
DeviceIdentifier.UpdateUsageChannel(UpdateChannel.Release);
SaveSettingsToFile();
Dispatcher.BeginInvoke(new Action(() =>
{
_isChangingUpdateChannelInternally = true;
@@ -746,21 +746,21 @@ namespace Ink_Canvas
if (!isLoaded) return;
Settings.PowerPointSettings.PowerPointSupport = ToggleSwitchSupportPowerPoint.IsOn;
if (!Settings.PowerPointSettings.PowerPointSupport)
{
if (Settings.PowerPointSettings.IsSupportWPS)
{
Settings.PowerPointSettings.IsSupportWPS = false;
ToggleSwitchSupportWPS.IsOn = false;
if (_pptManager != null)
{
_pptManager.IsSupportWPS = false;
}
}
}
SaveSettingsToFile();
// 使用新的PPT管理器
@@ -1266,14 +1266,14 @@ namespace Ink_Canvas
{
if (!isLoaded) return;
Settings.Appearance.ChickenSoupSource = ComboBoxChickenSoupSource.SelectedIndex;
if (BtnHitokotoCustomize != null)
{
BtnHitokotoCustomize.Visibility = ComboBoxChickenSoupSource.SelectedIndex == 3
? Visibility.Visible
BtnHitokotoCustomize.Visibility = ComboBoxChickenSoupSource.SelectedIndex == 3
? Visibility.Visible
: Visibility.Collapsed;
}
SaveSettingsToFile();
await UpdateChickenSoupTextAsync();
}
@@ -1334,7 +1334,7 @@ namespace Ink_Canvas
// 全选复选框逻辑
bool isUpdatingSelectAll = false;
selectAllCheckBox.IsChecked = Settings.Appearance.HitokotoCategories.Count == categories.Count;
selectAllCheckBox.Checked += (s, args) =>
{
if (isUpdatingSelectAll) return;
@@ -1423,7 +1423,7 @@ namespace Ink_Canvas
}
SaveSettingsToFile();
// 如果当前正在使用API,更新名言
if (Settings.Appearance.ChickenSoupSource == 3 && Settings.Appearance.EnableChickenSoupInWhiteboardMode)
{
@@ -5125,8 +5125,8 @@ namespace Ink_Canvas
{
var oldChannel = Settings.Startup.UpdateChannel;
string channel = radioButton.Tag.ToString();
UpdateChannel newChannel = channel == "Beta" ? UpdateChannel.Beta
: channel == "Preview" ? UpdateChannel.Preview
UpdateChannel newChannel = channel == "Beta" ? UpdateChannel.Beta
: channel == "Preview" ? UpdateChannel.Preview
: UpdateChannel.Release;
// 如果通道没有变化,不需要执行更新检查
@@ -418,15 +418,15 @@ namespace Ink_Canvas
ComboBoxTheme.SelectedIndex = Settings.Appearance.Theme;
ComboBoxChickenSoupSource.SelectedIndex = Settings.Appearance.ChickenSoupSource;
// 初始化自定义按钮的可见性(仅在选择API时显示)
if (BtnHitokotoCustomize != null)
{
BtnHitokotoCustomize.Visibility = Settings.Appearance.ChickenSoupSource == 3
? Visibility.Visible
BtnHitokotoCustomize.Visibility = Settings.Appearance.ChickenSoupSource == 3
? Visibility.Visible
: Visibility.Collapsed;
}
// 初始化HitokotoCategories,如果为空则默认全选
if (Settings.Appearance.HitokotoCategories == null || Settings.Appearance.HitokotoCategories.Count == 0)
{
@@ -1307,7 +1307,7 @@ namespace Ink_Canvas
{
if (string.IsNullOrWhiteSpace(Settings.Canvas.BrushAutoRestoreColor))
{
Settings.Canvas.BrushAutoRestoreColor = "#FFFF0000";
Settings.Canvas.BrushAutoRestoreColor = "#FFFF0000";
}
bool found = false;
@@ -1328,13 +1328,13 @@ namespace Ink_Canvas
break;
}
}
if (!found && ComboBoxBrushAutoRestoreColor.Items.Count > 0)
{
ComboBoxBrushAutoRestoreColor.SelectionChanged -= ComboBoxBrushAutoRestoreColor_SelectionChanged;
try
{
ComboBoxBrushAutoRestoreColor.SelectedIndex = 0;
ComboBoxBrushAutoRestoreColor.SelectedIndex = 0;
Settings.Canvas.BrushAutoRestoreColor = "#FFFF0000";
}
finally
@@ -1347,8 +1347,8 @@ namespace Ink_Canvas
// 同步粗细滑块
if (BrushAutoRestoreWidthSlider != null)
{
BrushAutoRestoreWidthSlider.Value = Settings.Canvas.BrushAutoRestoreWidth > 0
? Settings.Canvas.BrushAutoRestoreWidth
BrushAutoRestoreWidthSlider.Value = Settings.Canvas.BrushAutoRestoreWidth > 0
? Settings.Canvas.BrushAutoRestoreWidth
: 5;
}
+6 -6
View File
@@ -2082,12 +2082,12 @@ namespace Ink_Canvas
/// 用于标识是否是长方体绘制的第一次触摸,第一次触摸绘制正面矩形,第二次触摸绘制深度
/// </remarks>
private bool isFirstTouchCuboid = true;
/// <summary>
/// 长方体正面矩形的起始点
/// </summary>
private Point CuboidFrontRectIniP;
/// <summary>
/// 长方体正面矩形的结束点
/// </summary>
@@ -2100,7 +2100,7 @@ namespace Ink_Canvas
/// 用于存储当前正在绘制的临时笔画,在绘制过程中实时更新
/// </remarks>
private Stroke lastTempStroke;
/// <summary>
/// 上一次的临时笔画集合
/// </summary>
@@ -2122,7 +2122,7 @@ namespace Ink_Canvas
/// 上一次更新时间
/// </summary>
private DateTime lastUpdateTime = DateTime.MinValue;
/// <summary>
/// 更新节流时间(毫秒)
/// </summary>
@@ -2493,7 +2493,7 @@ namespace Ink_Canvas
/// 用于标识鼠标是否处于按下状态,在绘制过程中使用
/// </remarks>
private bool isMouseDown;
/// <summary>
/// 触摸按下状态标志
/// </summary>
@@ -2537,7 +2537,7 @@ namespace Ink_Canvas
private void inkCanvas_MouseMove(object sender, MouseEventArgs e)
{
if (isMouseDown) MouseTouchMove(e.GetPosition(inkCanvas));
if (Settings.Canvas.IsShowCursor)
{
SetCursorBasedOnEditingMode(inkCanvas);
@@ -1408,7 +1408,7 @@ namespace Ink_Canvas
double dx = end.X - start.X;
double dy = end.Y - start.Y;
double lineLength = Math.Sqrt(dx * dx + dy * dy);
if (lineLength > 1e-10)
{
directionX = dx / lineLength;
@@ -1693,13 +1693,13 @@ namespace Ink_Canvas
else
{
Point midPoint = new Point((start.X + end.X) / 2, (start.Y + end.Y) / 2);
var startToMid = GeneratePointsBetween(start, midPoint, 0.4f, 0.8f, 8.0);
foreach (var pt in startToMid)
{
points.Add(pt);
}
var midToEnd = GeneratePointsBetween(midPoint, end, 0.8f, 0.4f, 8.0);
for (int i = 1; i < midToEnd.Count; i++)
{
@@ -2030,7 +2030,7 @@ namespace Ink_Canvas
{
double deltaY = Math.Abs(p1.Y - p2.Y);
double deltaX = Math.Abs(p1.X - p2.X);
if (deltaY < 1e-10 || deltaX / deltaY > 8)
{
//水平
@@ -2068,7 +2068,7 @@ namespace Ink_Canvas
public StylusPointCollection GenerateFakePressureTriangle(StylusPointCollection points)
{
var newPoint = new StylusPointCollection();
if (Settings.InkToShape.IsInkToShapeNoFakePressureTriangle || penType == 1)
{
if (points.Count >= 3)
@@ -2114,9 +2114,9 @@ namespace Ink_Canvas
{
Point start = points[i].ToPoint();
Point end = points[(i + 1) % 3].ToPoint();
Point midPoint = GetCenterPoint(start, end);
var startToMid = GeneratePointsBetween(start, midPoint, 0.4f, 0.8f, 8.0);
if (i == 0)
{
@@ -2132,7 +2132,7 @@ namespace Ink_Canvas
newPoint.Add(startToMid[j]);
}
}
var midToEnd = GeneratePointsBetween(midPoint, end, 0.8f, 0.4f, 8.0);
for (int j = 1; j < midToEnd.Count; j++)
{
@@ -2161,18 +2161,18 @@ namespace Ink_Canvas
{
var result = new StylusPointCollection();
double distance = GetDistance(start, end);
if (distance < minPointInterval)
{
result.Add(new StylusPoint(start.X, start.Y, startPressure));
result.Add(new StylusPoint(end.X, end.Y, endPressure));
return result;
}
int pointCount = Math.Max(2, (int)(distance / minPointInterval) + 1);
result.Add(new StylusPoint(start.X, start.Y, startPressure));
for (int i = 1; i < pointCount - 1; i++)
{
double ratio = (double)i / (pointCount - 1);
@@ -2181,16 +2181,16 @@ namespace Ink_Canvas
double y = start.Y + (end.Y - start.Y) * ratio;
result.Add(new StylusPoint(x, y, (float)pressure));
}
result.Add(new StylusPoint(end.X, end.Y, endPressure));
return result;
}
public StylusPointCollection GenerateFakePressureRectangle(StylusPointCollection points)
{
var newPoint = new StylusPointCollection();
if (Settings.InkToShape.IsInkToShapeNoFakePressureRectangle || penType == 1)
{
if (points.Count >= 4)
@@ -2229,9 +2229,9 @@ namespace Ink_Canvas
{
Point start = points[i].ToPoint();
Point end = points[(i + 1) % 4].ToPoint();
Point midPoint = GetCenterPoint(start, end);
var startToMid = GeneratePointsBetween(start, midPoint, 0.4f, 0.8f, 8.0);
if (i == 0)
{
@@ -2247,7 +2247,7 @@ namespace Ink_Canvas
newPoint.Add(startToMid[j]);
}
}
var midToEnd = GeneratePointsBetween(midPoint, end, 0.8f, 0.4f, 8.0);
for (int j = 1; j < midToEnd.Count; j++)
{
@@ -2259,7 +2259,7 @@ namespace Ink_Canvas
{
return points;
}
return newPoint;
}
+5 -5
View File
@@ -35,27 +35,27 @@ namespace Ink_Canvas
/// 当前提交类型
/// </summary>
private CommitReason _currentCommitType = CommitReason.UserInput;
/// <summary>
/// 是否为点橡皮擦模式
/// </summary>
private bool IsEraseByPoint => inkCanvas.EditingMode == InkCanvasEditingMode.EraseByPoint;
/// <summary>
/// 替换的笔画集合
/// </summary>
private StrokeCollection ReplacedStroke;
/// <summary>
/// 添加的笔画集合
/// </summary>
private StrokeCollection AddedStroke;
/// <summary>
/// 长方体笔画集合
/// </summary>
private StrokeCollection CuboidStrokeCollection;
/// <summary>
/// 笔画操作历史记录
/// </summary>
+13 -12
View File
@@ -743,7 +743,7 @@ namespace Ink_Canvas
{
return true;
}
else if (Settings.Automation.IsAutoFoldInSeewoPincoTeacher &&
else if (Settings.Automation.IsAutoFoldInSeewoPincoTeacher &&
(windowProcessName == "BoardService" || windowProcessName == "seewoPincoTeacher"))
{
return true;
@@ -760,7 +760,7 @@ namespace Ink_Canvas
{
return true;
}
else if (Settings.Automation.IsAutoFoldInMSWhiteboard &&
else if (Settings.Automation.IsAutoFoldInMSWhiteboard &&
(windowProcessName == "MicrosoftWhiteboard" || windowProcessName == "msedgewebview2"))
{
return true;
@@ -899,7 +899,7 @@ namespace Ink_Canvas
return true;
}
// 检查SeewoPinco
else if (Settings.Automation.IsAutoFoldInSeewoPincoTeacher &&
else if (Settings.Automation.IsAutoFoldInSeewoPincoTeacher &&
(windowProcessName == "BoardService" || windowProcessName == "seewoPincoTeacher"))
{
return true;
@@ -926,7 +926,7 @@ namespace Ink_Canvas
return true;
}
// 检查MSWhiteboard
else if (Settings.Automation.IsAutoFoldInMSWhiteboard &&
else if (Settings.Automation.IsAutoFoldInMSWhiteboard &&
(windowProcessName == "MicrosoftWhiteboard" || windowProcessName == "msedgewebview2"))
{
return true;
@@ -1027,19 +1027,20 @@ namespace Ink_Canvas
var windowTitle = ForegroundWindowInfo.WindowTitle();
Thickness currentMargin = new Thickness();
Dispatcher.Invoke(() => {
Dispatcher.Invoke(() =>
{
currentMargin = ViewboxFloatingBar.Margin;
});
if (hasFullScreen)
{
if (!isFloatingBarFolded)
if (!isFloatingBarFolded)
{
FoldFloatingBar_MouseUp(null, null);
}
else if (currentMargin.Left > -50 && !isFloatingBarChangingHideMode)
{
FoldFloatingBar_MouseUp(null, null);
FoldFloatingBar_MouseUp(null, null);
}
return;
}
@@ -1052,20 +1053,20 @@ namespace Ink_Canvas
{
var versionInfo = FileVersionInfo.GetVersionInfo(ForegroundWindowInfo.ProcessPath());
string version = versionInfo.FileVersion;
if (version.StartsWith("5.") && Settings.Automation.IsAutoFoldInEasiNote)
{
bool isAnnotationWindow = windowTitle.Length == 0 && ForegroundWindowInfo.WindowRect().Height < 500;
if (Settings.Automation.IsAutoFoldInEasiNoteIgnoreDesktopAnno && isAnnotationWindow)
{
if (!isFloatingBarFolded)
if (!isFloatingBarFolded)
{
FoldFloatingBar_MouseUp(null, null);
}
}
else if (!isAnnotationWindow)
{
if (!unfoldFloatingBarByUser && !isFloatingBarFolded)
if (!unfoldFloatingBarByUser && !isFloatingBarFolded)
{
FoldFloatingBar_MouseUp(null, null);
}
@@ -1457,7 +1458,7 @@ namespace Ink_Canvas
try
{
// 检查是否仍然在橡皮擦模式
if (inkCanvas.EditingMode != InkCanvasEditingMode.EraseByPoint &&
if (inkCanvas.EditingMode != InkCanvasEditingMode.EraseByPoint &&
inkCanvas.EditingMode != InkCanvasEditingMode.EraseByStroke)
{
StopEraserAutoSwitchBackTimer();
@@ -5,7 +5,6 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
+2 -4
View File
@@ -1,9 +1,7 @@
using Ink_Canvas.Helpers;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
namespace Ink_Canvas
@@ -121,12 +119,12 @@ namespace Ink_Canvas
CursorIcon_Click(null, null);
break;
case "eraser":
PenIcon_Click(null, null);
PenIcon_Click(null, null);
EraserIcon_Click(null, null);
break;
case "eraserbystrokes":
case "eraserstroke":
PenIcon_Click(null, null);
PenIcon_Click(null, null);
EraserIconByStrokes_Click(EraserByStrokes_Icon, null);
break;
default:
@@ -11,7 +11,6 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
@@ -609,12 +608,12 @@ namespace Ink_Canvas
{
var ci = new CapturedImage(bmpImage);
_capturedPhotos.Insert(0, ci);
while (_capturedPhotos.Count > MaxCapturedPhotos)
{
_capturedPhotos.RemoveAt(_capturedPhotos.Count - 1);
}
UpdateCapturedPhotosDisplay();
}));
}