Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad18277223 | |||
| 661fd21626 | |||
| d8fd231476 | |||
| 8d611a22a2 | |||
| 6cb8b188ec | |||
| d1d0e00959 | |||
| cbc317795e | |||
| ab88c34abc | |||
| 18b0556f7a | |||
| 7bea23005d | |||
| b46cbcc15f |
@@ -1,17 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ using System.Drawing;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Win32;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
@@ -147,12 +148,18 @@ namespace Ink_Canvas {
|
||||
private void inkCanvas_EditingModeChanged(object sender, RoutedEventArgs e) {
|
||||
var inkCanvas1 = sender as InkCanvas;
|
||||
if (inkCanvas1 == null) return;
|
||||
// 修复“显示画笔光标”选项不可用的问题
|
||||
if (Settings.Canvas.IsShowCursor) {
|
||||
if (inkCanvas1.EditingMode == InkCanvasEditingMode.Ink || drawingShapeMode != 0)
|
||||
inkCanvas1.UseCustomCursor = true;
|
||||
// 修复触屏和数位笔时光标不显示:只要有输入设备悬停、捕获,或有任何Stylus设备连接就显示
|
||||
if ((inkCanvas1.EditingMode == InkCanvasEditingMode.Ink || drawingShapeMode != 0)
|
||||
&& (inkCanvas1.IsStylusDirectlyOver || inkCanvas1.IsMouseDirectlyOver || inkCanvas1.IsStylusCaptured || inkCanvas1.IsMouseCaptured
|
||||
|| Stylus.CurrentStylusDevice != null))
|
||||
inkCanvas1.ForceCursor = true;
|
||||
else
|
||||
inkCanvas1.ForceCursor = false;
|
||||
} else {
|
||||
inkCanvas1.UseCustomCursor = false;
|
||||
inkCanvas1.ForceCursor = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ namespace Ink_Canvas {
|
||||
if (Settings.Automation.IsAutoSaveStrokesAtClear &&
|
||||
inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) SaveScreenShot(true);
|
||||
if (CurrentWhiteboardIndex >= WhiteboardTotalCount) {
|
||||
// 在最后一页时,点击“新页面”按钮直接新增一页
|
||||
BtnWhiteBoardAdd_Click(sender, e);
|
||||
return;
|
||||
}
|
||||
@@ -166,64 +167,35 @@ namespace Ink_Canvas {
|
||||
TextBlockWhiteBoardIndexInfo.Text =
|
||||
$"{CurrentWhiteboardIndex}/{WhiteboardTotalCount}";
|
||||
|
||||
if (CurrentWhiteboardIndex == WhiteboardTotalCount) {
|
||||
var newImageSource = new BitmapImage();
|
||||
newImageSource.BeginInit();
|
||||
newImageSource.UriSource = new Uri("/Resources/Icons-Fluent/ic_fluent_add_circle_24_regular.png",
|
||||
UriKind.RelativeOrAbsolute);
|
||||
newImageSource.EndInit();
|
||||
//BoardLeftPannelNextPage.Source = newImageSource;
|
||||
//BoardRightPannelNextPage.Source = newImageSource;
|
||||
//BoardRightPannelNextPageTextBlock.Text = "加页";
|
||||
//BoardLeftPannelNextPageTextBlock.Text = "加页";
|
||||
} else {
|
||||
var newImageSource = new BitmapImage();
|
||||
newImageSource.BeginInit();
|
||||
newImageSource.UriSource =
|
||||
new Uri("/Resources/Icons-Fluent/ic_fluent_arrow_circle_right_24_regular.png",
|
||||
UriKind.RelativeOrAbsolute);
|
||||
newImageSource.EndInit();
|
||||
//BoardLeftPannelNextPage.Source = newImageSource;
|
||||
//BoardRightPannelNextPage.Source = newImageSource;
|
||||
//BoardRightPannelNextPageTextBlock.Text = "下一页";
|
||||
//BoardLeftPannelNextPageTextBlock.Text = "下一页";
|
||||
}
|
||||
bool isLastPage = CurrentWhiteboardIndex == WhiteboardTotalCount;
|
||||
bool isMaxPage = WhiteboardTotalCount >= 99;
|
||||
|
||||
// 设置按钮文本
|
||||
BtnLeftWhiteBoardSwitchNextLabel.Text = isLastPage ? "新页面" : "下一页";
|
||||
BtnRightWhiteBoardSwitchNextLabel.Text = isLastPage ? "新页面" : "下一页";
|
||||
|
||||
// 始终允许点击“下一页/新页面”按钮(除非已达最大页数)
|
||||
BtnWhiteBoardSwitchNext.IsEnabled = !isMaxPage;
|
||||
|
||||
// 保持按钮常亮(高亮)
|
||||
BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
|
||||
BtnLeftWhiteBoardSwitchNextLabel.Opacity = 1;
|
||||
BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
|
||||
BtnRightWhiteBoardSwitchNextLabel.Opacity = 1;
|
||||
|
||||
BtnWhiteBoardSwitchPrevious.IsEnabled = true;
|
||||
BtnWhiteBoardSwitchNext.IsEnabled = true;
|
||||
|
||||
if (CurrentWhiteboardIndex == 1) {
|
||||
BtnWhiteBoardSwitchPrevious.IsEnabled = false;
|
||||
BtnLeftWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
|
||||
BtnLeftWhiteBoardSwitchPreviousLabel.Opacity = 0.5;
|
||||
BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
|
||||
BtnLeftWhiteBoardSwitchNextLabel.Opacity = 1;
|
||||
|
||||
BtnRightWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
|
||||
BtnRightWhiteBoardSwitchPreviousLabel.Opacity = 0.5;
|
||||
BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
|
||||
BtnRightWhiteBoardSwitchNextLabel.Opacity = 1;
|
||||
} else {
|
||||
BtnLeftWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
|
||||
BtnLeftWhiteBoardSwitchPreviousLabel.Opacity = 1;
|
||||
|
||||
BtnRightWhiteBoardSwitchPreviousGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
|
||||
BtnRightWhiteBoardSwitchPreviousLabel.Opacity = 1;
|
||||
|
||||
if (CurrentWhiteboardIndex == WhiteboardTotalCount) {
|
||||
BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
|
||||
BtnLeftWhiteBoardSwitchNextLabel.Opacity = 0.5;
|
||||
|
||||
BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(127, 24, 24, 27));
|
||||
BtnRightWhiteBoardSwitchNextLabel.Opacity = 0.5;
|
||||
BtnWhiteBoardSwitchNext.IsEnabled = false;
|
||||
} else {
|
||||
BtnLeftWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
|
||||
BtnLeftWhiteBoardSwitchNextLabel.Opacity = 1;
|
||||
|
||||
BtnRightWhiteBoardSwitchNextGeometry.Brush = new SolidColorBrush(Color.FromArgb(255, 24, 24, 27));
|
||||
BtnRightWhiteBoardSwitchNextLabel.Opacity = 1;
|
||||
}
|
||||
}
|
||||
|
||||
BtnWhiteBoardDelete.IsEnabled = WhiteboardTotalCount != 1;
|
||||
|
||||
@@ -29,16 +29,6 @@ namespace Ink_Canvas {
|
||||
|
||||
private void BtnCheckPPT_Click(object sender, RoutedEventArgs e) {
|
||||
try {
|
||||
pptApplication = null;
|
||||
// 优先检测WPS(wpp.Application),获取不到再尝试PowerPoint
|
||||
try {
|
||||
pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Marshal.GetActiveObject("wpp.Application");
|
||||
} catch { }
|
||||
if (pptApplication == null) {
|
||||
try {
|
||||
pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Marshal.GetActiveObject("PowerPoint.Application");
|
||||
} catch { }
|
||||
}
|
||||
if (pptApplication != null) {
|
||||
//获得演示文稿对象
|
||||
presentation = pptApplication.ActivePresentation;
|
||||
@@ -138,8 +128,8 @@ namespace Ink_Canvas {
|
||||
pptApplication = null;
|
||||
}
|
||||
|
||||
// 如果没有找到运行中的实例,则创建新实例
|
||||
if (pptApplication == null)
|
||||
// 如果没有找到运行中的实例,则自动创建PowerPoint进程(仅在未启用WPS支持时)
|
||||
if (pptApplication == null && !isWPSSupportOn)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -148,19 +138,7 @@ namespace Ink_Canvas {
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 如果WPS支持开启,尝试创建WPS实例
|
||||
if (isWPSSupportOn)
|
||||
{
|
||||
try
|
||||
{
|
||||
pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Activator.CreateInstance(
|
||||
Type.GetTypeFromProgID("wpp.Application"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
pptApplication = null;
|
||||
}
|
||||
}
|
||||
pptApplication = null;
|
||||
}
|
||||
}
|
||||
isPowerPointInitialized = true;
|
||||
@@ -191,28 +169,23 @@ namespace Ink_Canvas {
|
||||
}
|
||||
slide = null;
|
||||
isPowerPointInitialized = false;
|
||||
// 这里可以选择自动重启 PowerPoint 或 WPS 或等待用户操作
|
||||
try
|
||||
|
||||
// PowerPoint进程守护:自动重启PowerPoint进程(仅在未启用WPS支持时)
|
||||
if (!isWPSSupportOn)
|
||||
{
|
||||
if (isWpsMode)
|
||||
{
|
||||
// 自动重启WPS
|
||||
Process.Start("wpp.exe");
|
||||
Thread.Sleep(2000); // 等待WPS启动
|
||||
pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Activator.CreateInstance(
|
||||
Type.GetTypeFromProgID("wpp.Application"));
|
||||
}
|
||||
else
|
||||
try
|
||||
{
|
||||
pptApplication = (Microsoft.Office.Interop.PowerPoint.Application)Activator.CreateInstance(
|
||||
Marshal.GetTypeFromCLSID(new Guid("91493441-5A91-11CF-8700-00AA0060263B")));
|
||||
isPowerPointInitialized = true;
|
||||
}
|
||||
isPowerPointInitialized = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile("PowerPoint/WPS 守护重启失败: " + ex.ToString(), LogHelper.LogType.Error);
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile("PowerPoint 守护重启失败: " + ex.ToString(), LogHelper.LogType.Error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 启用WPS支持时不守护PowerPoint进程
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -786,7 +759,7 @@ namespace Ink_Canvas {
|
||||
|
||||
await Task.Delay(150);
|
||||
|
||||
Application.Current.Dispatcher.InvokeAsync(() => {
|
||||
await Application.Current.Dispatcher.InvokeAsync(() => {
|
||||
ViewboxFloatingBarMarginAnimation(100, true);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -79,6 +79,8 @@ namespace Ink_Canvas {
|
||||
}
|
||||
else {
|
||||
TouchDownPointsList[e.TouchDevice.Id] = InkCanvasEditingMode.None;
|
||||
// 修复面积擦时不显示橡皮形状:无论 forcePointEraser 状态,均显示 50x50 橡皮
|
||||
inkCanvas.EraserShape = new EllipseStylusShape(50, 50);
|
||||
inkCanvas.EditingMode = InkCanvasEditingMode.None;
|
||||
}
|
||||
}
|
||||
@@ -236,8 +238,8 @@ namespace Ink_Canvas {
|
||||
}
|
||||
else {
|
||||
isLastTouchEraser = false;
|
||||
inkCanvas.EraserShape =
|
||||
forcePointEraser ? new EllipseStylusShape(50, 50) : new EllipseStylusShape(5, 5);
|
||||
// 修复面积擦时不显示橡皮形状:无论 forcePointEraser 状态,均显示 50x50 橡皮
|
||||
inkCanvas.EraserShape = new EllipseStylusShape(50, 50);
|
||||
if (forceEraser) return;
|
||||
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
|
||||
}
|
||||
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user