代码清理

This commit is contained in:
PrefacedCorg
2025-12-27 12:05:34 +08:00
parent d7e8330016
commit 783e5c43a5
9 changed files with 53 additions and 46 deletions
+2 -2
View File
@@ -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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@@ -73,7 +73,8 @@ namespace Ink_Canvas
/// <summary> /// <summary>
/// 用於更新浮動工具欄的"手勢"按鈕和白板工具欄的"手勢"按鈕的樣式(開啟和關閉狀態) /// 用於更新浮動工具欄的"手勢"按鈕和白板工具欄的"手勢"按鈕的樣式(開啟和關閉狀態)
/// </summary> /// </summary>
private void CheckEnableTwoFingerGestureBtnColorPrompt() { private void CheckEnableTwoFingerGestureBtnColorPrompt()
{
// 根据主题选择手势图标和颜色 // 根据主题选择手势图标和颜色
bool isDarkTheme = Settings.Appearance.Theme == 1 || bool isDarkTheme = Settings.Appearance.Theme == 1 ||
(Settings.Appearance.Theme == 2 && !IsSystemThemeLight()); (Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
@@ -82,13 +83,16 @@ namespace Ink_Canvas
// 根据主题设置白板模式下的颜色 // 根据主题设置白板模式下的颜色
Color boardBgColor, boardIconColor, boardTextColor, boardBorderColor; Color boardBgColor, boardIconColor, boardTextColor, boardBorderColor;
if (isLightTheme) { if (isLightTheme)
{
// 浅色主题 // 浅色主题
boardBgColor = Color.FromRgb(244, 244, 245); boardBgColor = Color.FromRgb(244, 244, 245);
boardIconColor = Color.FromRgb(24, 24, 27); boardIconColor = Color.FromRgb(24, 24, 27);
boardTextColor = Color.FromRgb(24, 24, 27); boardTextColor = Color.FromRgb(24, 24, 27);
boardBorderColor = Color.FromRgb(161, 161, 170); boardBorderColor = Color.FromRgb(161, 161, 170);
} else { }
else
{
// 深色主题 // 深色主题
boardBgColor = Color.FromRgb(39, 39, 42); boardBgColor = Color.FromRgb(39, 39, 42);
boardIconColor = Color.FromRgb(244, 244, 245); boardIconColor = Color.FromRgb(244, 244, 245);
@@ -96,7 +100,8 @@ namespace Ink_Canvas
boardBorderColor = Color.FromRgb(113, 113, 122); boardBorderColor = Color.FromRgb(113, 113, 122);
} }
if (ToggleSwitchEnableMultiTouchMode.IsOn) { if (ToggleSwitchEnableMultiTouchMode.IsOn)
{
TwoFingerGestureSimpleStackPanel.Opacity = 0.5; TwoFingerGestureSimpleStackPanel.Opacity = 0.5;
TwoFingerGestureSimpleStackPanel.IsHitTestVisible = false; TwoFingerGestureSimpleStackPanel.IsHitTestVisible = false;
EnableTwoFingerGestureBtn.Source = EnableTwoFingerGestureBtn.Source =
@@ -110,10 +115,12 @@ namespace Ink_Canvas
BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.DisabledGestureIcon); BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.DisabledGestureIcon);
BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z"); BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z");
} }
else { else
{
TwoFingerGestureSimpleStackPanel.Opacity = 1; TwoFingerGestureSimpleStackPanel.Opacity = 1;
TwoFingerGestureSimpleStackPanel.IsHitTestVisible = true; TwoFingerGestureSimpleStackPanel.IsHitTestVisible = true;
if (Settings.Gesture.IsEnableTwoFingerGesture) { if (Settings.Gesture.IsEnableTwoFingerGesture)
{
EnableTwoFingerGestureBtn.Source = EnableTwoFingerGestureBtn.Source =
new BitmapImage(new Uri("/Resources/new-icons/gesture-enabled.png", UriKind.Relative)); new BitmapImage(new Uri("/Resources/new-icons/gesture-enabled.png", UriKind.Relative));
@@ -123,9 +130,10 @@ namespace Ink_Canvas
BoardGestureLabel.Foreground = new SolidColorBrush(Colors.GhostWhite); BoardGestureLabel.Foreground = new SolidColorBrush(Colors.GhostWhite);
BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235)); BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(37, 99, 235));
BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.EnabledGestureIcon); 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 = EnableTwoFingerGestureBtn.Source =
new BitmapImage(new Uri(gestureIconPath, UriKind.Relative)); new BitmapImage(new Uri(gestureIconPath, UriKind.Relative));
+1 -1
View File
@@ -5,8 +5,8 @@ using OSVersionExtension;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Forms; using System.Windows.Forms;
+1 -2
View File
@@ -107,8 +107,7 @@ namespace Ink_Canvas
if (settings.RandSettings.SelectedBackgroundIndex <= 0) if (settings.RandSettings.SelectedBackgroundIndex <= 0)
{ {
// 没有自定义背景时,使用主题背景色 // 没有自定义背景时,使用主题背景色
var backgroundBrush = Application.Current.FindResource("RandWindowBackground") as SolidColorBrush; if (Application.Current.FindResource("RandWindowBackground") is SolidColorBrush backgroundBrush)
if (backgroundBrush != null)
{ {
MainBorder.Background = backgroundBrush; MainBorder.Background = backgroundBrush;
} }