代码清理
This commit is contained in:
@@ -454,7 +454,7 @@ namespace Ink_Canvas.Helpers
|
||||
{
|
||||
// 如果设置允许,则在鼠标模式下也启用快捷键
|
||||
EnableHotkeyRegistration();
|
||||
|
||||
|
||||
if (_hotkeysShouldBeRegistered && _registeredHotkeys.Count == 0)
|
||||
{
|
||||
LoadHotkeysFromSettings();
|
||||
@@ -470,7 +470,7 @@ namespace Ink_Canvas.Helpers
|
||||
{
|
||||
// 非鼠标模式下启用快捷键
|
||||
EnableHotkeyRegistration();
|
||||
|
||||
|
||||
if (_hotkeysShouldBeRegistered && _registeredHotkeys.Count == 0)
|
||||
{
|
||||
LoadHotkeysFromSettings();
|
||||
|
||||
@@ -23,10 +23,10 @@ namespace Ink_Canvas.Helpers
|
||||
public VisualCanvas()
|
||||
{
|
||||
CacheMode = new BitmapCache();
|
||||
|
||||
RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.HighQuality);
|
||||
RenderOptions.SetEdgeMode(this, EdgeMode.Aliased);
|
||||
RenderOptions.SetCachingHint(this, CachingHint.Cache);
|
||||
|
||||
RenderOptions.SetBitmapScalingMode(this, BitmapScalingMode.HighQuality);
|
||||
RenderOptions.SetEdgeMode(this, EdgeMode.Aliased);
|
||||
RenderOptions.SetCachingHint(this, CachingHint.Cache);
|
||||
}
|
||||
|
||||
public void AddVisual(DrawingVisual visual)
|
||||
@@ -52,9 +52,9 @@ namespace Ink_Canvas.Helpers
|
||||
/// </summary>
|
||||
public class StrokeVisual
|
||||
{
|
||||
private int _lastDrawnPointCount = 0;
|
||||
private const int INCREMENTAL_DRAW_THRESHOLD = 2;
|
||||
private VisualCanvas _visualCanvas;
|
||||
private int _lastDrawnPointCount = 0;
|
||||
private const int INCREMENTAL_DRAW_THRESHOLD = 2;
|
||||
private VisualCanvas _visualCanvas;
|
||||
|
||||
/// <summary>
|
||||
/// 创建显示笔迹的类
|
||||
@@ -118,10 +118,10 @@ namespace Ink_Canvas.Helpers
|
||||
|
||||
var points = Stroke.StylusPoints;
|
||||
var drawingAttributes = Stroke.DrawingAttributes;
|
||||
|
||||
|
||||
// 创建新的DrawingVisual用于绘制这个点段
|
||||
var segmentVisual = new DrawingVisual();
|
||||
|
||||
|
||||
RenderOptions.SetBitmapScalingMode(segmentVisual, BitmapScalingMode.HighQuality);
|
||||
RenderOptions.SetEdgeMode(segmentVisual, EdgeMode.Aliased);
|
||||
RenderOptions.SetCachingHint(segmentVisual, CachingHint.Cache);
|
||||
@@ -149,7 +149,7 @@ namespace Ink_Canvas.Helpers
|
||||
// 只有一个点,绘制圆点
|
||||
var brush = new SolidColorBrush(drawingAttributes.Color);
|
||||
var point = points[startIndex];
|
||||
dc.DrawEllipse(brush, null, new Point(point.X, point.Y),
|
||||
dc.DrawEllipse(brush, null, new Point(point.X, point.Y),
|
||||
drawingAttributes.Width / 2, drawingAttributes.Height / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Office.Interop.PowerPoint;
|
||||
using Microsoft.Office.Core;
|
||||
using Microsoft.Office.Core;
|
||||
using Microsoft.Office.Interop.PowerPoint;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
@@ -977,7 +977,7 @@ namespace Ink_Canvas
|
||||
if (DateTime.Now < pauseUntilDate)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"AutoUpdate | 自动更新已暂停,直到 {pauseUntilDate:yyyy-MM-dd}");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -73,35 +73,40 @@ namespace Ink_Canvas
|
||||
/// <summary>
|
||||
/// 用於更新浮動工具欄的"手勢"按鈕和白板工具欄的"手勢"按鈕的樣式(開啟和關閉狀態)
|
||||
/// </summary>
|
||||
private void CheckEnableTwoFingerGestureBtnColorPrompt() {
|
||||
private void CheckEnableTwoFingerGestureBtnColorPrompt()
|
||||
{
|
||||
// 根据主题选择手势图标和颜色
|
||||
bool isDarkTheme = Settings.Appearance.Theme == 1 ||
|
||||
(Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
|
||||
bool isLightTheme = !isDarkTheme;
|
||||
string gestureIconPath = isLightTheme ? "/Resources/new-icons/gesture.png" : "/Resources/new-icons/gesture_white.png";
|
||||
|
||||
|
||||
// 根据主题设置白板模式下的颜色
|
||||
Color boardBgColor, boardIconColor, boardTextColor, boardBorderColor;
|
||||
if (isLightTheme) {
|
||||
if (isLightTheme)
|
||||
{
|
||||
// 浅色主题
|
||||
boardBgColor = Color.FromRgb(244, 244, 245);
|
||||
boardIconColor = Color.FromRgb(24, 24, 27);
|
||||
boardTextColor = Color.FromRgb(24, 24, 27);
|
||||
boardBorderColor = Color.FromRgb(161, 161, 170);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// 深色主题
|
||||
boardBgColor = Color.FromRgb(39, 39, 42);
|
||||
boardIconColor = Color.FromRgb(244, 244, 245);
|
||||
boardTextColor = Color.FromRgb(244, 244, 245);
|
||||
boardBorderColor = Color.FromRgb(113, 113, 122);
|
||||
}
|
||||
|
||||
if (ToggleSwitchEnableMultiTouchMode.IsOn) {
|
||||
|
||||
if (ToggleSwitchEnableMultiTouchMode.IsOn)
|
||||
{
|
||||
TwoFingerGestureSimpleStackPanel.Opacity = 0.5;
|
||||
TwoFingerGestureSimpleStackPanel.IsHitTestVisible = false;
|
||||
EnableTwoFingerGestureBtn.Source =
|
||||
new BitmapImage(new Uri(gestureIconPath, UriKind.Relative));
|
||||
|
||||
|
||||
BoardGesture.Background = new SolidColorBrush(boardBgColor);
|
||||
BoardGestureGeometry.Brush = new SolidColorBrush(boardIconColor);
|
||||
BoardGestureGeometry2.Brush = new SolidColorBrush(boardIconColor);
|
||||
@@ -110,25 +115,28 @@ namespace Ink_Canvas
|
||||
BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.DisabledGestureIcon);
|
||||
BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
TwoFingerGestureSimpleStackPanel.Opacity = 1;
|
||||
TwoFingerGestureSimpleStackPanel.IsHitTestVisible = true;
|
||||
if (Settings.Gesture.IsEnableTwoFingerGesture) {
|
||||
if (Settings.Gesture.IsEnableTwoFingerGesture)
|
||||
{
|
||||
EnableTwoFingerGestureBtn.Source =
|
||||
new BitmapImage(new Uri("/Resources/new-icons/gesture-enabled.png", UriKind.Relative));
|
||||
|
||||
|
||||
BoardGesture.Background = new SolidColorBrush(Color.FromRgb(37, 99, 235));
|
||||
BoardGestureGeometry.Brush = new SolidColorBrush(Colors.GhostWhite);
|
||||
BoardGestureGeometry2.Brush = new SolidColorBrush(Colors.GhostWhite);
|
||||
BoardGestureLabel.Foreground = new SolidColorBrush(Colors.GhostWhite);
|
||||
BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
|
||||
BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.EnabledGestureIcon);
|
||||
BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z "+XamlGraphicsIconGeometries.EnabledGestureIconBadgeCheck);
|
||||
BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z " + XamlGraphicsIconGeometries.EnabledGestureIconBadgeCheck);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
EnableTwoFingerGestureBtn.Source =
|
||||
new BitmapImage(new Uri(gestureIconPath, UriKind.Relative));
|
||||
|
||||
|
||||
BoardGesture.Background = new SolidColorBrush(boardBgColor);
|
||||
BoardGestureGeometry.Brush = new SolidColorBrush(boardIconColor);
|
||||
BoardGestureGeometry2.Brush = new SolidColorBrush(boardIconColor);
|
||||
|
||||
@@ -5,8 +5,8 @@ using OSVersionExtension;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Forms;
|
||||
@@ -1031,7 +1031,7 @@ namespace Ink_Canvas
|
||||
bool isHalfOpacity = (bool)((CheckBox)sender).IsChecked;
|
||||
c[1] = isHalfOpacity ? '2' : '1';
|
||||
Settings.PowerPointSettings.PPTSButtonsOption = int.Parse(new string(c));
|
||||
|
||||
|
||||
// 如果开启半透明选项,设置默认透明度为0.5;否则为1.0
|
||||
if (isHalfOpacity)
|
||||
{
|
||||
@@ -1051,7 +1051,7 @@ namespace Ink_Canvas
|
||||
PPTLSButtonOpacityValueSlider.Value = Settings.PowerPointSettings.PPTLSButtonOpacity;
|
||||
PPTRSButtonOpacityValueSlider.Value = Settings.PowerPointSettings.PPTRSButtonOpacity;
|
||||
}
|
||||
|
||||
|
||||
SaveSettingsToFile();
|
||||
// 更新PPT UI管理器设置
|
||||
if (_pptUIManager != null && BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
|
||||
@@ -1106,7 +1106,7 @@ namespace Ink_Canvas
|
||||
bool isHalfOpacity = (bool)((CheckBox)sender).IsChecked;
|
||||
c[1] = isHalfOpacity ? '2' : '1';
|
||||
Settings.PowerPointSettings.PPTBButtonsOption = int.Parse(new string(c));
|
||||
|
||||
|
||||
// 如果开启半透明选项,设置默认透明度为0.5;否则为1.0
|
||||
if (isHalfOpacity)
|
||||
{
|
||||
@@ -1126,7 +1126,7 @@ namespace Ink_Canvas
|
||||
PPTLBButtonOpacityValueSlider.Value = Settings.PowerPointSettings.PPTLBButtonOpacity;
|
||||
PPTRBButtonOpacityValueSlider.Value = Settings.PowerPointSettings.PPTRBButtonOpacity;
|
||||
}
|
||||
|
||||
|
||||
SaveSettingsToFile();
|
||||
UpdatePPTUIManagerSettings();
|
||||
UpdatePPTBtnPreview();
|
||||
|
||||
@@ -557,12 +557,12 @@ namespace Ink_Canvas
|
||||
// 重用之前定义的sopsc和bopsc变量
|
||||
bool isSideHalfOpacity = sopsc.Length >= 2 && sopsc[1] == '2';
|
||||
// 如果透明度为0或未设置,根据半透明选项设置默认值
|
||||
if (Settings.PowerPointSettings.PPTLSButtonOpacity == 0.0 ||
|
||||
if (Settings.PowerPointSettings.PPTLSButtonOpacity == 0.0 ||
|
||||
(Settings.PowerPointSettings.PPTLSButtonOpacity == 1.0 && isSideHalfOpacity))
|
||||
{
|
||||
Settings.PowerPointSettings.PPTLSButtonOpacity = isSideHalfOpacity ? 0.5 : 1.0;
|
||||
}
|
||||
if (Settings.PowerPointSettings.PPTRSButtonOpacity == 0.0 ||
|
||||
if (Settings.PowerPointSettings.PPTRSButtonOpacity == 0.0 ||
|
||||
(Settings.PowerPointSettings.PPTRSButtonOpacity == 1.0 && isSideHalfOpacity))
|
||||
{
|
||||
Settings.PowerPointSettings.PPTRSButtonOpacity = isSideHalfOpacity ? 0.5 : 1.0;
|
||||
@@ -572,12 +572,12 @@ namespace Ink_Canvas
|
||||
|
||||
bool isBottomHalfOpacity = bopsc.Length >= 2 && bopsc[1] == '2';
|
||||
// 如果透明度为0或未设置,根据半透明选项设置默认值
|
||||
if (Settings.PowerPointSettings.PPTLBButtonOpacity == 0.0 ||
|
||||
if (Settings.PowerPointSettings.PPTLBButtonOpacity == 0.0 ||
|
||||
(Settings.PowerPointSettings.PPTLBButtonOpacity == 1.0 && isBottomHalfOpacity))
|
||||
{
|
||||
Settings.PowerPointSettings.PPTLBButtonOpacity = isBottomHalfOpacity ? 0.5 : 1.0;
|
||||
}
|
||||
if (Settings.PowerPointSettings.PPTRBButtonOpacity == 0.0 ||
|
||||
if (Settings.PowerPointSettings.PPTRBButtonOpacity == 0.0 ||
|
||||
(Settings.PowerPointSettings.PPTRBButtonOpacity == 1.0 && isBottomHalfOpacity))
|
||||
{
|
||||
Settings.PowerPointSettings.PPTRBButtonOpacity = isBottomHalfOpacity ? 0.5 : 1.0;
|
||||
|
||||
@@ -591,9 +591,9 @@ namespace Ink_Canvas
|
||||
for (int i = 0; i < count && candidatePool.Count > 0; i++)
|
||||
{
|
||||
int randomIndex = random.Next(0, candidatePool.Count);
|
||||
|
||||
|
||||
selectedNames.Add(candidatePool[randomIndex]);
|
||||
|
||||
|
||||
int lastIndex = candidatePool.Count - 1;
|
||||
if (randomIndex != lastIndex)
|
||||
{
|
||||
@@ -1258,17 +1258,17 @@ namespace Ink_Canvas
|
||||
// 清空名单
|
||||
nameList.Clear();
|
||||
UpdateListCountDisplay();
|
||||
|
||||
|
||||
// 清空点名历史记录
|
||||
lock (historyLock)
|
||||
{
|
||||
// 重置历史记录数据
|
||||
historyData = new RollCallHistoryData();
|
||||
|
||||
|
||||
// 保存到文件
|
||||
SaveRollCallHistory();
|
||||
}
|
||||
|
||||
|
||||
UpdateStatusDisplay("名单和历史记录已清空");
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -107,8 +107,7 @@ namespace Ink_Canvas
|
||||
if (settings.RandSettings.SelectedBackgroundIndex <= 0)
|
||||
{
|
||||
// 没有自定义背景时,使用主题背景色
|
||||
var backgroundBrush = Application.Current.FindResource("RandWindowBackground") as SolidColorBrush;
|
||||
if (backgroundBrush != null)
|
||||
if (Application.Current.FindResource("RandWindowBackground") is SolidColorBrush backgroundBrush)
|
||||
{
|
||||
MainBorder.Background = backgroundBrush;
|
||||
}
|
||||
@@ -238,7 +237,7 @@ namespace Ink_Canvas
|
||||
|
||||
int randomIndex = random.Next(0, animationPool.Count);
|
||||
int selectedNumber = animationPool[randomIndex];
|
||||
|
||||
|
||||
int lastIndex = animationPool.Count - 1;
|
||||
if (randomIndex != lastIndex)
|
||||
{
|
||||
@@ -273,7 +272,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
int randomIndex = random.Next(0, candidatePool.Count);
|
||||
int selectedNumber = candidatePool[randomIndex];
|
||||
|
||||
|
||||
int lastIndex = candidatePool.Count - 1;
|
||||
if (randomIndex != lastIndex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user