1145141919810
代码清理
This commit is contained in:
@@ -1,19 +1,15 @@
|
|||||||
using Hardcodet.Wpf.TaskbarNotification;
|
using Hardcodet.Wpf.TaskbarNotification;
|
||||||
using Ink_Canvas.Helpers;
|
using Ink_Canvas.Helpers;
|
||||||
using Ink_Canvas.Windows;
|
|
||||||
using iNKORE.UI.WPF.Modern.Controls;
|
using iNKORE.UI.WPF.Modern.Controls;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
using Ink_Canvas.Helpers;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Ink_Canvas.Helpers;
|
|
||||||
|
|
||||||
namespace Ink_Canvas
|
namespace Ink_Canvas
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using Ink_Canvas.Helpers;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|||||||
@@ -276,16 +276,16 @@ namespace Ink_Canvas.Helpers
|
|||||||
var width = sourceFrame.Width;
|
var width = sourceFrame.Width;
|
||||||
var height = sourceFrame.Height;
|
var height = sourceFrame.Height;
|
||||||
|
|
||||||
if (width > 0 && height > 0)
|
if (width > 0 && height > 0)
|
||||||
{
|
{
|
||||||
// 应用旋转
|
// 应用旋转
|
||||||
Bitmap rotatedFrame = ApplyRotation(sourceFrame);
|
Bitmap rotatedFrame = ApplyRotation(sourceFrame);
|
||||||
|
|
||||||
// 应用分辨率调整
|
// 应用分辨率调整
|
||||||
_currentFrame = ResizeImage(rotatedFrame, _resolutionWidth, _resolutionHeight);
|
_currentFrame = ResizeImage(rotatedFrame, _resolutionWidth, _resolutionHeight);
|
||||||
|
|
||||||
rotatedFrame?.Dispose();
|
rotatedFrame?.Dispose();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_currentFrame = null;
|
_currentFrame = null;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ using System.IO;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Ink_Canvas.Helpers
|
namespace Ink_Canvas.Helpers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Ink_Canvas.Helpers;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -46,29 +45,35 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 绑定事件处理
|
// 绑定事件处理
|
||||||
canvas.StylusDown += ((o, args) => {
|
canvas.StylusDown += ((o, args) =>
|
||||||
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
if (args.StylusDevice.TabletDevice.Type == TabletDeviceType.Stylus) canvas.CaptureStylus();
|
if (args.StylusDevice.TabletDevice.Type == TabletDeviceType.Stylus) canvas.CaptureStylus();
|
||||||
EraserOverlay_PointerDown(sender);
|
EraserOverlay_PointerDown(sender);
|
||||||
});
|
});
|
||||||
canvas.StylusUp += ((o, args) => {
|
canvas.StylusUp += ((o, args) =>
|
||||||
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
if (args.StylusDevice.TabletDevice.Type == TabletDeviceType.Stylus) canvas.ReleaseStylusCapture();
|
if (args.StylusDevice.TabletDevice.Type == TabletDeviceType.Stylus) canvas.ReleaseStylusCapture();
|
||||||
EraserOverlay_PointerUp(sender);
|
EraserOverlay_PointerUp(sender);
|
||||||
});
|
});
|
||||||
canvas.StylusMove += ((o, args) => {
|
canvas.StylusMove += ((o, args) =>
|
||||||
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
EraserOverlay_PointerMove(sender, args.GetPosition(inkCanvas));
|
EraserOverlay_PointerMove(sender, args.GetPosition(inkCanvas));
|
||||||
});
|
});
|
||||||
canvas.MouseDown += ((o, args) => {
|
canvas.MouseDown += ((o, args) =>
|
||||||
|
{
|
||||||
canvas.CaptureMouse();
|
canvas.CaptureMouse();
|
||||||
EraserOverlay_PointerDown(sender);
|
EraserOverlay_PointerDown(sender);
|
||||||
});
|
});
|
||||||
canvas.MouseUp += ((o, args) => {
|
canvas.MouseUp += ((o, args) =>
|
||||||
|
{
|
||||||
canvas.ReleaseMouseCapture();
|
canvas.ReleaseMouseCapture();
|
||||||
EraserOverlay_PointerUp(sender);
|
EraserOverlay_PointerUp(sender);
|
||||||
});
|
});
|
||||||
canvas.MouseMove += ((o, args) => {
|
canvas.MouseMove += ((o, args) =>
|
||||||
|
{
|
||||||
EraserOverlay_PointerMove(sender, args.GetPosition(inkCanvas));
|
EraserOverlay_PointerMove(sender, args.GetPosition(inkCanvas));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -301,8 +306,8 @@ namespace Ink_Canvas
|
|||||||
if (isEraserCircleShape)
|
if (isEraserCircleShape)
|
||||||
{
|
{
|
||||||
eraserWidth = k * 90; // 圆形橡皮擦
|
eraserWidth = k * 90; // 圆形橡皮擦
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eraserWidth = k * 90 * 0.6; // 矩形橡皮擦宽度
|
eraserWidth = k * 90 * 0.6; // 矩形橡皮擦宽度
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1975,7 +1975,7 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 禁用高级橡皮擦系统
|
// 禁用高级橡皮擦系统
|
||||||
DisableEraserOverlay();
|
DisableEraserOverlay();
|
||||||
|
|
||||||
ExitMultiTouchModeIfNeeded();
|
ExitMultiTouchModeIfNeeded();
|
||||||
|
|
||||||
@@ -2222,7 +2222,7 @@ namespace Ink_Canvas
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 启用新的高级橡皮擦系统
|
// 启用新的高级橡皮擦系统
|
||||||
EnableEraserOverlay();
|
EnableEraserOverlay();
|
||||||
|
|
||||||
// 使用新的高级橡皮擦系统
|
// 使用新的高级橡皮擦系统
|
||||||
// 使用集中化的工具模式切换方法
|
// 使用集中化的工具模式切换方法
|
||||||
@@ -2234,7 +2234,7 @@ namespace Ink_Canvas
|
|||||||
ApplyAdvancedEraserShape(); // 使用新的橡皮擦形状应用方法
|
ApplyAdvancedEraserShape(); // 使用新的橡皮擦形状应用方法
|
||||||
SetCursorBasedOnEditingMode(inkCanvas);
|
SetCursorBasedOnEditingMode(inkCanvas);
|
||||||
HideSubPanels("eraser"); // 高亮橡皮按钮
|
HideSubPanels("eraser"); // 高亮橡皮按钮
|
||||||
Trace.WriteLine($"Eraser: Eraser button clicked, current size: {eraserWidth}, circle: {isEraserCircleShape}");
|
Trace.WriteLine($"Eraser: Eraser button clicked, current size: {eraserWidth}, circle: {isEraserCircleShape}");
|
||||||
|
|
||||||
if (isAlreadyEraser)
|
if (isAlreadyEraser)
|
||||||
{
|
{
|
||||||
@@ -2263,7 +2263,7 @@ namespace Ink_Canvas
|
|||||||
drawingShapeMode = 0;
|
drawingShapeMode = 0;
|
||||||
|
|
||||||
// 启用新的高级橡皮擦系统
|
// 启用新的高级橡皮擦系统
|
||||||
EnableEraserOverlay();
|
EnableEraserOverlay();
|
||||||
|
|
||||||
// 使用新的高级橡皮擦系统
|
// 使用新的高级橡皮擦系统
|
||||||
// 使用集中化的工具模式切换方法
|
// 使用集中化的工具模式切换方法
|
||||||
@@ -2578,7 +2578,7 @@ namespace Ink_Canvas
|
|||||||
private void SelectIcon_MouseUp(object sender, RoutedEventArgs e)
|
private void SelectIcon_MouseUp(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// 禁用高级橡皮擦系统
|
// 禁用高级橡皮擦系统
|
||||||
DisableEraserOverlay();
|
DisableEraserOverlay();
|
||||||
|
|
||||||
forceEraser = true;
|
forceEraser = true;
|
||||||
drawingShapeMode = 0;
|
drawingShapeMode = 0;
|
||||||
|
|||||||
@@ -819,7 +819,7 @@ namespace Ink_Canvas
|
|||||||
isEnteredSlideShowEndEvent = true;
|
isEnteredSlideShowEndEvent = true;
|
||||||
|
|
||||||
// 保存所有墨迹
|
// 保存所有墨迹
|
||||||
_multiPPTInkManager?.SaveAllStrokesToFile(pres);
|
_multiPPTInkManager?.SaveAllStrokesToFile(pres);
|
||||||
|
|
||||||
await Application.Current.Dispatcher.InvokeAsync(() =>
|
await Application.Current.Dispatcher.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ 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 WinForms = System.Windows.Forms;
|
|
||||||
using File = System.IO.File;
|
using File = System.IO.File;
|
||||||
using OperatingSystem = OSVersionExtension.OperatingSystem;
|
using OperatingSystem = OSVersionExtension.OperatingSystem;
|
||||||
|
using WinForms = System.Windows.Forms;
|
||||||
|
|
||||||
namespace Ink_Canvas
|
namespace Ink_Canvas
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ namespace Ink_Canvas
|
|||||||
// 如果时间差超过3分钟,则使用网络时间
|
// 如果时间差超过3分钟,则使用网络时间
|
||||||
useNetworkTime = Math.Abs(networkTimeOffset.TotalMinutes) > 3.0;
|
useNetworkTime = Math.Abs(networkTimeOffset.TotalMinutes) > 3.0;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// NTP同步失败时,保持使用本地时间
|
// NTP同步失败时,保持使用本地时间
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ namespace Ink_Canvas
|
|||||||
var strokeVisual = GetStrokeVisual(e.StylusDevice.Id);
|
var strokeVisual = GetStrokeVisual(e.StylusDevice.Id);
|
||||||
var stylusPointCollection = e.GetStylusPoints(this);
|
var stylusPointCollection = e.GetStylusPoints(this);
|
||||||
foreach (var stylusPoint in stylusPointCollection)
|
foreach (var stylusPoint in stylusPointCollection)
|
||||||
strokeVisual.Add(new StylusPoint(stylusPoint.X, stylusPoint.Y, stylusPoint.PressureFactor));
|
strokeVisual.Add(new StylusPoint(stylusPoint.X, stylusPoint.Y, stylusPoint.PressureFactor));
|
||||||
strokeVisual.Redraw();
|
strokeVisual.Redraw();
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
@@ -917,7 +917,7 @@ namespace Ink_Canvas
|
|||||||
inkCanvas.EditingMode = lastInkCanvasEditingMode;
|
inkCanvas.EditingMode = lastInkCanvasEditingMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPalmEraserActive)
|
if (isPalmEraserActive)
|
||||||
{
|
{
|
||||||
LogHelper.WriteLogToFile("Palm eraser force recovery - all touch points cleared");
|
LogHelper.WriteLogToFile("Palm eraser force recovery - all touch points cleared");
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Ink_Canvas.Helpers;
|
using Ink_Canvas.Helpers;
|
||||||
using Ink_Canvas.Resources;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Media;
|
using System.Media;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
@@ -7,7 +6,6 @@ using System.Windows;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
|
|
||||||
namespace Ink_Canvas
|
namespace Ink_Canvas
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System;
|
using Ink_Canvas.Helpers;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
@@ -7,15 +9,13 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using System.Drawing;
|
|
||||||
using Ink_Canvas.Helpers;
|
|
||||||
using Brushes = System.Windows.Media.Brushes;
|
using Brushes = System.Windows.Media.Brushes;
|
||||||
using Color = System.Windows.Media.Color;
|
using Color = System.Windows.Media.Color;
|
||||||
using DrawingRectangle = System.Drawing.Rectangle;
|
using DrawingRectangle = System.Drawing.Rectangle;
|
||||||
using WpfPoint = System.Windows.Point;
|
|
||||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||||
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
||||||
using WpfCanvas = System.Windows.Controls.Canvas;
|
using WpfCanvas = System.Windows.Controls.Canvas;
|
||||||
|
using WpfPoint = System.Windows.Point;
|
||||||
|
|
||||||
namespace Ink_Canvas
|
namespace Ink_Canvas
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using System.IO;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Ink_Canvas.Windows
|
namespace Ink_Canvas.Windows
|
||||||
{
|
{
|
||||||
@@ -180,7 +179,7 @@ namespace Ink_Canvas.Windows
|
|||||||
LoadingText.FontWeight = FontWeights.SemiBold;
|
LoadingText.FontWeight = FontWeights.SemiBold;
|
||||||
LoadingText.Foreground = Brushes.White;
|
LoadingText.Foreground = Brushes.White;
|
||||||
LoadingText.HorizontalAlignment = HorizontalAlignment.Center;
|
LoadingText.HorizontalAlignment = HorizontalAlignment.Center;
|
||||||
LoadingText.Margin = new Thickness(0,200,140,4);
|
LoadingText.Margin = new Thickness(0, 200, 140, 4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -189,7 +188,7 @@ namespace Ink_Canvas.Windows
|
|||||||
LoadingText.FontWeight = FontWeights.SemiBold;
|
LoadingText.FontWeight = FontWeights.SemiBold;
|
||||||
LoadingText.Foreground = Brushes.White;
|
LoadingText.Foreground = Brushes.White;
|
||||||
LoadingText.HorizontalAlignment = HorizontalAlignment.Center;
|
LoadingText.HorizontalAlignment = HorizontalAlignment.Center;
|
||||||
LoadingText.Margin = new Thickness(0,200,0,0);
|
LoadingText.Margin = new Thickness(0, 200, 0, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user