improve:截图及浮动栏及代码优化
This commit is contained in:
@@ -4,10 +4,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Ink;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using System.Windows;
|
||||
|
||||
namespace Ink_Canvas.Helpers
|
||||
{
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -17,6 +15,8 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Ink_Canvas.Helpers
|
||||
{
|
||||
@@ -1361,16 +1361,14 @@ namespace Ink_Canvas.Helpers
|
||||
|
||||
if (oldProcessId > 0 && !string.IsNullOrEmpty(extractPath) && !string.IsNullOrEmpty(targetPath))
|
||||
{
|
||||
LogHelper.WriteLogToFile($"AutoUpdate | 参数验证通过,启动更新任务");
|
||||
LogHelper.WriteLogToFile("AutoUpdate | 参数验证通过,启动更新任务");
|
||||
// 启动更新任务
|
||||
Task.Run(async () => await PerformUpdate(oldProcessId, extractPath, targetPath, isSilence));
|
||||
return true; // 返回true表示是更新模式
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.WriteLogToFile($"AutoUpdate | 参数验证失败 - 老进程ID: {oldProcessId}, 解压路径: {extractPath}, 目标路径: {targetPath}", LogHelper.LogType.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
LogHelper.WriteLogToFile($"AutoUpdate | 参数验证失败 - 老进程ID: {oldProcessId}, 解压路径: {extractPath}, 目标路径: {targetPath}", LogHelper.LogType.Error);
|
||||
return false;
|
||||
}
|
||||
return false; // 返回false表示不是更新模式
|
||||
}
|
||||
@@ -1483,7 +1481,7 @@ namespace Ink_Canvas.Helpers
|
||||
}
|
||||
|
||||
// 删除ZIP文件
|
||||
string zipFile = Path.Combine(updatesFolderPath, $"InkCanvasForClass.CE.*.zip");
|
||||
string zipFile = Path.Combine(updatesFolderPath, "InkCanvasForClass.CE.*.zip");
|
||||
string[] zipFiles = Directory.GetFiles(updatesFolderPath, "InkCanvasForClass.CE.*.zip");
|
||||
foreach (string zip in zipFiles)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -6,6 +5,7 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Ink_Canvas.Helpers
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Input;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Windows.Input;
|
||||
using Newtonsoft.Json;
|
||||
using NHotkey.Wpf;
|
||||
|
||||
@@ -16,7 +17,7 @@ namespace Ink_Canvas.Helpers
|
||||
#region Private Fields
|
||||
private readonly Dictionary<string, HotkeyInfo> _registeredHotkeys;
|
||||
private readonly MainWindow _mainWindow;
|
||||
private bool _isDisposed = false;
|
||||
private bool _isDisposed;
|
||||
private bool _hotkeysShouldBeRegistered = true; // 启动时注册热键
|
||||
|
||||
// 配置文件路径
|
||||
@@ -180,7 +181,7 @@ namespace Ink_Canvas.Helpers
|
||||
}
|
||||
|
||||
// 读取配置文件内容
|
||||
string jsonContent = File.ReadAllText(HotkeyConfigFile, System.Text.Encoding.UTF8);
|
||||
string jsonContent = File.ReadAllText(HotkeyConfigFile, Encoding.UTF8);
|
||||
if (string.IsNullOrEmpty(jsonContent))
|
||||
{
|
||||
LogHelper.WriteLogToFile("快捷键配置文件为空", LogHelper.LogType.Warning);
|
||||
@@ -509,7 +510,7 @@ namespace Ink_Canvas.Helpers
|
||||
}
|
||||
|
||||
// 读取配置文件内容
|
||||
string jsonContent = File.ReadAllText(HotkeyConfigFile, System.Text.Encoding.UTF8);
|
||||
string jsonContent = File.ReadAllText(HotkeyConfigFile, Encoding.UTF8);
|
||||
if (string.IsNullOrEmpty(jsonContent))
|
||||
{
|
||||
LogHelper.WriteLogToFile("快捷键配置文件为空", LogHelper.LogType.Warning);
|
||||
@@ -607,7 +608,7 @@ namespace Ink_Canvas.Helpers
|
||||
string jsonContent = JsonConvert.SerializeObject(config, settings);
|
||||
|
||||
// 直接写入原文件,覆盖原有内容
|
||||
File.WriteAllText(HotkeyConfigFile, jsonContent, System.Text.Encoding.UTF8);
|
||||
File.WriteAllText(HotkeyConfigFile, jsonContent, Encoding.UTF8);
|
||||
|
||||
LogHelper.WriteLogToFile($"快捷键配置已保存到: {HotkeyConfigFile}", LogHelper.LogType.Event);
|
||||
return true;
|
||||
@@ -714,7 +715,7 @@ namespace Ink_Canvas.Helpers
|
||||
var getLeftMethod = canvasType.GetMethod("GetLeft", BindingFlags.Public | BindingFlags.Static);
|
||||
if (getLeftMethod != null)
|
||||
{
|
||||
var leftPosition = getLeftMethod.Invoke(null, new object[] { floatingbarSelectionBG });
|
||||
var leftPosition = getLeftMethod.Invoke(null, new[] { floatingbarSelectionBG });
|
||||
if (leftPosition != null)
|
||||
{
|
||||
var position = Convert.ToDouble(leftPosition);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Threading;
|
||||
using System.Windows.Ink;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Ink;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace Ink_Canvas.Helpers
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace Ink_Canvas.Helpers
|
||||
/// <summary>
|
||||
/// 是否启用墨迹渐隐功能
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = false;
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 墨迹渐隐时间(毫秒)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Ink_Canvas.Helpers
|
||||
{
|
||||
@@ -63,7 +64,7 @@ namespace Ink_Canvas.Helpers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载平滑配置失败: {ex.Message}");
|
||||
Debug.WriteLine($"加载平滑配置失败: {ex.Message}");
|
||||
}
|
||||
|
||||
return config;
|
||||
@@ -124,7 +125,7 @@ namespace Ink_Canvas.Helpers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"保存平滑配置失败: {ex.Message}");
|
||||
Debug.WriteLine($"保存平滑配置失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Microsoft.Office.Interop.PowerPoint;
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Windows.Ink;
|
||||
using Microsoft.Office.Interop.PowerPoint;
|
||||
|
||||
namespace Ink_Canvas.Helpers
|
||||
{
|
||||
@@ -23,7 +23,7 @@ namespace Ink_Canvas.Helpers
|
||||
private int _maxSlides = 100;
|
||||
private string _currentPresentationId = "";
|
||||
private readonly object _lockObject = new object();
|
||||
private bool _disposed = false;
|
||||
private bool _disposed;
|
||||
|
||||
// 墨迹锁定机制,防止翻页时的墨迹冲突
|
||||
private DateTime _inkLockUntil = DateTime.MinValue;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.Office.Interop.PowerPoint;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@@ -8,6 +7,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
using System.Windows.Threading;
|
||||
using Microsoft.Office.Interop.PowerPoint;
|
||||
using Application = System.Windows.Application;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
@@ -101,9 +101,9 @@ namespace Ink_Canvas.Helpers
|
||||
private int _wpsProcessCheckCount;
|
||||
private WpsWindowInfo _lastForegroundWpsWindow;
|
||||
private DateTime _lastWindowCheckTime = DateTime.MinValue;
|
||||
private bool _lastSlideShowState = false;
|
||||
private bool _lastSlideShowState;
|
||||
private readonly object _lockObject = new object();
|
||||
private bool _disposed = false;
|
||||
private bool _disposed;
|
||||
#endregion
|
||||
|
||||
#region Constructor & Initialization
|
||||
@@ -888,11 +888,9 @@ namespace Ink_Canvas.Helpers
|
||||
LogHelper.WriteLogToFile("成功显示幻灯片导航(PowerPoint模式)", LogHelper.LogType.Event);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.WriteLogToFile("SlideNavigation对象为空,可能是WPS不支持此功能", LogHelper.LogType.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
LogHelper.WriteLogToFile("SlideNavigation对象为空,可能是WPS不支持此功能", LogHelper.LogType.Warning);
|
||||
return false;
|
||||
}
|
||||
catch (COMException comEx)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
|
||||
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
||||
{
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -10,6 +8,8 @@ using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using Ink_Canvas.Windows;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Ink_Canvas.Windows;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
||||
{
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -7,6 +5,8 @@ using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Ink_Canvas.Helpers.Plugins
|
||||
{
|
||||
@@ -46,17 +46,15 @@ namespace Ink_Canvas.Helpers.Plugins
|
||||
{
|
||||
return typedValue;
|
||||
}
|
||||
else
|
||||
|
||||
// 尝试类型转换
|
||||
try
|
||||
{
|
||||
// 尝试类型转换
|
||||
try
|
||||
{
|
||||
return (T)Convert.ChangeType(value, typeof(T));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
return (T)Convert.ChangeType(value, typeof(T));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using Ink_Canvas.Windows;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -10,6 +8,8 @@ using System.Security.Cryptography;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Ink_Canvas.Windows;
|
||||
using Newtonsoft.Json;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
namespace Ink_Canvas.Helpers.Plugins
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ink_Canvas.Helpers.Plugins
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Ink_Canvas.Helpers
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user