Compare commits
71 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fc89dce7c2 | |||
| 62b85a4bbd | |||
| 927d85ea68 | |||
| 89ccf700c3 | |||
| b3c29f2e27 | |||
| 06af63a10a | |||
| 50742e5e4d | |||
| 570c701b93 | |||
| a1c4d53d7c | |||
| 3250b81a23 | |||
| fb914734c8 | |||
| be6eb73671 | |||
| 221a0f8e85 | |||
| d5e5ec8c46 | |||
| b10215aec9 | |||
| ea20f84d91 | |||
| 008e843b39 | |||
| 172dd4f81b | |||
| 4697fb4664 | |||
| c9e6ba972b | |||
| 758f414302 | |||
| 0fb5c04deb | |||
| 47885685fe | |||
| 8e87dddcd2 | |||
| 4649649cf3 | |||
| 68a74be279 | |||
| 483e0757b7 | |||
| 9abce33257 | |||
| 337d4d7288 | |||
| bde0680f81 | |||
| ec579288a8 | |||
| e2c222a156 | |||
| 23de7e3575 | |||
| 18a8f41bf3 | |||
| 63585911a7 | |||
| acafdcc991 | |||
| 9d14f16fe2 | |||
| 89eb93aa67 | |||
| fbfac18ca0 | |||
| 78b2f94bae | |||
| 89f0a401ef | |||
| 0776071454 | |||
| 56fb29fe15 | |||
| d7ed3884d6 | |||
| ba673ccf41 | |||
| 44c1071d49 | |||
| 7789240f64 | |||
| 7eee02dc94 | |||
| 965957aa1b | |||
| 65a3917f62 | |||
| 6ba4a57bbc | |||
| 4e13817509 | |||
| a8330fa2e9 | |||
| be0d444db9 | |||
| ecf3c1ad04 | |||
| 6bf439f493 | |||
| 94b52941af | |||
| a80fb33880 | |||
| 30e4c35165 | |||
| 9bd1214567 | |||
| c28a2bd792 | |||
| 45a7e586c7 | |||
| 5903bab81f | |||
| 295f8f56e3 | |||
| 4cc8af7ff0 | |||
| bca2dde497 | |||
| a8a72159f0 | |||
| 8ea7cb6ac2 | |||
| 2b721b111b | |||
| d7e080a579 | |||
| 6429c242e4 |
+4
-1
@@ -37,7 +37,10 @@
|
||||
"contributions": [
|
||||
"blog",
|
||||
"doc",
|
||||
"design"
|
||||
"design",
|
||||
"test",
|
||||
"tutorial",
|
||||
"video"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ on:
|
||||
branches: [ main, beta ]
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
branches: [ main ]
|
||||
branches: [ main, beta ]
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'docs/**'
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
permissions:
|
||||
pull-requests: write
|
||||
outputs:
|
||||
comment_id: ${{ steps.create-preview-comment.outputs.comment-id }}
|
||||
comment_id: ${{ steps.create-preview-comment.outputs.comment-id || '' }}
|
||||
steps:
|
||||
- name: Prepare Preview Comment
|
||||
id: prepare-preview
|
||||
@@ -111,7 +111,8 @@ jobs:
|
||||
|
||||
- name: Post/Update Preview Comment
|
||||
id: create-preview-comment
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
uses: peter-evans/create-or-update-comment@v5
|
||||
continue-on-error: true # 即使评论失败也继续执行
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-id: ${{ needs.find-or-create-pr-comment.outputs.comment_id }}
|
||||
@@ -293,7 +294,7 @@ jobs:
|
||||
|
||||
# 如果有构建产物,显示下载链接
|
||||
if [ "$BUILD_SUCCESS" = "true" ]; then
|
||||
NIGHTLY_LINK="https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/app-package.zip"
|
||||
NIGHTLY_LINK="https://hk.gh-proxy.com/https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/app-package.zip"
|
||||
echo ""
|
||||
echo "## 构建产物"
|
||||
if [ -n "$ARTIFACT_URL" ]; then
|
||||
@@ -339,8 +340,23 @@ jobs:
|
||||
|
||||
echo "最终评论内容已生成"
|
||||
|
||||
- name: Write Final Comment to GitHub Summary
|
||||
run: |
|
||||
echo "# 🚀 最终构建结果 (GitHub Actions Summary)" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "> ⚠️ 注意:由于权限限制,评论可能无法发布到 PR。这里是在 GitHub Actions 中的构建结果:" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
cat final_comment.txt >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "---" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**工作流信息:**" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- 事件类型: ${{ github.event_name }} (${{ github.event.action }})" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- 运行编号: #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- 运行 ID: ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: Update Final Comment
|
||||
uses: peter-evans/create-or-update-comment@v4
|
||||
uses: peter-evans/create-or-update-comment@v5
|
||||
continue-on-error: true # 即使评论失败也继续执行
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
comment-id: ${{ needs.pr-preview-comment.outputs.comment_id }}
|
||||
@@ -380,4 +396,4 @@ jobs:
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**直链下载 (nightly.link):**" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "[🌙 nightly.link 下载链接](https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/app-package.zip)" >> $GITHUB_STEP_SUMMARY
|
||||
echo "[🌙 nightly.link 下载链接](https://hk.gh-proxy.com/https://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}/app-package.zip)" >> $GITHUB_STEP_SUMMARY
|
||||
@@ -198,9 +198,7 @@ jobs:
|
||||
outputs:
|
||||
archive_name: ${{ steps.create_archive.outputs.archive_name }}
|
||||
zip_size: ${{ steps.calculate_size.outputs.zip_size }}
|
||||
zip_hash: ${{ steps.calculate_size.outputs.zip_hash }}
|
||||
installer_size: ${{ steps.calculate_installer_size.outputs.installer_size }}
|
||||
installer_hash: ${{ steps.calculate_installer_size.outputs.installer_hash }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -343,7 +341,7 @@ jobs:
|
||||
Write-Host "Setup file not found: $setupFile"
|
||||
}
|
||||
|
||||
- name: Calculate archive size and hash
|
||||
- name: Calculate archive size
|
||||
id: calculate_size
|
||||
run: |
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
@@ -352,16 +350,11 @@ jobs:
|
||||
# 获取文件大小(字节)
|
||||
$fileSize = (Get-Item $archiveName).Length
|
||||
|
||||
# 计算SHA256哈希
|
||||
$hash = (Get-FileHash $archiveName -Algorithm SHA256).Hash
|
||||
|
||||
echo "zip_size=$fileSize" >> $env:GITHUB_OUTPUT
|
||||
echo "zip_hash=$hash" >> $env:GITHUB_OUTPUT
|
||||
|
||||
echo "Archive size: $fileSize bytes"
|
||||
echo "SHA256 hash: $hash"
|
||||
|
||||
- name: Calculate installer size and hash
|
||||
- name: Calculate installer size
|
||||
id: calculate_installer_size
|
||||
run: |
|
||||
$version = "${{ needs.prepare.outputs.version }}"
|
||||
@@ -371,14 +364,9 @@ jobs:
|
||||
# 获取文件大小(字节)
|
||||
$fileSize = (Get-Item $installerName).Length
|
||||
|
||||
# 计算SHA256哈希
|
||||
$hash = (Get-FileHash $installerName -Algorithm SHA256).Hash
|
||||
|
||||
echo "installer_size=$fileSize" >> $env:GITHUB_OUTPUT
|
||||
echo "installer_hash=$hash" >> $env:GITHUB_OUTPUT
|
||||
|
||||
echo "Installer size: $fileSize bytes"
|
||||
echo "SHA256 hash: $hash"
|
||||
} else {
|
||||
echo "Installer file not found: $installerName"
|
||||
}
|
||||
@@ -395,12 +383,6 @@ jobs:
|
||||
needs: [prepare, build]
|
||||
if: success()
|
||||
runs-on: ubuntu-latest # 改为 Ubuntu 以使用 Python 签名工具
|
||||
outputs:
|
||||
signatures_created: ${{ steps.sign_artifacts.outputs.signatures_created }}
|
||||
zip_sigstore_file: "InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.zip.sigstore.json"
|
||||
installer_sigstore_file: "InkCanvasForClass.CE.${{ needs.prepare.outputs.version }}.Setup.exe.sigstore.json"
|
||||
zip_sigstore_hash: ${{ steps.calculate_zip_sig_hash.outputs.sigstore_hash }}
|
||||
installer_sigstore_hash: ${{ steps.calculate_installer_sig_hash.outputs.sigstore_hash }}
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write # 需要这个权限来验证签名
|
||||
@@ -416,7 +398,6 @@ jobs:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Sign release artifacts with sigstore-python
|
||||
id: sign_artifacts
|
||||
uses: sigstore/gh-action-sigstore-python@v3.2.0
|
||||
with:
|
||||
inputs: |
|
||||
@@ -427,53 +408,7 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Check generated signature files
|
||||
run: |
|
||||
version="${{ needs.prepare.outputs.version }}"
|
||||
echo "Checking for generated signature files..."
|
||||
ls -la *.sig* || true
|
||||
echo "Current directory contents:"
|
||||
pwd
|
||||
ls -la
|
||||
|
||||
- name: Calculate ZIP signature hash
|
||||
id: calculate_zip_sig_hash
|
||||
run: |
|
||||
version="${{ needs.prepare.outputs.version }}"
|
||||
sigstoreFile="InkCanvasForClass.CE.$version.zip.sigstore.json"
|
||||
|
||||
if [ -f "$sigstoreFile" ]; then
|
||||
# 计算SHA256哈希
|
||||
sigstoreHash=$(sha256sum "$sigstoreFile" | cut -d' ' -f1)
|
||||
|
||||
echo "sigstore_hash=$sigstoreHash" >> $GITHUB_OUTPUT
|
||||
echo "Sigstore JSON file hash: $sigstoreHash"
|
||||
echo "Sigstore file size: $(stat -c%s "$sigstoreFile") bytes"
|
||||
else
|
||||
echo "Warning: Sigstore file not found: $sigstoreFile"
|
||||
echo "sigstore_hash=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Calculate Installer signature hash
|
||||
id: calculate_installer_sig_hash
|
||||
run: |
|
||||
version="${{ needs.prepare.outputs.version }}"
|
||||
sigstoreFile="InkCanvasForClass.CE.$version.Setup.exe.sigstore.json"
|
||||
|
||||
if [ -f "$sigstoreFile" ]; then
|
||||
# 计算SHA256哈希
|
||||
sigstoreHash=$(sha256sum "$sigstoreFile" | cut -d' ' -f1)
|
||||
|
||||
echo "sigstore_hash=$sigstoreHash" >> $GITHUB_OUTPUT
|
||||
echo "Sigstore JSON file hash: $sigstoreHash"
|
||||
echo "Sigstore file size: $(stat -c%s "$sigstoreFile") bytes"
|
||||
else
|
||||
echo "Warning: Sigstore file not found: $sigstoreFile"
|
||||
echo "sigstore_hash=" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Upload Signed Artifacts
|
||||
if: steps.calculate_zip_sig_hash.outputs.sigstore_hash != '' || steps.calculate_installer_sig_hash.outputs.sigstore_hash != ''
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: signed-files-${{ needs.prepare.outputs.version }}
|
||||
@@ -500,7 +435,6 @@ jobs:
|
||||
name: signed-files-${{ needs.prepare.outputs.version }}
|
||||
continue-on-error: true
|
||||
|
||||
|
||||
- name: Create enhanced changelog with file table
|
||||
id: enhanced_changelog
|
||||
run: |
|
||||
@@ -511,38 +445,32 @@ jobs:
|
||||
|
||||
# 构建文件信息表格
|
||||
fileTable=$'\n## 文件信息 (File Information)\n'
|
||||
fileTable+=$'| 文件名 | 大小 | SHA256 哈希 |\n'
|
||||
fileTable+=$'|--------|------|-------------|\n'
|
||||
fileTable+=$'| 文件名 | 大小 |\n'
|
||||
fileTable+=$'|--------|------|\n'
|
||||
|
||||
# ZIP 文件信息
|
||||
fileTable+=$'| InkCanvasForClass.CE.'"$version"
|
||||
fileTable+=$'.zip | ${{ needs.build.outputs.zip_size }} bytes | ${{ needs.build.outputs.zip_hash }} |\n'
|
||||
fileTable+=$'.zip | ${{ needs.build.outputs.zip_size }} bytes |\n'
|
||||
|
||||
# 安装包文件信息
|
||||
installerSize="${{ needs.build.outputs.installer_size }}"
|
||||
installerHash="${{ needs.build.outputs.installer_hash }}"
|
||||
if [ -n "$installerSize" ] && [ -n "$installerHash" ]; then
|
||||
fileTable+=$'| InkCanvasForClass.CE.'"$version"'.Setup.exe | '"$installerSize"' bytes | '"$installerHash"
|
||||
fileTable+=$' |\n'
|
||||
if [ -n "$installerSize" ]; then
|
||||
fileTable+=$'| InkCanvasForClass.CE.'"$version"'.Setup.exe | '"$installerSize"' bytes |\n'
|
||||
fi
|
||||
|
||||
# 检查是否有签名文件
|
||||
if [ -f "InkCanvasForClass.CE.$version.zip.sigstore.json" ]; then
|
||||
sigstoreSize=$(stat -c%s "InkCanvasForClass.CE.$version.zip.sigstore.json")
|
||||
sigstoreHash=$(sha256sum "InkCanvasForClass.CE.$version.zip.sigstore.json" | cut -d' ' -f1)
|
||||
fileTable+=$'| InkCanvasForClass.CE.'"$version"'.zip.sigstore.json | '"$sigstoreSize"' bytes | '"$sigstoreHash"
|
||||
fileTable+=$' |\n'
|
||||
fileTable+=$'| InkCanvasForClass.CE.'"$version"'.zip.sigstore.json | '"$sigstoreSize"' bytes |\n'
|
||||
fi
|
||||
|
||||
# 检查安装程序签名文件
|
||||
if [ -f "InkCanvasForClass.CE.$version.Setup.exe.sigstore.json" ]; then
|
||||
sigstoreSize=$(stat -c%s "InkCanvasForClass.CE.$version.Setup.exe.sigstore.json")
|
||||
sigstoreHash=$(sha256sum "InkCanvasForClass.CE.$version.Setup.exe.sigstore.json" | cut -d' ' -f1)
|
||||
fileTable+=$'| InkCanvasForClass.CE.'"$version"'.Setup.exe.sigstore.json | '"$sigstoreSize"' bytes | '"$sigstoreHash"
|
||||
fileTable+=$' |\n'
|
||||
fileTable+=$'| InkCanvasForClass.CE.'"$version"'.Setup.exe.sigstore.json | '"$sigstoreSize"' bytes |\n'
|
||||
fi
|
||||
|
||||
fileTable+=$'\n*文件哈希和大小信息由GitHub Actions自动生成*\n'
|
||||
fileTable+=$'\n*文件大小信息由GitHub Actions自动生成*\n'
|
||||
|
||||
# 将表格附加到原始changelog
|
||||
enhancedChangelog="${originalChangelog}${fileTable}"
|
||||
|
||||
+177
-40
@@ -445,16 +445,41 @@ namespace Ink_Canvas
|
||||
try
|
||||
{
|
||||
LogHelper.WriteLogToFile("开始创建启动画面...");
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
_splashScreen = new SplashScreen();
|
||||
LogHelper.WriteLogToFile("启动画面对象创建成功,准备显示...");
|
||||
_splashScreen.Show();
|
||||
_isSplashScreenShown = true;
|
||||
LogHelper.WriteLogToFile("启动画面已显示");
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
if (Current?.Dispatcher != null && !Current.Dispatcher.HasShutdownStarted)
|
||||
{
|
||||
Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
_splashScreen.Show();
|
||||
_isSplashScreenShown = true;
|
||||
|
||||
Current.Dispatcher.Invoke(() => { }, DispatcherPriority.Render);
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
LogHelper.WriteLogToFile("启动画面已显示");
|
||||
}, DispatcherPriority.Normal);
|
||||
}
|
||||
else
|
||||
{
|
||||
_splashScreen.Show();
|
||||
_isSplashScreenShown = true;
|
||||
UpdateHeartbeatOnUIThread();
|
||||
LogHelper.WriteLogToFile("启动画面已显示");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"显示启动画面失败: {ex.Message}", LogHelper.LogType.Error);
|
||||
LogHelper.WriteLogToFile($"异常堆栈: {ex.StackTrace}", LogHelper.LogType.Error);
|
||||
UpdateHeartbeatOnUIThread();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,26 +666,35 @@ namespace Ink_Canvas
|
||||
|
||||
async void App_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
// 初始化应用启动时间
|
||||
appStartTime = DateTime.Now;
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
// 根据设置决定是否显示启动画面
|
||||
if (ShouldShowSplashScreen())
|
||||
{
|
||||
ShowSplashScreen();
|
||||
SetSplashMessage("正在启动 Ink Canvas...");
|
||||
SetSplashProgress(20);
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
await Task.Delay(500);
|
||||
|
||||
// 强制刷新UI,确保启动画面显示
|
||||
Application.Current.Dispatcher.Invoke(() => { }, DispatcherPriority.Render);
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
UpdateHeartbeatOnUIThread();
|
||||
}, DispatcherPriority.Render);
|
||||
}
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
System.Threading.Thread.Sleep(500);
|
||||
RootPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
|
||||
|
||||
LogHelper.NewLog(string.Format("Ink Canvas Starting (Version: {0})", Assembly.GetExecutingAssembly().GetName().Version));
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
// 检查是否为最终应用启动(更新后的应用)
|
||||
bool isFinalApp = e.Args.Contains("--final-app");
|
||||
bool skipMutexCheck = e.Args.Contains("--skip-mutex-check");
|
||||
@@ -687,49 +721,61 @@ namespace Ink_Canvas
|
||||
LogHelper.WriteLogToFile("App | 检测到最终应用启动(更新后的应用)");
|
||||
}
|
||||
|
||||
// 释放IACore相关DLL
|
||||
if (_isSplashScreenShown)
|
||||
{
|
||||
SetSplashMessage("正在初始化组件...");
|
||||
SetSplashProgress(40);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
try
|
||||
{
|
||||
IACoreDllExtractor.ExtractIACoreDlls();
|
||||
UpdateHeartbeatOnUIThread();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"释放IACore DLL时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
UpdateHeartbeatOnUIThread();
|
||||
}
|
||||
|
||||
// 释放UIAccess DLL
|
||||
if (_isSplashScreenShown)
|
||||
{
|
||||
SetSplashMessage("正在初始化组件...");
|
||||
SetSplashProgress(50);
|
||||
await Task.Delay(300);
|
||||
}
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
try
|
||||
{
|
||||
UIAccessDllExtractor.ExtractUIAccessDlls();
|
||||
UpdateHeartbeatOnUIThread();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"释放UIAccess DLL时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
UpdateHeartbeatOnUIThread();
|
||||
}
|
||||
|
||||
// 记录应用启动(设备标识符)
|
||||
if (_isSplashScreenShown)
|
||||
{
|
||||
SetSplashMessage("正在加载配置...");
|
||||
SetSplashProgress(60);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
DeviceIdentifier.RecordAppLaunch();
|
||||
LogHelper.WriteLogToFile($"App | 设备ID: {DeviceIdentifier.GetDeviceId()}");
|
||||
LogHelper.WriteLogToFile($"App | 使用频率: {DeviceIdentifier.GetUsageFrequency()}");
|
||||
LogHelper.WriteLogToFile($"App | 更新优先级: {DeviceIdentifier.GetUpdatePriority()}");
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
// 处理更新模式启动
|
||||
bool isUpdateMode = AutoUpdateHelper.HandleUpdateModeStartup(e.Args);
|
||||
@@ -981,19 +1027,27 @@ namespace Ink_Canvas
|
||||
|
||||
StartArgs = e.Args;
|
||||
|
||||
// 在非更新模式下创建主窗口
|
||||
if (_isSplashScreenShown)
|
||||
{
|
||||
SetSplashMessage("正在初始化主界面...");
|
||||
SetSplashProgress(80);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
var mainWindow = new MainWindow();
|
||||
MainWindow = mainWindow;
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
// 主窗口加载完成后关闭启动画面
|
||||
mainWindow.Loaded += (s, args) =>
|
||||
{
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
isStartupPhase = false;
|
||||
LogHelper.WriteLogToFile("心跳监控 | 主窗口加载完成,启动阶段结束");
|
||||
|
||||
if (_isSplashScreenShown)
|
||||
{
|
||||
SetSplashMessage("完成初始化...");
|
||||
@@ -1004,10 +1058,15 @@ namespace Ink_Canvas
|
||||
{
|
||||
SetSplashMessage("启动完成!");
|
||||
SetSplashProgress(100);
|
||||
// 延迟关闭启动画面,让用户看到完成消息
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
Task.Delay(500).ContinueWith(__ =>
|
||||
{
|
||||
Dispatcher.Invoke(() => CloseSplashScreen());
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
CloseSplashScreen();
|
||||
UpdateHeartbeatOnUIThread();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1015,30 +1074,37 @@ namespace Ink_Canvas
|
||||
};
|
||||
|
||||
mainWindow.Show();
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
|
||||
// 注册.icstk文件关联
|
||||
try
|
||||
{
|
||||
LogHelper.WriteLogToFile("开始注册.icstk文件关联");
|
||||
FileAssociationManager.RegisterFileAssociation();
|
||||
FileAssociationManager.ShowFileAssociationStatus();
|
||||
UpdateHeartbeatOnUIThread();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"注册文件关联时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
UpdateHeartbeatOnUIThread();
|
||||
}
|
||||
|
||||
// 启动IPC监听器
|
||||
try
|
||||
{
|
||||
LogHelper.WriteLogToFile("启动IPC监听器");
|
||||
FileAssociationManager.StartIpcListener();
|
||||
UpdateHeartbeatOnUIThread();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"启动IPC监听器时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
UpdateHeartbeatOnUIThread();
|
||||
}
|
||||
|
||||
UpdateHeartbeatOnUIThread();
|
||||
LogHelper.WriteLogToFile("心跳监控 | 应用启动流程完成");
|
||||
|
||||
}
|
||||
|
||||
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
@@ -1066,40 +1132,107 @@ namespace Ink_Canvas
|
||||
NoAction
|
||||
}
|
||||
|
||||
// 心跳相关
|
||||
private static Timer heartbeatTimer;
|
||||
private static DateTime lastHeartbeat = DateTime.Now;
|
||||
private static Timer watchdogTimer;
|
||||
private static DispatcherTimer uiHeartbeatTimer;
|
||||
private static bool isStartupPhase = true;
|
||||
private static DateTime startupStartTime = DateTime.Now;
|
||||
|
||||
public static void UpdateHeartbeatOnUIThread()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Current?.Dispatcher != null && !Current.Dispatcher.HasShutdownStarted)
|
||||
{
|
||||
Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
lastHeartbeat = DateTime.Now;
|
||||
Current.Dispatcher.Invoke(() => { }, DispatcherPriority.Background);
|
||||
}, DispatcherPriority.Normal);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastHeartbeat = DateTime.Now;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
lastHeartbeat = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
private void StartHeartbeatMonitor()
|
||||
{
|
||||
// 主线程定时更新心跳
|
||||
heartbeatTimer = new Timer(_ => lastHeartbeat = DateTime.Now, null, 0, 1000);
|
||||
// 辅助线程检测心跳超时
|
||||
startupStartTime = DateTime.Now;
|
||||
|
||||
heartbeatTimer = new Timer(_ =>
|
||||
{
|
||||
if ((DateTime.Now - lastHeartbeat).TotalSeconds > 2)
|
||||
{
|
||||
lastHeartbeat = DateTime.Now;
|
||||
}
|
||||
}, null, 0, 1000);
|
||||
|
||||
if (Current?.Dispatcher != null)
|
||||
{
|
||||
uiHeartbeatTimer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(500)
|
||||
};
|
||||
uiHeartbeatTimer.Tick += (s, e) =>
|
||||
{
|
||||
lastHeartbeat = DateTime.Now;
|
||||
Current.Dispatcher.Invoke(() => { }, DispatcherPriority.Background);
|
||||
};
|
||||
uiHeartbeatTimer.Start();
|
||||
}
|
||||
|
||||
watchdogTimer = new Timer(_ =>
|
||||
{
|
||||
if ((DateTime.Now - lastHeartbeat).TotalSeconds > 10)
|
||||
try
|
||||
{
|
||||
LogHelper.NewLog("检测到主线程无响应,自动重启。");
|
||||
SyncCrashActionFromSettings(); // 新增:心跳检测时同步最新设置
|
||||
if (CrashAction == CrashActionType.SilentRestart)
|
||||
double timeSinceLastHeartbeat = (DateTime.Now - lastHeartbeat).TotalSeconds;
|
||||
double timeSinceStartup = (DateTime.Now - startupStartTime).TotalSeconds;
|
||||
|
||||
double timeoutThreshold = isStartupPhase ? 30.0 : 10.0;
|
||||
|
||||
if (isStartupPhase && timeSinceStartup > 60)
|
||||
{
|
||||
StartupCount.Increment();
|
||||
if (StartupCount.GetCount() >= 5)
|
||||
isStartupPhase = false;
|
||||
LogHelper.WriteLogToFile("心跳监控 | 启动阶段结束,切换到正常运行模式");
|
||||
}
|
||||
|
||||
if (timeSinceLastHeartbeat > timeoutThreshold)
|
||||
{
|
||||
string phase = isStartupPhase ? "启动阶段" : "运行阶段";
|
||||
LogHelper.WriteLogToFile($"心跳监控 | 检测到主线程无响应({phase},超时{timeoutThreshold}秒),准备自动重启。");
|
||||
LogHelper.WriteLogToFile($"心跳监控 | 距离上次心跳: {timeSinceLastHeartbeat:F1}秒,距离启动: {timeSinceStartup:F1}秒");
|
||||
|
||||
SyncCrashActionFromSettings();
|
||||
if (CrashAction == CrashActionType.SilentRestart)
|
||||
{
|
||||
MessageBox.Show("检测到程序已连续重启5次,已停止自动重启。请联系开发者或检查系统环境。", "重启次数过多", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
StartupCount.Reset();
|
||||
StartupCount.Increment();
|
||||
if (StartupCount.GetCount() >= 5)
|
||||
{
|
||||
MessageBox.Show("检测到程序已连续重启5次,已停止自动重启。请联系开发者或检查系统环境。", "重启次数过多", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
StartupCount.Reset();
|
||||
Environment.Exit(1);
|
||||
}
|
||||
try
|
||||
{
|
||||
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||
Process.Start(exePath);
|
||||
}
|
||||
catch { }
|
||||
Environment.Exit(1);
|
||||
}
|
||||
try
|
||||
{
|
||||
string exePath = Process.GetCurrentProcess().MainModule.FileName;
|
||||
Process.Start(exePath);
|
||||
}
|
||||
catch { }
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"心跳监控 | 检测过程出错: {ex.Message}", LogHelper.LogType.Warning);
|
||||
}
|
||||
}, null, 0, 3000);
|
||||
}
|
||||
|
||||
@@ -1170,14 +1303,20 @@ namespace Ink_Canvas
|
||||
|
||||
private void App_Exit(object sender, ExitEventArgs e)
|
||||
{
|
||||
// 仅在软件内主动退出时关闭看门狗,并写入退出信号
|
||||
try
|
||||
{
|
||||
// 记录应用退出状态
|
||||
heartbeatTimer?.Dispose();
|
||||
watchdogTimer?.Dispose();
|
||||
uiHeartbeatTimer?.Stop();
|
||||
uiHeartbeatTimer = null;
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
string exitType = IsAppExitByUser ? "用户主动退出" : "应用程序退出";
|
||||
WriteCrashLog($"{exitType},退出代码: {e.ApplicationExitCode}");
|
||||
|
||||
// 记录应用退出(设备标识符)
|
||||
try
|
||||
{
|
||||
DeviceIdentifier.RecordAppExit();
|
||||
@@ -1190,7 +1329,6 @@ namespace Ink_Canvas
|
||||
|
||||
if (IsAppExitByUser)
|
||||
{
|
||||
// 写入退出信号文件,通知看门狗正常退出
|
||||
StartupCount.Reset();
|
||||
File.WriteAllText(watchdogExitSignalFile, "exit");
|
||||
if (watchdogProcess != null && !watchdogProcess.HasExited)
|
||||
@@ -1201,7 +1339,6 @@ namespace Ink_Canvas
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 尝试记录最后的错误
|
||||
try
|
||||
{
|
||||
LogHelper.WriteLogToFile($"退出处理时发生错误: {ex.Message}", LogHelper.LogType.Error);
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Windows;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("CJK_mkp")]
|
||||
[assembly: AssemblyProduct("InkCanvasForClass")]
|
||||
[assembly: AssemblyCopyright("Copyright © CJK_mkp 2025")]
|
||||
[assembly: AssemblyCopyright("Copyright © CJK_mkp 2025-2026")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -49,5 +49,5 @@ using System.Windows;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.7.18.3")]
|
||||
[assembly: AssemblyFileVersion("1.7.18.3")]
|
||||
[assembly: AssemblyVersion("1.7.18.4")]
|
||||
[assembly: AssemblyFileVersion("1.7.18.4")]
|
||||
|
||||
@@ -1092,15 +1092,13 @@ namespace Ink_Canvas.Helpers
|
||||
int versionDiff = CalculateVersionGenerationDifference(localVersion, updateVersion);
|
||||
LogHelper.WriteLogToFile($"DeviceIdentifier | 无法获取版本发布时间,使用版本号差异判断 - 本地版本: {localVersion}, 远程版本: {updateVersion}, 代数差异: {versionDiff}");
|
||||
|
||||
// 当版本号代数差异大于3时自动更新
|
||||
if (versionDiff > 3)
|
||||
if (versionDiff >= 1)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"DeviceIdentifier | 版本号代数差异({versionDiff})大于3,自动更新");
|
||||
return true;
|
||||
LogHelper.WriteLogToFile($"DeviceIdentifier | 版本号代数差异({versionDiff})>=1,允许更新");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.WriteLogToFile($"DeviceIdentifier | 版本号代数差异({versionDiff})不大于3,暂不更新");
|
||||
LogHelper.WriteLogToFile($"DeviceIdentifier | 版本号代数差异({versionDiff})<1,可能是相同版本或降级,暂不更新");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Ink_Canvas.Helpers
|
||||
|
||||
// 验证文件格式和大小
|
||||
var fileExtension = Path.GetExtension(item.FilePath).ToLower();
|
||||
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".zip")
|
||||
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".xml" && fileExtension != ".zip")
|
||||
{
|
||||
skippedCount++;
|
||||
continue;
|
||||
@@ -314,9 +314,9 @@ namespace Ink_Canvas.Helpers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步上传笔记文件到Dlass(支持PNG、ICSTK和ZIP格式)
|
||||
/// 异步上传笔记文件到Dlass(支持PNG、ICSTK、XML和ZIP格式)
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件路径(支持PNG、ICSTK和ZIP)</param>
|
||||
/// <param name="filePath">文件路径(支持PNG、ICSTK、XML和ZIP)</param>
|
||||
/// <returns>是否成功加入队列(不等待实际上传完成)</returns>
|
||||
public static async Task<bool> UploadNoteFileAsync(string filePath)
|
||||
{
|
||||
@@ -336,7 +336,7 @@ namespace Ink_Canvas.Helpers
|
||||
}
|
||||
|
||||
var fileExtension = Path.GetExtension(filePath).ToLower();
|
||||
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".zip")
|
||||
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".xml" && fileExtension != ".zip")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -594,7 +594,7 @@ namespace Ink_Canvas.Helpers
|
||||
|
||||
// 检查文件扩展名
|
||||
var fileExtension = Path.GetExtension(filePath).ToLower();
|
||||
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".zip")
|
||||
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".xml" && fileExtension != ".zip")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -676,6 +676,11 @@ namespace Ink_Canvas.Helpers
|
||||
fileType = "墨迹文件";
|
||||
tags = "自动上传,墨迹,icstk";
|
||||
}
|
||||
else if (fileExtension == ".xml")
|
||||
{
|
||||
fileType = "XML文件";
|
||||
tags = "自动上传,xml";
|
||||
}
|
||||
else
|
||||
{
|
||||
fileType = "笔记";
|
||||
@@ -728,7 +733,7 @@ namespace Ink_Canvas.Helpers
|
||||
|
||||
// 检查文件扩展名
|
||||
var fileExtension = Path.GetExtension(filePath).ToLower();
|
||||
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".zip")
|
||||
if (fileExtension != ".png" && fileExtension != ".icstk" && fileExtension != ".xml" && fileExtension != ".zip")
|
||||
{
|
||||
return false; // 文件格式错误,不可重试
|
||||
}
|
||||
|
||||
+509
-197
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,460 @@
|
||||
using Microsoft.Office.Interop.PowerPoint;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace Ink_Canvas.Helpers
|
||||
{
|
||||
public static class PPTROTConnectionHelper
|
||||
{
|
||||
#region Win32 API Declarations
|
||||
[DllImport("ole32.dll")]
|
||||
private static extern int GetRunningObjectTable(int reserved, out IRunningObjectTable prot);
|
||||
|
||||
[DllImport("ole32.dll")]
|
||||
private static extern int CreateBindCtx(int reserved, out IBindCtx ppbc);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr GetForegroundWindow();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static extern bool IsWindowVisible(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct RECT
|
||||
{
|
||||
public int Left;
|
||||
public int Top;
|
||||
public int Right;
|
||||
public int Bottom;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constants
|
||||
private static readonly Guid PowerPointApplicationGuid = new Guid("91493441-5A91-11CF-8700-00AA0060263B");
|
||||
|
||||
private static readonly string[] PptLikeExtensions = new[]
|
||||
{
|
||||
".pptx", ".pptm", ".ppt",
|
||||
".ppsx", ".ppsm", ".pps",
|
||||
".potx", ".potm", ".pot",
|
||||
".dps", ".dpt"
|
||||
};
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public static Microsoft.Office.Interop.PowerPoint.Application TryConnectViaROT(bool isSupportWPS = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
object bestApp = GetAnyActivePowerPoint(null, out int bestPriority, out _, isSupportWPS);
|
||||
|
||||
if (bestApp != null && bestPriority > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Microsoft.Office.Interop.PowerPoint.Application pptApp = bestApp as Microsoft.Office.Interop.PowerPoint.Application;
|
||||
|
||||
if (pptApp != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var nameObj = pptApp.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, pptApp, null);
|
||||
SafeReleaseComObject(nameObj);
|
||||
return pptApp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"ROT 连接验证失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||
SafeReleaseComObject(bestApp);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeReleaseComObject(bestApp);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"ROT 连接验证失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||
SafeReleaseComObject(bestApp);
|
||||
}
|
||||
}
|
||||
else if (bestApp != null)
|
||||
{
|
||||
SafeReleaseComObject(bestApp);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"ROT 连接过程发生异常: {ex}", LogHelper.LogType.Error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private static object GetAnyActivePowerPoint(object targetApp, out int bestPriority, out int targetPriority, bool isSupportWPS)
|
||||
{
|
||||
IRunningObjectTable rot = null;
|
||||
IEnumMoniker enumMoniker = null;
|
||||
|
||||
object bestApp = null;
|
||||
bestPriority = 0;
|
||||
targetPriority = 0;
|
||||
int highestPriority = 0;
|
||||
|
||||
List<object> foundAppObjects = new List<object>();
|
||||
|
||||
try
|
||||
{
|
||||
int hr = GetRunningObjectTable(0, out rot);
|
||||
if (hr != 0 || rot == null)
|
||||
{
|
||||
LogHelper.WriteLogToFile("无法获取 Running Object Table", LogHelper.LogType.Warning);
|
||||
return null;
|
||||
}
|
||||
|
||||
rot.EnumRunning(out enumMoniker);
|
||||
if (enumMoniker == null)
|
||||
{
|
||||
LogHelper.WriteLogToFile("无法枚举 ROT 中的对象", LogHelper.LogType.Warning);
|
||||
return null;
|
||||
}
|
||||
|
||||
IMoniker[] moniker = new IMoniker[1];
|
||||
IntPtr fetched = IntPtr.Zero;
|
||||
|
||||
while (enumMoniker.Next(1, moniker, fetched) == 0)
|
||||
{
|
||||
IBindCtx bindCtx = null;
|
||||
object comObject = null;
|
||||
dynamic candidateApp = null;
|
||||
string displayName = "Unknown";
|
||||
dynamic activePres = null;
|
||||
dynamic ssWindow = null;
|
||||
bool keepAlive = false;
|
||||
|
||||
try
|
||||
{
|
||||
CreateBindCtx(0, out bindCtx);
|
||||
moniker[0].GetDisplayName(bindCtx, null, out displayName);
|
||||
|
||||
if (LooksLikePresentationFile(displayName) || displayName == "!{91493441-5A91-11CF-8700-00AA0060263B}")
|
||||
{
|
||||
rot.GetObject(moniker[0], out comObject);
|
||||
if (comObject != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
object appObj = comObject.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, comObject, null);
|
||||
candidateApp = appObj;
|
||||
}
|
||||
catch
|
||||
{
|
||||
candidateApp = comObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool isDuplicate = false;
|
||||
if (candidateApp != null)
|
||||
{
|
||||
foreach (var processedApp in foundAppObjects)
|
||||
{
|
||||
if (AreComObjectsEqual((object)candidateApp, processedApp))
|
||||
{
|
||||
isDuplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isDuplicate)
|
||||
{
|
||||
foundAppObjects.Add(candidateApp);
|
||||
keepAlive = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (candidateApp != null && !isDuplicate)
|
||||
{
|
||||
int currentPriority = 0;
|
||||
bool isTarget = false;
|
||||
|
||||
if (targetApp != null && AreComObjectsEqual((object)candidateApp, targetApp))
|
||||
{
|
||||
isTarget = true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
activePres = candidateApp.ActivePresentation;
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (activePres != null)
|
||||
{
|
||||
currentPriority = 1;
|
||||
|
||||
try
|
||||
{
|
||||
ssWindow = activePres.SlideShowWindow;
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (ssWindow != null)
|
||||
{
|
||||
currentPriority = 2;
|
||||
|
||||
try
|
||||
{
|
||||
bool isActive = false;
|
||||
try
|
||||
{
|
||||
object val = ssWindow.Active;
|
||||
if (val is int && (int)val == -1) isActive = true;
|
||||
else if (val is bool && (bool)val == true) isActive = true;
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (isActive)
|
||||
{
|
||||
currentPriority = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsSlideShowWindowActive(ssWindow, isSupportWPS))
|
||||
{
|
||||
currentPriority = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"计算优先级时出错: {ex.Message}", LogHelper.LogType.Warning);
|
||||
}
|
||||
|
||||
if (isTarget)
|
||||
{
|
||||
targetPriority = currentPriority;
|
||||
}
|
||||
|
||||
if (currentPriority > 0)
|
||||
{
|
||||
if (currentPriority > highestPriority)
|
||||
{
|
||||
highestPriority = currentPriority;
|
||||
SafeReleaseComObject(bestApp);
|
||||
bestApp = candidateApp;
|
||||
candidateApp = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"ROT 枚举循环中出错: {ex.Message}", LogHelper.LogType.Warning);
|
||||
}
|
||||
finally
|
||||
{
|
||||
SafeReleaseComObject(ssWindow);
|
||||
SafeReleaseComObject(activePres);
|
||||
|
||||
if (!keepAlive)
|
||||
{
|
||||
SafeReleaseComObject(candidateApp);
|
||||
}
|
||||
|
||||
CleanUpLoopObjects(bindCtx, moniker[0], comObject);
|
||||
}
|
||||
}
|
||||
|
||||
bestPriority = highestPriority;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"ROT 扫描关键错误: {ex}", LogHelper.LogType.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (foundAppObjects != null)
|
||||
{
|
||||
foreach (var cachedApp in foundAppObjects)
|
||||
{
|
||||
if (bestApp != null && ReferenceEquals(cachedApp, bestApp))
|
||||
continue;
|
||||
|
||||
SafeReleaseComObject(cachedApp);
|
||||
}
|
||||
foundAppObjects.Clear();
|
||||
}
|
||||
|
||||
if (enumMoniker != null) Marshal.ReleaseComObject(enumMoniker);
|
||||
if (rot != null) Marshal.ReleaseComObject(rot);
|
||||
}
|
||||
|
||||
return bestApp;
|
||||
}
|
||||
|
||||
private static bool AreComObjectsEqual(object o1, object o2)
|
||||
{
|
||||
if (o1 == null || o2 == null) return false;
|
||||
if (ReferenceEquals(o1, o2)) return true;
|
||||
|
||||
IntPtr pUnk1 = IntPtr.Zero;
|
||||
IntPtr pUnk2 = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
pUnk1 = Marshal.GetIUnknownForObject(o1);
|
||||
pUnk2 = Marshal.GetIUnknownForObject(o2);
|
||||
return pUnk1 == pUnk2;
|
||||
}
|
||||
catch { return false; }
|
||||
finally
|
||||
{
|
||||
if (pUnk1 != IntPtr.Zero) Marshal.Release(pUnk1);
|
||||
if (pUnk2 != IntPtr.Zero) Marshal.Release(pUnk2);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool LooksLikePresentationFile(string displayName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(displayName))
|
||||
return false;
|
||||
|
||||
string lower = displayName.ToLowerInvariant();
|
||||
foreach (var ext in PptLikeExtensions)
|
||||
{
|
||||
if (lower.Contains(ext))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsSlideShowWindowActive(object sswObj, bool isSupportWPS)
|
||||
{
|
||||
try
|
||||
{
|
||||
IntPtr foregroundHwnd = GetForegroundWindow();
|
||||
if (foregroundHwnd == IntPtr.Zero) return false;
|
||||
|
||||
uint fgPid;
|
||||
GetWindowThreadProcessId(foregroundHwnd, out fgPid);
|
||||
|
||||
IntPtr sswHwnd = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
sswHwnd = GetPptHwndFromSlideShowWindow(sswObj);
|
||||
}
|
||||
catch { return false; }
|
||||
|
||||
if (sswHwnd == IntPtr.Zero) return false;
|
||||
|
||||
uint sswPid;
|
||||
GetWindowThreadProcessId(sswHwnd, out sswPid);
|
||||
|
||||
if (fgPid == sswPid) return true;
|
||||
if (isSupportWPS)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (Process fgProc = Process.GetProcessById((int)fgPid))
|
||||
using (Process appProc = Process.GetProcessById((int)sswPid))
|
||||
{
|
||||
string fgName = fgProc.ProcessName.ToLower();
|
||||
string appName = appProc.ProcessName.ToLower();
|
||||
|
||||
if (fgName.StartsWith("wps") && appName.StartsWith("wpp"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPtr GetPptHwndFromSlideShowWindow(object pptSlideShowWindowObj)
|
||||
{
|
||||
if (pptSlideShowWindowObj == null) return IntPtr.Zero;
|
||||
|
||||
try
|
||||
{
|
||||
dynamic ssw = pptSlideShowWindowObj;
|
||||
object hwndObj = ssw.HWND;
|
||||
|
||||
if (hwndObj is int)
|
||||
{
|
||||
return new IntPtr((int)hwndObj);
|
||||
}
|
||||
else if (hwndObj is IntPtr)
|
||||
{
|
||||
return (IntPtr)hwndObj;
|
||||
}
|
||||
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
private static void SafeReleaseComObject(object comObj)
|
||||
{
|
||||
if (comObj == null) return;
|
||||
|
||||
if (Marshal.IsComObject(comObj))
|
||||
{
|
||||
try
|
||||
{
|
||||
Marshal.ReleaseComObject(comObj);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
private static void CleanUpLoopObjects(IBindCtx bindCtx, IMoniker moniker, object comObject)
|
||||
{
|
||||
if (comObject != null && Marshal.IsComObject(comObject))
|
||||
Marshal.ReleaseComObject(comObject);
|
||||
if (moniker != null)
|
||||
Marshal.ReleaseComObject(moniker);
|
||||
if (bindCtx != null)
|
||||
Marshal.ReleaseComObject(bindCtx);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ namespace Ink_Canvas.Helpers
|
||||
UpdateNavigationPanelsVisibility();
|
||||
UpdateNavigationButtonStyles();
|
||||
_mainWindow.UpdatePPTTimeCapsuleVisibility();
|
||||
_mainWindow.UpdatePPTQuickPanelVisibility();
|
||||
if (MainWindow.Settings.Advanced.IsEnableAvoidFullScreenHelper)
|
||||
{
|
||||
// 设置为画板模式,允许全屏操作
|
||||
@@ -122,6 +123,7 @@ namespace Ink_Canvas.Helpers
|
||||
_mainWindow.BtnPPTSlideShowEnd.Visibility = Visibility.Collapsed;
|
||||
HideAllNavigationPanels();
|
||||
_mainWindow.UpdatePPTTimeCapsuleVisibility();
|
||||
_mainWindow.UpdatePPTQuickPanelVisibility();
|
||||
if (MainWindow.Settings.Advanced.IsEnableAvoidFullScreenHelper)
|
||||
{
|
||||
// 恢复为非画板模式,重新启用全屏限制
|
||||
|
||||
@@ -136,7 +136,25 @@ namespace Ink_Canvas.Helpers
|
||||
private List<WindowInfo> _windows = new List<WindowInfo>();
|
||||
private Timer _updateTimer;
|
||||
private bool _isDisposed = false;
|
||||
private readonly int _updateInterval = 200; // 更新间隔(毫秒)
|
||||
private readonly int _updateInterval = 1000; // 更新间隔(毫秒)
|
||||
|
||||
private readonly Dictionary<uint, ProcessCacheInfo> _processCache = new Dictionary<uint, ProcessCacheInfo>();
|
||||
private readonly object _processCacheLock = new object();
|
||||
private DateTime _lastProcessCacheCleanup = DateTime.Now;
|
||||
private const int PROCESS_CACHE_CLEANUP_INTERVAL_MS = 30000;
|
||||
|
||||
// 窗口缓存,用于增量更新
|
||||
private readonly Dictionary<IntPtr, WindowInfo> _windowCache = new Dictionary<IntPtr, WindowInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 进程缓存信息
|
||||
/// </summary>
|
||||
private class ProcessCacheInfo
|
||||
{
|
||||
public string ProcessName { get; set; }
|
||||
public string ProcessPath { get; set; }
|
||||
public DateTime LastAccessTime { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 窗口列表更新事件
|
||||
@@ -186,6 +204,91 @@ namespace Ink_Canvas.Helpers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取进程信息
|
||||
/// </summary>
|
||||
private (string processName, string processPath) GetProcessInfo(uint processId)
|
||||
{
|
||||
lock (_processCacheLock)
|
||||
{
|
||||
// 定期清理缓存
|
||||
var now = DateTime.Now;
|
||||
if ((now - _lastProcessCacheCleanup).TotalMilliseconds > PROCESS_CACHE_CLEANUP_INTERVAL_MS)
|
||||
{
|
||||
var keysToRemove = _processCache
|
||||
.Where(kvp => (now - kvp.Value.LastAccessTime).TotalMilliseconds > PROCESS_CACHE_CLEANUP_INTERVAL_MS)
|
||||
.Select(kvp => kvp.Key)
|
||||
.ToList();
|
||||
|
||||
foreach (var key in keysToRemove)
|
||||
{
|
||||
_processCache.Remove(key);
|
||||
}
|
||||
|
||||
_lastProcessCacheCleanup = now;
|
||||
}
|
||||
|
||||
// 检查缓存
|
||||
if (_processCache.TryGetValue(processId, out var cachedInfo))
|
||||
{
|
||||
cachedInfo.LastAccessTime = now;
|
||||
return (cachedInfo.ProcessName, cachedInfo.ProcessPath);
|
||||
}
|
||||
|
||||
// 缓存未命中,获取进程信息
|
||||
string processName = "Unknown";
|
||||
string processPath = "Unknown";
|
||||
|
||||
try
|
||||
{
|
||||
Process process = Process.GetProcessById((int)processId);
|
||||
processName = process.ProcessName;
|
||||
try
|
||||
{
|
||||
processPath = process.MainModule?.FileName ?? "Unknown";
|
||||
}
|
||||
catch
|
||||
{
|
||||
processPath = "Unknown";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 进程可能已退出
|
||||
}
|
||||
|
||||
// 添加到缓存
|
||||
_processCache[processId] = new ProcessCacheInfo
|
||||
{
|
||||
ProcessName = processName,
|
||||
ProcessPath = processPath,
|
||||
LastAccessTime = now
|
||||
};
|
||||
|
||||
return (processName, processPath);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查窗口信息是否发生变化
|
||||
/// </summary>
|
||||
private bool HasWindowChanged(IntPtr hWnd, WindowRect rect, bool isMinimized, bool isMaximized, bool isFullScreen)
|
||||
{
|
||||
if (!_windowCache.TryGetValue(hWnd, out var cachedWindow))
|
||||
{
|
||||
return true; // 新窗口
|
||||
}
|
||||
|
||||
// 检查关键属性是否变化
|
||||
return cachedWindow.Rect.Left != rect.Left ||
|
||||
cachedWindow.Rect.Top != rect.Top ||
|
||||
cachedWindow.Rect.Right != rect.Right ||
|
||||
cachedWindow.Rect.Bottom != rect.Bottom ||
|
||||
cachedWindow.IsMinimized != isMinimized ||
|
||||
cachedWindow.IsMaximized != isMaximized ||
|
||||
cachedWindow.IsFullScreen != isFullScreen;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新窗口列表
|
||||
/// </summary>
|
||||
@@ -193,6 +296,7 @@ namespace Ink_Canvas.Helpers
|
||||
{
|
||||
var windows = new List<WindowInfo>();
|
||||
var zOrder = 0;
|
||||
var currentWindowHandles = new HashSet<IntPtr>();
|
||||
|
||||
EnumWindows((hWnd, lParam) =>
|
||||
{
|
||||
@@ -208,44 +312,10 @@ namespace Ink_Canvas.Helpers
|
||||
// 获取窗口矩形
|
||||
if (!GetWindowRect(hWnd, out WindowRect rect)) return true;
|
||||
|
||||
// 过滤掉无效的窗口(太小或位置异常的窗口)
|
||||
// 过滤掉无效的窗口
|
||||
if (rect.Width <= 0 || rect.Height <= 0) return true;
|
||||
if (rect.Right < rect.Left || rect.Bottom < rect.Top) return true;
|
||||
|
||||
// 获取窗口标题
|
||||
const int nChars = 256;
|
||||
StringBuilder windowTitle = new StringBuilder(nChars);
|
||||
GetWindowText(hWnd, windowTitle, nChars);
|
||||
string title = windowTitle.ToString();
|
||||
|
||||
// 获取窗口类名
|
||||
StringBuilder className = new StringBuilder(nChars);
|
||||
GetClassName(hWnd, className, nChars);
|
||||
string classNameStr = className.ToString();
|
||||
|
||||
// 获取进程信息
|
||||
GetWindowThreadProcessId(hWnd, out uint processId);
|
||||
string processName = "Unknown";
|
||||
string processPath = "Unknown";
|
||||
|
||||
try
|
||||
{
|
||||
Process process = Process.GetProcessById((int)processId);
|
||||
processName = process.ProcessName;
|
||||
try
|
||||
{
|
||||
processPath = process.MainModule?.FileName ?? "Unknown";
|
||||
}
|
||||
catch
|
||||
{
|
||||
processPath = "Unknown";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 进程可能已退出
|
||||
}
|
||||
|
||||
// 检查是否最大化
|
||||
bool isMaximized = IsZoomed(hWnd);
|
||||
|
||||
@@ -266,29 +336,81 @@ namespace Ink_Canvas.Helpers
|
||||
// 无法获取屏幕信息,使用默认值
|
||||
}
|
||||
|
||||
// 检查窗口是否发生变化
|
||||
bool windowChanged = HasWindowChanged(hWnd, rect, isMinimized, isMaximized, isFullScreen);
|
||||
|
||||
// 获取进程信息
|
||||
GetWindowThreadProcessId(hWnd, out uint processId);
|
||||
|
||||
// 使用缓存的进程信息
|
||||
var (processName, processPath) = GetProcessInfo(processId);
|
||||
|
||||
// 跳过当前应用程序的窗口(避免检测到自己)
|
||||
if (processName == "InkCanvasForClass" || processName == "Ink Canvas")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var windowInfo = new WindowInfo
|
||||
// 如果窗口信息未变化且已缓存,尝试重用缓存的数据
|
||||
WindowInfo windowInfo;
|
||||
if (!windowChanged && _windowCache.TryGetValue(hWnd, out var cachedInfo))
|
||||
{
|
||||
Handle = hWnd,
|
||||
Title = title,
|
||||
ClassName = classNameStr,
|
||||
ProcessName = processName,
|
||||
ProcessPath = processPath,
|
||||
Rect = rect,
|
||||
IsVisible = true,
|
||||
IsMinimized = false,
|
||||
IsMaximized = isMaximized,
|
||||
ZOrder = zOrder++,
|
||||
ProcessId = processId,
|
||||
IsFullScreen = isFullScreen
|
||||
};
|
||||
// 重用缓存的窗口信息,只更新Z顺序和可能变化的状态
|
||||
windowInfo = new WindowInfo
|
||||
{
|
||||
Handle = hWnd,
|
||||
Title = cachedInfo.Title,
|
||||
ClassName = cachedInfo.ClassName,
|
||||
ProcessName = cachedInfo.ProcessName,
|
||||
ProcessPath = cachedInfo.ProcessPath,
|
||||
Rect = rect, // 使用最新的rect(虽然理论上应该相同)
|
||||
IsVisible = true,
|
||||
IsMinimized = false,
|
||||
IsMaximized = isMaximized,
|
||||
ZOrder = zOrder++,
|
||||
ProcessId = processId,
|
||||
IsFullScreen = isFullScreen
|
||||
};
|
||||
|
||||
// 更新缓存以保持ZOrder等属性最新
|
||||
_windowCache[hWnd] = windowInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 窗口信息变化或新窗口,需要获取完整信息
|
||||
// 获取窗口标题
|
||||
const int nChars = 256;
|
||||
StringBuilder windowTitle = new StringBuilder(nChars);
|
||||
GetWindowText(hWnd, windowTitle, nChars);
|
||||
string title = windowTitle.ToString();
|
||||
|
||||
// 获取窗口类名
|
||||
StringBuilder className = new StringBuilder(nChars);
|
||||
GetClassName(hWnd, className, nChars);
|
||||
string classNameStr = className.ToString();
|
||||
|
||||
windowInfo = new WindowInfo
|
||||
{
|
||||
Handle = hWnd,
|
||||
Title = title,
|
||||
ClassName = classNameStr,
|
||||
ProcessName = processName,
|
||||
ProcessPath = processPath,
|
||||
Rect = rect,
|
||||
IsVisible = true,
|
||||
IsMinimized = false,
|
||||
IsMaximized = isMaximized,
|
||||
ZOrder = zOrder++,
|
||||
ProcessId = processId,
|
||||
IsFullScreen = isFullScreen
|
||||
};
|
||||
|
||||
// 更新缓存
|
||||
_windowCache[hWnd] = windowInfo;
|
||||
}
|
||||
|
||||
windows.Add(windowInfo);
|
||||
currentWindowHandles.Add(hWnd);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -298,8 +420,13 @@ namespace Ink_Canvas.Helpers
|
||||
return true; // 继续枚举
|
||||
}, IntPtr.Zero);
|
||||
|
||||
// 按Z顺序排序(从最上层到最下层)
|
||||
// 注意:EnumWindows返回的顺序可能不是严格的Z顺序,但我们可以通过GetWindow来获取更准确的顺序
|
||||
// 清理已关闭的窗口缓存
|
||||
var handlesToRemove = _windowCache.Keys.Where(h => !currentWindowHandles.Contains(h)).ToList();
|
||||
foreach (var handle in handlesToRemove)
|
||||
{
|
||||
_windowCache.Remove(handle);
|
||||
}
|
||||
|
||||
windows = windows.OrderByDescending(w => w.ZOrder).ToList();
|
||||
|
||||
lock (_lockObject)
|
||||
@@ -473,6 +600,13 @@ namespace Ink_Canvas.Helpers
|
||||
{
|
||||
_windows.Clear();
|
||||
}
|
||||
|
||||
lock (_processCacheLock)
|
||||
{
|
||||
_processCache.Clear();
|
||||
}
|
||||
|
||||
_windowCache.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-14
@@ -1444,7 +1444,7 @@
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/Powerpoint.png" Margin="0,0,6,0" Width="28"
|
||||
Height="28" VerticalAlignment="Center" />
|
||||
<TextBlock Foreground="#fafafa" Text="PowerPoint 联动增强" VerticalAlignment="Center"
|
||||
<TextBlock Foreground="#fafafa" Text="PowerPoint 联动增强(目前已不推荐使用)" VerticalAlignment="Center"
|
||||
FontSize="14" Margin="0,0,16,0" />
|
||||
<ui:ToggleSwitch OnContent="" OffContent="" Name="ToggleSwitchPowerPointEnhancement"
|
||||
IsOn="False" FontFamily="Microsoft YaHei UI" FontWeight="Bold"
|
||||
@@ -2249,19 +2249,6 @@
|
||||
<TextBlock
|
||||
Text="# 开启该选项后,长按PPT翻页按钮可以连续翻页,提高翻页效率。"
|
||||
TextWrapping="Wrap" Foreground="#a1a1aa" />
|
||||
<ui:SimpleStackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Left" Margin="0,6,0,0">
|
||||
<TextBlock Foreground="#fafafa" Text="点击翻页时跳过转场动画,直接切到下一张"
|
||||
VerticalAlignment="Center" FontSize="14" Margin="0,0,16,0" />
|
||||
<ui:ToggleSwitch OnContent="" OffContent=""
|
||||
Name="ToggleSwitchSkipAnimationsWhenGoNext"
|
||||
IsOn="False"
|
||||
FontFamily="Microsoft YaHei UI" FontWeight="Bold"
|
||||
Toggled="ToggleSwitchSkipAnimationsWhenGoNext_OnToggled" />
|
||||
</ui:SimpleStackPanel>
|
||||
<TextBlock
|
||||
Text="# 开启该选项后,点击下一页按钮时会跳过幻灯片之间的转场动画,直接跳转到下一张幻灯片。不会影响幻灯片内的元素动画。"
|
||||
TextWrapping="Wrap" Foreground="#a1a1aa" />
|
||||
</ui:SimpleStackPanel>
|
||||
<Line HorizontalAlignment="Center" X1="0" Y1="0" X2="400" Y2="0" Stroke="#3f3f46"
|
||||
StrokeThickness="1" Margin="0,4,0,4" />
|
||||
@@ -10338,6 +10325,15 @@
|
||||
Margin="0,20,20,0">
|
||||
<Windows:PPTTimeCapsule x:Name="PPTTimeCapsule"/>
|
||||
</Border>
|
||||
|
||||
<Border x:Name="PPTQuickPanelContainer"
|
||||
Visibility="Collapsed"
|
||||
Panel.ZIndex="999"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,50,0,0">
|
||||
<Windows:PPTQuickPanel x:Name="PPTQuickPanel"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
|
||||
@@ -66,13 +66,13 @@ namespace Ink_Canvas
|
||||
private WindowOverviewModel _windowOverviewModel;
|
||||
|
||||
// 设置面板相关状态
|
||||
private bool userChangedNoFocusModeInSettings;
|
||||
private bool isTemporarilyDisablingNoFocusMode = false;
|
||||
|
||||
// 全屏处理状态标志
|
||||
public bool isFullScreenApplied = false;
|
||||
|
||||
|
||||
private static Cursor _cachedPenCursor = null;
|
||||
private static readonly object _cursorLock = new object();
|
||||
|
||||
#region Window Initialization
|
||||
|
||||
@@ -1363,9 +1363,31 @@ namespace Ink_Canvas
|
||||
}
|
||||
else if (canvas.EditingMode == InkCanvasEditingMode.Ink)
|
||||
{
|
||||
var sri = Application.GetResourceStream(new Uri("Resources/Cursors/Pen.cur", UriKind.Relative));
|
||||
if (sri != null)
|
||||
canvas.Cursor = new Cursor(sri.Stream);
|
||||
if (_cachedPenCursor == null)
|
||||
{
|
||||
lock (_cursorLock)
|
||||
{
|
||||
if (_cachedPenCursor == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sri = Application.GetResourceStream(new Uri("Resources/Cursors/Pen.cur", UriKind.Relative));
|
||||
if (sri != null)
|
||||
{
|
||||
_cachedPenCursor = new Cursor(sri.Stream);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"加载 Pen 光标资源失败: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_cachedPenCursor != null)
|
||||
{
|
||||
canvas.Cursor = _cachedPenCursor;
|
||||
}
|
||||
}
|
||||
|
||||
// 确保光标可见,无论是鼠标、触控还是手写笔
|
||||
@@ -2441,11 +2463,6 @@ namespace Ink_Canvas
|
||||
ApplyAlwaysOnTop();
|
||||
}
|
||||
|
||||
// 如果当前在设置面板中,标记用户已修改无焦点模式设置
|
||||
if (BorderSettings.Visibility == Visibility.Visible)
|
||||
{
|
||||
userChangedNoFocusModeInSettings = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSwitchAlwaysOnTop_Toggled(object sender, RoutedEventArgs e)
|
||||
@@ -2710,10 +2727,11 @@ namespace Ink_Canvas
|
||||
Settings.PowerPointSettings.EnablePPTTimeCapsule = toggle != null && toggle.IsOn;
|
||||
SaveSettingsToFile();
|
||||
|
||||
// 如果当前在PPT放映模式,需要立即更新时间胶囊的显示状态
|
||||
// 如果当前在PPT放映模式,需要立即更新时间胶囊和快捷面板的显示状态
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
|
||||
{
|
||||
UpdatePPTTimeCapsuleVisibility();
|
||||
UpdatePPTQuickPanelVisibility();
|
||||
}
|
||||
|
||||
LogHelper.WriteLogToFile($"PPT时间显示胶囊已{(Settings.PowerPointSettings.EnablePPTTimeCapsule ? "启用" : "禁用")}", LogHelper.LogType.Event);
|
||||
@@ -2799,6 +2817,33 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新PPT快捷面板的显示状态
|
||||
/// </summary>
|
||||
public void UpdatePPTQuickPanelVisibility()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (PPTQuickPanelContainer == null || PPTQuickPanel == null) return;
|
||||
|
||||
// 仅在PPT模式下显示
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible)
|
||||
{
|
||||
PPTQuickPanelContainer.Visibility = Visibility.Visible;
|
||||
PPTQuickPanel?.UpdateVisibility(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
PPTQuickPanelContainer.Visibility = Visibility.Collapsed;
|
||||
PPTQuickPanel?.UpdateVisibility(false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"更新PPT快捷面板显示状态时出错: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新PPT时间胶囊的位置
|
||||
/// </summary>
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace Ink_Canvas
|
||||
{
|
||||
private int inkColor = 1;
|
||||
|
||||
private void ColorSwitchCheck()
|
||||
private void ColorSwitchCheck(bool hidePanels = true)
|
||||
{
|
||||
if (penType != 1)
|
||||
if (hidePanels)
|
||||
{
|
||||
HideSubPanels("color");
|
||||
}
|
||||
@@ -606,7 +606,7 @@ namespace Ink_Canvas
|
||||
drawingAttributes.IsHighlighter = true;
|
||||
|
||||
// 确保荧光笔模式切换后正确更新颜色和快捷调色板指示器
|
||||
ColorSwitchCheck();
|
||||
ColorSwitchCheck(false);
|
||||
}
|
||||
|
||||
private void BtnColorBlack_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -116,6 +116,12 @@ namespace Ink_Canvas
|
||||
{
|
||||
if (sender is FrameworkElement element)
|
||||
{
|
||||
if (inkCanvas.EditingMode != InkCanvasEditingMode.Select)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 取消之前选中的元素
|
||||
if (currentSelectedElement != null && currentSelectedElement != element)
|
||||
{
|
||||
@@ -223,6 +229,12 @@ namespace Ink_Canvas
|
||||
{
|
||||
if (sender is FrameworkElement element)
|
||||
{
|
||||
if (inkCanvas.EditingMode != InkCanvasEditingMode.Select)
|
||||
{
|
||||
e.Handled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 取消之前选中的元素
|
||||
if (currentSelectedElement != null && currentSelectedElement != element)
|
||||
{
|
||||
|
||||
@@ -709,7 +709,48 @@ namespace Ink_Canvas
|
||||
BlackBoardWaterMark.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
_ = UpdateChickenSoupTextAsync();
|
||||
_ = UpdateChickenSoupTextAsync().ContinueWith(t =>
|
||||
{
|
||||
if (t.IsFaulted)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogHelper.WriteLogToFile($"进入白板模式时更新名言失败: {t.Exception?.GetBaseException().Message}", LogHelper.LogType.Warning);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
if (Settings.Appearance.EnableChickenSoupInWhiteboardMode && Settings.Appearance.ChickenSoupSource != 3)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Settings.Appearance.ChickenSoupSource == 0)
|
||||
{
|
||||
int randChickenSoupIndex = new Random().Next(ChickenSoup.OSUPlayerYuLu.Length);
|
||||
BlackBoardWaterMark.Text = ChickenSoup.OSUPlayerYuLu[randChickenSoupIndex];
|
||||
}
|
||||
else if (Settings.Appearance.ChickenSoupSource == 1)
|
||||
{
|
||||
int randChickenSoupIndex = new Random().Next(ChickenSoup.MingYanJingJu.Length);
|
||||
BlackBoardWaterMark.Text = ChickenSoup.MingYanJingJu[randChickenSoupIndex];
|
||||
}
|
||||
else if (Settings.Appearance.ChickenSoupSource == 2)
|
||||
{
|
||||
int randChickenSoupIndex = new Random().Next(ChickenSoup.GaoKaoPhrases.Length);
|
||||
BlackBoardWaterMark.Text = ChickenSoup.GaoKaoPhrases[randChickenSoupIndex];
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
BlackBoardWaterMark.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
else if (Settings.Appearance.EnableChickenSoupInWhiteboardMode && Settings.Appearance.ChickenSoupSource == 3)
|
||||
{
|
||||
BlackBoardWaterMark.Text = "一言功能不可用";
|
||||
}
|
||||
}
|
||||
}, TaskScheduler.FromCurrentSynchronizationContext());
|
||||
|
||||
if (Settings.Canvas.UsingWhiteboard)
|
||||
{
|
||||
@@ -2830,6 +2871,7 @@ namespace Ink_Canvas
|
||||
|
||||
private bool isOpeningOrHidingSettingsPane;
|
||||
private bool wasNoFocusModeBeforeSettings;
|
||||
private bool userChangedNoFocusModeInSettings;
|
||||
|
||||
private void BtnSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
@@ -3956,4 +3998,4 @@ namespace Ink_Canvas
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+131
-242
@@ -77,7 +77,7 @@ namespace Ink_Canvas
|
||||
#endregion
|
||||
|
||||
#region PPT State Management
|
||||
private bool isEnteredSlideShowEndEvent;
|
||||
private bool isEnteredSlideShowEndEvent;
|
||||
private bool isPresentationHaveBlackSpace;
|
||||
|
||||
// 长按翻页相关字段
|
||||
@@ -93,15 +93,15 @@ namespace Ink_Canvas
|
||||
// 上次播放位置相关字段
|
||||
private int _lastPlaybackPage = 0;
|
||||
private bool _shouldNavigateToLastPage = false;
|
||||
|
||||
|
||||
// 当前播放页码跟踪
|
||||
private int _currentSlideShowPosition = 0;
|
||||
|
||||
// 页面切换防抖机制
|
||||
private DateTime _lastSlideSwitchTime = DateTime.MinValue;
|
||||
private int _pendingSlideIndex = -1;
|
||||
private const int SlideSwitchDebounceMs = 150;
|
||||
private bool _isInkClearedByButton = false;
|
||||
private System.Timers.Timer _slideSwitchDebounceTimer;
|
||||
private const int SlideSwitchDebounceMs = 150; // 防抖延迟150毫秒
|
||||
#endregion
|
||||
|
||||
#region PPT Managers
|
||||
@@ -152,10 +152,6 @@ namespace Ink_Canvas
|
||||
_pptUIManager.PPTRBButtonPosition = Settings.PowerPointSettings.PPTRBButtonPosition;
|
||||
_pptUIManager.EnablePPTButtonPageClickable = Settings.PowerPointSettings.EnablePPTButtonPageClickable;
|
||||
_pptUIManager.EnablePPTButtonLongPressPageTurn = Settings.PowerPointSettings.EnablePPTButtonLongPressPageTurn;
|
||||
_pptUIManager.PPTLSButtonOpacity = Settings.PowerPointSettings.PPTLSButtonOpacity;
|
||||
_pptUIManager.PPTRSButtonOpacity = Settings.PowerPointSettings.PPTRSButtonOpacity;
|
||||
_pptUIManager.PPTLBButtonOpacity = Settings.PowerPointSettings.PPTLBButtonOpacity;
|
||||
_pptUIManager.PPTRBButtonOpacity = Settings.PowerPointSettings.PPTRBButtonOpacity;
|
||||
|
||||
LogHelper.WriteLogToFile("PPT管理器初始化完成", LogHelper.LogType.Event);
|
||||
}
|
||||
@@ -528,8 +524,6 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isInSlideShowWhenOpened = _pptManager?.IsInSlideShow == true;
|
||||
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
// 在初始化墨迹管理器之前,先清理画布上的所有墨迹
|
||||
@@ -552,7 +546,8 @@ namespace Ink_Canvas
|
||||
CheckAndNotifyHiddenSlides(pres);
|
||||
}
|
||||
|
||||
if (Settings.PowerPointSettings.IsNotifyAutoPlayPresentation && !isInSlideShowWhenOpened)
|
||||
// 检查自动播放设置
|
||||
if (Settings.PowerPointSettings.IsNotifyAutoPlayPresentation)
|
||||
{
|
||||
CheckAndNotifyAutoPlaySettings(pres);
|
||||
}
|
||||
@@ -730,7 +725,7 @@ namespace Ink_Canvas
|
||||
if (Settings.PowerPointSettings.IsShowCanvasAtNewSlideShow &&
|
||||
!Settings.Automation.IsAutoFoldInPPTSlideShow)
|
||||
{
|
||||
await Task.Delay(600);
|
||||
await Task.Delay(300);
|
||||
// 先进入批注模式,这会显示调色盘
|
||||
PenIcon_Click(null, null);
|
||||
// 然后设置颜色
|
||||
@@ -771,7 +766,6 @@ namespace Ink_Canvas
|
||||
LoadCurrentSlideInk(currentSlide);
|
||||
});
|
||||
|
||||
|
||||
if (!isFloatingBarFolded)
|
||||
{
|
||||
new Thread(() =>
|
||||
@@ -784,8 +778,9 @@ namespace Ink_Canvas
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"处理幻灯片放映开始事件失败: {ex}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,7 +788,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
if (wn?.View == null || wn.Presentation == null)
|
||||
{
|
||||
@@ -804,58 +799,11 @@ namespace Ink_Canvas
|
||||
var activePresentation = wn.Presentation;
|
||||
var totalSlides = activePresentation.Slides.Count;
|
||||
|
||||
// 获取之前的页码(用于保存墨迹)
|
||||
var previousSlide = _currentSlideShowPosition > 0 ? _currentSlideShowPosition :
|
||||
(_pptManager?.GetCurrentSlideNumber() ?? 0);
|
||||
|
||||
if (_isInkClearedByButton)
|
||||
{
|
||||
_isInkClearedByButton = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
StrokeCollection strokesToSave = null;
|
||||
if (previousSlide > 0 && previousSlide != currentSlide && inkCanvas.Strokes.Count > 0)
|
||||
{
|
||||
strokesToSave = inkCanvas.Strokes.Clone();
|
||||
}
|
||||
|
||||
// 清除墨迹
|
||||
if (inkCanvas.Strokes.Count > 0)
|
||||
{
|
||||
ClearStrokes(true);
|
||||
timeMachine.ClearStrokeHistory();
|
||||
}
|
||||
|
||||
// 异步保存之前页面的墨迹
|
||||
if (strokesToSave != null && previousSlide > 0 && previousSlide != currentSlide)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
bool canWrite = _singlePPTInkManager?.CanWriteInk(previousSlide) == true;
|
||||
if (canWrite)
|
||||
{
|
||||
_singlePPTInkManager?.SaveCurrentSlideStrokes(previousSlide, strokesToSave);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"异步保存PPT页面墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 更新当前播放页码
|
||||
_currentSlideShowPosition = currentSlide;
|
||||
|
||||
LoadCurrentSlideInk(currentSlide, skipClear: true);
|
||||
_pptUIManager?.UpdateCurrentSlideNumber(currentSlide, totalSlides);
|
||||
// 使用防抖机制处理页面切换
|
||||
HandleSlideSwitchWithDebounce(currentSlide, totalSlides);
|
||||
|
||||
});
|
||||
}
|
||||
@@ -869,7 +817,6 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
// PPT退出时自动收纳浮动栏
|
||||
if (Settings.Automation.IsAutoFoldAfterPPTSlideShow && !isFloatingBarFolded)
|
||||
{
|
||||
FoldFloatingBar_MouseUp(new object(), null);
|
||||
@@ -961,7 +908,7 @@ namespace Ink_Canvas
|
||||
if (GridTransparencyFakeBackground.Background != Brushes.Transparent)
|
||||
BtnHideInkCanvas_Click(BtnHideInkCanvas, null);
|
||||
SetCurrentToolMode(InkCanvasEditingMode.None);
|
||||
|
||||
|
||||
UpdateCurrentToolMode("cursor");
|
||||
SetFloatingBarHighlightPosition("cursor");
|
||||
}
|
||||
@@ -974,14 +921,16 @@ namespace Ink_Canvas
|
||||
await Task.Delay(100);
|
||||
await Application.Current.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
if (Settings.Automation.IsAutoFoldAfterPPTSlideShow)
|
||||
PureViewboxFloatingBarMarginAnimationInDesktopMode();
|
||||
if (Settings.Automation.IsAutoEnterAnnotationModeWhenExitFoldMode)
|
||||
{
|
||||
PureViewboxFloatingBarMarginAnimationInDesktopMode();
|
||||
ViewboxFloatingBarMarginAnimation(-60);
|
||||
}
|
||||
else
|
||||
{
|
||||
PureViewboxFloatingBarMarginAnimationInDesktopMode();
|
||||
Task.Delay(350).ContinueWith(_ =>
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
ViewboxFloatingBarMarginAnimation(-60);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1003,10 +952,7 @@ namespace Ink_Canvas
|
||||
}
|
||||
else if (Settings.PowerPointSettings.IsNotifyPreviousPage)
|
||||
{
|
||||
if (_pptManager?.IsInSlideShow != true)
|
||||
{
|
||||
ShowPreviousPageNotification(pres);
|
||||
}
|
||||
ShowPreviousPageNotification(pres);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1118,7 +1064,7 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_pptManager?.IsInSlideShow == true) return;
|
||||
if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) return;
|
||||
|
||||
bool hasSlideTimings = false;
|
||||
if (pres?.Slides != null)
|
||||
@@ -1166,16 +1112,13 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadCurrentSlideInk(int slideIndex, bool skipClear = false)
|
||||
private void LoadCurrentSlideInk(int slideIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 如果未跳过清除,则清除当前墨迹
|
||||
if (!skipClear)
|
||||
{
|
||||
ClearStrokes(true);
|
||||
timeMachine.ClearStrokeHistory();
|
||||
}
|
||||
ClearStrokes(true);
|
||||
timeMachine.ClearStrokeHistory();
|
||||
|
||||
StrokeCollection strokes = _singlePPTInkManager?.LoadSlideStrokes(slideIndex);
|
||||
|
||||
if (strokes != null && strokes.Count > 0)
|
||||
@@ -1220,7 +1163,7 @@ namespace Ink_Canvas
|
||||
// 重置上次播放位置相关字段
|
||||
_lastPlaybackPage = 0;
|
||||
_shouldNavigateToLastPage = false;
|
||||
|
||||
|
||||
// 重置当前播放页码跟踪
|
||||
_currentSlideShowPosition = 0;
|
||||
|
||||
@@ -1241,14 +1184,51 @@ namespace Ink_Canvas
|
||||
/// </summary>
|
||||
private void HandleSlideSwitchWithDebounce(int currentSlide, int totalSlides)
|
||||
{
|
||||
try
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
|
||||
// 如果距离上次切换时间太短,使用防抖机制
|
||||
if (now - _lastSlideSwitchTime < TimeSpan.FromMilliseconds(SlideSwitchDebounceMs))
|
||||
{
|
||||
_pendingSlideIndex = currentSlide;
|
||||
|
||||
// 停止之前的定时器
|
||||
_slideSwitchDebounceTimer?.Stop();
|
||||
|
||||
// 创建新的定时器
|
||||
_slideSwitchDebounceTimer = new System.Timers.Timer(SlideSwitchDebounceMs);
|
||||
_slideSwitchDebounceTimer.Elapsed += (sender, e) =>
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (_pendingSlideIndex > 0)
|
||||
{
|
||||
SwitchSlideInk(_pendingSlideIndex);
|
||||
_pptUIManager?.UpdateCurrentSlideNumber(_pendingSlideIndex, totalSlides);
|
||||
_pendingSlideIndex = -1;
|
||||
}
|
||||
});
|
||||
_slideSwitchDebounceTimer?.Stop();
|
||||
};
|
||||
_slideSwitchDebounceTimer.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 直接处理页面切换
|
||||
SwitchSlideInk(currentSlide);
|
||||
_pptUIManager?.UpdateCurrentSlideNumber(currentSlide, totalSlides);
|
||||
}
|
||||
|
||||
_lastSlideSwitchTime = now;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"处理页面切换防抖失败: {ex}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切换页面墨迹
|
||||
/// </summary>
|
||||
/// <param name="newSlideIndex">新页面索引</param>
|
||||
/// <param name="skipClear">是否跳过清除操作(如果已在翻页时立即清除,则设为true)</param>
|
||||
private void SwitchSlideInk(int newSlideIndex, bool skipClear = false)
|
||||
private void SwitchSlideInk(int newSlideIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1269,25 +1249,20 @@ namespace Ink_Canvas
|
||||
}
|
||||
|
||||
// 如果有当前墨迹且不是第一次切换,先保存到当前页面
|
||||
if (currentSlideIndex > 0 && currentSlideIndex != newSlideIndex)
|
||||
if (inkCanvas.Strokes.Count > 0 && currentSlideIndex > 0 && currentSlideIndex != newSlideIndex)
|
||||
{
|
||||
bool canWrite = _singlePPTInkManager?.CanWriteInk(currentSlideIndex) == true;
|
||||
|
||||
if (canWrite && inkCanvas.Strokes.Count > 0)
|
||||
if (canWrite)
|
||||
{
|
||||
_singlePPTInkManager?.SaveCurrentSlideStrokes(currentSlideIndex, inkCanvas.Strokes);
|
||||
}
|
||||
}
|
||||
|
||||
if (!skipClear)
|
||||
{
|
||||
ClearStrokes(true);
|
||||
timeMachine.ClearStrokeHistory();
|
||||
}
|
||||
|
||||
// 加载新页面的墨迹
|
||||
ClearStrokes(true);
|
||||
timeMachine.ClearStrokeHistory();
|
||||
StrokeCollection newStrokes = _singlePPTInkManager?.SwitchToSlide(newSlideIndex, null);
|
||||
|
||||
|
||||
if (newStrokes != null && newStrokes.Count > 0)
|
||||
{
|
||||
inkCanvas.Strokes.Add(newStrokes);
|
||||
@@ -1397,9 +1372,25 @@ namespace Ink_Canvas
|
||||
|
||||
if (Settings.PowerPointSettings.IsSupportWPS)
|
||||
{
|
||||
Settings.PowerPointSettings.EnablePowerPointEnhancement = false;
|
||||
ToggleSwitchPowerPointEnhancement.IsOn = false;
|
||||
StopPowerPointProcessMonitoring();
|
||||
if (!Settings.PowerPointSettings.PowerPointSupport)
|
||||
{
|
||||
Settings.PowerPointSettings.PowerPointSupport = true;
|
||||
ToggleSwitchSupportPowerPoint.IsOn = true;
|
||||
|
||||
// 启动PPT监控
|
||||
if (_pptManager == null)
|
||||
{
|
||||
InitializePPTManagers();
|
||||
}
|
||||
StartPPTMonitoring();
|
||||
}
|
||||
|
||||
if (Settings.PowerPointSettings.EnablePowerPointEnhancement)
|
||||
{
|
||||
Settings.PowerPointSettings.EnablePowerPointEnhancement = false;
|
||||
ToggleSwitchPowerPointEnhancement.IsOn = false;
|
||||
StopPowerPointProcessMonitoring();
|
||||
}
|
||||
}
|
||||
|
||||
// 更新PPT管理器的WPS支持设置
|
||||
@@ -1422,72 +1413,25 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
var previousSlideBeforeNavigate = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||
|
||||
StrokeCollection strokesToSave = null;
|
||||
if (previousSlideBeforeNavigate > 0 && inkCanvas.Strokes.Count > 0)
|
||||
// 保存当前页墨迹
|
||||
var currentSlide = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||
if (currentSlide > 0)
|
||||
{
|
||||
strokesToSave = inkCanvas.Strokes.Clone();
|
||||
_singlePPTInkManager?.SaveCurrentSlideStrokes(currentSlide, inkCanvas.Strokes);
|
||||
}
|
||||
|
||||
// 保存截图(如果启用)
|
||||
if (inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber &&
|
||||
Settings.PowerPointSettings.IsAutoSaveScreenShotInPowerPoint)
|
||||
{
|
||||
var presentationName = _pptManager?.GetPresentationName() ?? "";
|
||||
SaveScreenShot(true, $"{presentationName}/{currentSlide}");
|
||||
}
|
||||
|
||||
// 执行翻页
|
||||
if (_pptManager?.TryNavigatePrevious() == true)
|
||||
{
|
||||
var currentSlideAfterNavigate = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||
|
||||
if (previousSlideBeforeNavigate == currentSlideAfterNavigate && previousSlideBeforeNavigate > 0)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
currentSlideAfterNavigate = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||
}
|
||||
|
||||
if (previousSlideBeforeNavigate != currentSlideAfterNavigate && previousSlideBeforeNavigate > 0)
|
||||
{
|
||||
if (inkCanvas.Strokes.Count > 0)
|
||||
{
|
||||
ClearStrokes(true);
|
||||
timeMachine.ClearStrokeHistory();
|
||||
_isInkClearedByButton = true;
|
||||
}
|
||||
|
||||
if (strokesToSave != null && previousSlideBeforeNavigate > 0)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
_singlePPTInkManager?.SaveCurrentSlideStrokes(previousSlideBeforeNavigate, strokesToSave);
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"异步保存PPT上一页墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||
}
|
||||
});
|
||||
|
||||
// 异步保存截图(如果启用)
|
||||
if (strokesToSave.Count > Settings.Automation.MinimumAutomationStrokeNumber &&
|
||||
Settings.PowerPointSettings.IsAutoSaveScreenShotInPowerPoint)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
var presentationName = _pptManager?.GetPresentationName() ?? "";
|
||||
SaveScreenShot(true, $"{presentationName}/{previousSlideBeforeNavigate}");
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"异步保存PPT上一页截图失败: {ex}", LogHelper.LogType.Error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// 翻页成功,等待事件处理墨迹切换
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1509,74 +1453,25 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
var previousSlideBeforeNavigate = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||
|
||||
StrokeCollection strokesToSave = null;
|
||||
if (previousSlideBeforeNavigate > 0 && inkCanvas.Strokes.Count > 0)
|
||||
// 保存当前页墨迹
|
||||
var currentSlide = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||
if (currentSlide > 0)
|
||||
{
|
||||
strokesToSave = inkCanvas.Strokes.Clone();
|
||||
_singlePPTInkManager?.SaveCurrentSlideStrokes(currentSlide, inkCanvas.Strokes);
|
||||
}
|
||||
|
||||
var skipAnimations = Settings.PowerPointSettings.SkipAnimationsWhenGoNext;
|
||||
|
||||
if (_pptManager?.TryNavigateNext(skipAnimations: skipAnimations) == true)
|
||||
// 保存截图(如果启用)
|
||||
if (inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber &&
|
||||
Settings.PowerPointSettings.IsAutoSaveScreenShotInPowerPoint)
|
||||
{
|
||||
var currentSlideAfterNavigate = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||
var presentationName = _pptManager?.GetPresentationName() ?? "";
|
||||
SaveScreenShot(true, $"{presentationName}/{currentSlide}");
|
||||
}
|
||||
|
||||
if (previousSlideBeforeNavigate == currentSlideAfterNavigate && previousSlideBeforeNavigate > 0)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
currentSlideAfterNavigate = _pptManager?.GetCurrentSlideNumber() ?? 0;
|
||||
}
|
||||
|
||||
if (previousSlideBeforeNavigate != currentSlideAfterNavigate && previousSlideBeforeNavigate > 0)
|
||||
{
|
||||
if (inkCanvas.Strokes.Count > 0)
|
||||
{
|
||||
ClearStrokes(true);
|
||||
timeMachine.ClearStrokeHistory();
|
||||
_isInkClearedByButton = true;
|
||||
}
|
||||
|
||||
if (strokesToSave != null && previousSlideBeforeNavigate > 0)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
_singlePPTInkManager?.SaveCurrentSlideStrokes(previousSlideBeforeNavigate, strokesToSave);
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"异步保存PPT下一页墨迹失败: {ex}", LogHelper.LogType.Error);
|
||||
}
|
||||
});
|
||||
|
||||
// 异步保存截图(如果启用)
|
||||
if (strokesToSave.Count > Settings.Automation.MinimumAutomationStrokeNumber &&
|
||||
Settings.PowerPointSettings.IsAutoSaveScreenShotInPowerPoint)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
var presentationName = _pptManager?.GetPresentationName() ?? "";
|
||||
SaveScreenShot(true, $"{presentationName}/{previousSlideBeforeNavigate}");
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"异步保存PPT下一页截图失败: {ex}", LogHelper.LogType.Error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// 执行翻页
|
||||
if (_pptManager?.TryNavigateNext() == true)
|
||||
{
|
||||
// 翻页成功,等待事件处理墨迹切换
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1752,15 +1647,12 @@ namespace Ink_Canvas
|
||||
SetCurrentToolMode(InkCanvasEditingMode.None);
|
||||
|
||||
await Task.Delay(150);
|
||||
|
||||
if (Settings.Automation.IsAutoFoldAfterPPTSlideShow)
|
||||
{
|
||||
PureViewboxFloatingBarMarginAnimationInDesktopMode();
|
||||
if (Settings.Automation.IsAutoEnterAnnotationModeWhenExitFoldMode)
|
||||
{
|
||||
await Task.Delay(350);
|
||||
ViewboxFloatingBarMarginAnimation(-60);
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewboxFloatingBarMarginAnimation(100, true);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1777,14 +1669,12 @@ namespace Ink_Canvas
|
||||
await HandleManualSlideShowEnd();
|
||||
|
||||
await Task.Delay(150);
|
||||
if (Settings.Automation.IsAutoFoldAfterPPTSlideShow)
|
||||
PureViewboxFloatingBarMarginAnimationInDesktopMode();
|
||||
if (Settings.Automation.IsAutoEnterAnnotationModeWhenExitFoldMode)
|
||||
{
|
||||
await Task.Delay(350);
|
||||
ViewboxFloatingBarMarginAnimation(-60);
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewboxFloatingBarMarginAnimation(100, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1795,7 +1685,6 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
// PPT退出时自动收纳浮动栏
|
||||
if (Settings.Automation.IsAutoFoldAfterPPTSlideShow && !isFloatingBarFolded)
|
||||
{
|
||||
FoldFloatingBar_MouseUp(new object(), null);
|
||||
|
||||
@@ -108,6 +108,21 @@ namespace Ink_Canvas
|
||||
if (!isLoaded) return;
|
||||
|
||||
Settings.PowerPointSettings.PowerPointSupport = ToggleSwitchSupportPowerPoint.IsOn;
|
||||
|
||||
if (!Settings.PowerPointSettings.PowerPointSupport)
|
||||
{
|
||||
if (Settings.PowerPointSettings.IsSupportWPS)
|
||||
{
|
||||
Settings.PowerPointSettings.IsSupportWPS = false;
|
||||
ToggleSwitchSupportWPS.IsOn = false;
|
||||
|
||||
if (_pptManager != null)
|
||||
{
|
||||
_pptManager.IsSupportWPS = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SaveSettingsToFile();
|
||||
|
||||
// 使用新的PPT管理器
|
||||
@@ -360,7 +375,18 @@ namespace Ink_Canvas
|
||||
|
||||
try
|
||||
{
|
||||
var clientObj = HitokotoHttpClient.Value;
|
||||
object clientObj = null;
|
||||
try
|
||||
{
|
||||
clientObj = HitokotoHttpClient.Value;
|
||||
}
|
||||
catch (Exception initEx)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"HTTP 客户端初始化失败: {initEx.Message}", LogHelper.LogType.Warning);
|
||||
BlackBoardWaterMark.Text = "一言功能不可用(缺少 System.Net.Http)";
|
||||
return;
|
||||
}
|
||||
|
||||
if (clientObj == null || !(clientObj is HttpClient client))
|
||||
{
|
||||
BlackBoardWaterMark.Text = "一言功能不可用(缺少 System.Net.Http)";
|
||||
@@ -660,18 +686,13 @@ namespace Ink_Canvas
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void ToggleSwitchSkipAnimationsWhenGoNext_OnToggled(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!isLoaded) return;
|
||||
Settings.PowerPointSettings.SkipAnimationsWhenGoNext = ToggleSwitchSkipAnimationsWhenGoNext.IsOn;
|
||||
SaveSettingsToFile();
|
||||
}
|
||||
|
||||
private void PPTLSButtonOpacityValueSlider_ValueChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!isLoaded) return;
|
||||
double roundedValue = Math.Round(PPTLSButtonOpacityValueSlider.Value, 1);
|
||||
PPTLSButtonOpacityValueSlider.ValueChanged -= PPTLSButtonOpacityValueSlider_ValueChanged;
|
||||
PPTLSButtonOpacityValueSlider.Value = roundedValue;
|
||||
PPTLSButtonOpacityValueSlider.ValueChanged += PPTLSButtonOpacityValueSlider_ValueChanged;
|
||||
Settings.PowerPointSettings.PPTLSButtonOpacity = roundedValue;
|
||||
SaveSettingsToFile();
|
||||
// 更新PPT UI管理器设置
|
||||
@@ -687,7 +708,9 @@ namespace Ink_Canvas
|
||||
{
|
||||
if (!isLoaded) return;
|
||||
double roundedValue = Math.Round(PPTRSButtonOpacityValueSlider.Value, 1);
|
||||
PPTRSButtonOpacityValueSlider.ValueChanged -= PPTRSButtonOpacityValueSlider_ValueChanged;
|
||||
PPTRSButtonOpacityValueSlider.Value = roundedValue;
|
||||
PPTRSButtonOpacityValueSlider.ValueChanged += PPTRSButtonOpacityValueSlider_ValueChanged;
|
||||
Settings.PowerPointSettings.PPTRSButtonOpacity = roundedValue;
|
||||
SaveSettingsToFile();
|
||||
// 更新PPT UI管理器设置
|
||||
@@ -703,7 +726,9 @@ namespace Ink_Canvas
|
||||
{
|
||||
if (!isLoaded) return;
|
||||
double roundedValue = Math.Round(PPTLBButtonOpacityValueSlider.Value, 1);
|
||||
PPTLBButtonOpacityValueSlider.ValueChanged -= PPTLBButtonOpacityValueSlider_ValueChanged;
|
||||
PPTLBButtonOpacityValueSlider.Value = roundedValue;
|
||||
PPTLBButtonOpacityValueSlider.ValueChanged += PPTLBButtonOpacityValueSlider_ValueChanged;
|
||||
Settings.PowerPointSettings.PPTLBButtonOpacity = roundedValue;
|
||||
SaveSettingsToFile();
|
||||
// 更新PPT UI管理器设置
|
||||
@@ -719,7 +744,9 @@ namespace Ink_Canvas
|
||||
{
|
||||
if (!isLoaded) return;
|
||||
double roundedValue = Math.Round(PPTRBButtonOpacityValueSlider.Value, 1);
|
||||
PPTRBButtonOpacityValueSlider.ValueChanged -= PPTRBButtonOpacityValueSlider_ValueChanged;
|
||||
PPTRBButtonOpacityValueSlider.Value = roundedValue;
|
||||
PPTRBButtonOpacityValueSlider.ValueChanged += PPTRBButtonOpacityValueSlider_ValueChanged;
|
||||
Settings.PowerPointSettings.PPTRBButtonOpacity = roundedValue;
|
||||
SaveSettingsToFile();
|
||||
// 更新PPT UI管理器设置
|
||||
@@ -2731,7 +2758,7 @@ namespace Ink_Canvas
|
||||
Settings.Startup.IsFoldAtStartup = false;
|
||||
}
|
||||
|
||||
private void BtnResetToSuggestion_Click(object sender, RoutedEventArgs e)
|
||||
public void BtnResetToSuggestion_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1828,6 +1828,11 @@ namespace Ink_Canvas
|
||||
private void inkCanvas_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (isMouseDown) MouseTouchMove(e.GetPosition(inkCanvas));
|
||||
|
||||
if (Settings.Canvas.IsShowCursor)
|
||||
{
|
||||
SetCursorBasedOnEditingMode(inkCanvas);
|
||||
}
|
||||
}
|
||||
|
||||
private void inkCanvas_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
@@ -2054,13 +2059,21 @@ namespace Ink_Canvas
|
||||
}
|
||||
private void MainWindow_OnMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.StylusDevice == null)
|
||||
if (Settings.Canvas.IsShowCursor)
|
||||
{
|
||||
System.Windows.Forms.Cursor.Show();
|
||||
SetCursorBasedOnEditingMode(inkCanvas);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.Forms.Cursor.Hide();
|
||||
if (e.StylusDevice == null)
|
||||
{
|
||||
System.Windows.Forms.Cursor.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.Forms.Cursor.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1201,14 +1201,59 @@ namespace Ink_Canvas
|
||||
directionY = eigenvalue1 - covXX;
|
||||
// 归一化
|
||||
double length = Math.Sqrt(directionX * directionX + directionY * directionY);
|
||||
directionX /= length;
|
||||
directionY /= length;
|
||||
if (length > 1e-10)
|
||||
{
|
||||
directionX /= length;
|
||||
directionY /= length;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果归一化失败,使用起点和终点计算方向
|
||||
Point start = points.First();
|
||||
Point end = points.Last();
|
||||
double dx = end.X - start.X;
|
||||
double dy = end.Y - start.Y;
|
||||
double lineLength = Math.Sqrt(dx * dx + dy * dy);
|
||||
if (lineLength > 1e-10)
|
||||
{
|
||||
directionX = dx / lineLength;
|
||||
directionY = dy / lineLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
directionX = (covXX >= covYY) ? 1 : 0;
|
||||
directionY = (covXX >= covYY) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果协方差为 0,则是水平或垂直直线
|
||||
directionX = (covXX >= covYY) ? 1 : 0;
|
||||
directionY = (covXX >= covYY) ? 0 : 1;
|
||||
Point start = points.First();
|
||||
Point end = points.Last();
|
||||
double dx = end.X - start.X;
|
||||
double dy = end.Y - start.Y;
|
||||
double lineLength = Math.Sqrt(dx * dx + dy * dy);
|
||||
|
||||
if (lineLength > 1e-10)
|
||||
{
|
||||
directionX = dx / lineLength;
|
||||
directionY = dy / lineLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Math.Abs(eigenvalue1 - covXX) < Math.Abs(eigenvalue1 - covYY))
|
||||
{
|
||||
// 主要方向是 X 轴方向
|
||||
directionX = 1;
|
||||
directionY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 主要方向是 Y 轴方向
|
||||
directionX = 0;
|
||||
directionY = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 计算解释方差比例(拟合优度)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@@ -14,7 +13,6 @@ using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
using WinForms = System.Windows.Forms;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
@@ -59,18 +57,18 @@ namespace Ink_Canvas
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private System.Timers.Timer timerCheckPPT = new System.Timers.Timer();
|
||||
private System.Timers.Timer timerKillProcess = new System.Timers.Timer();
|
||||
private System.Timers.Timer timerCheckAutoFold = new System.Timers.Timer();
|
||||
private Timer timerCheckPPT = new Timer();
|
||||
private Timer timerKillProcess = new Timer();
|
||||
private Timer timerCheckAutoFold = new Timer();
|
||||
private string AvailableLatestVersion;
|
||||
private System.Timers.Timer timerCheckAutoUpdateWithSilence = new System.Timers.Timer();
|
||||
private System.Timers.Timer timerCheckAutoUpdateRetry = new System.Timers.Timer();
|
||||
private Timer timerCheckAutoUpdateWithSilence = new Timer();
|
||||
private Timer timerCheckAutoUpdateRetry = new Timer();
|
||||
private bool isHidingSubPanelsWhenInking; // 避免书写时触发二次关闭二级菜单导致动画不连续
|
||||
private int updateCheckRetryCount = 0;
|
||||
private const int MAX_UPDATE_CHECK_RETRIES = 6;
|
||||
private System.Timers.Timer timerDisplayTime = new System.Timers.Timer();
|
||||
private System.Timers.Timer timerDisplayDate = new System.Timers.Timer();
|
||||
private System.Timers.Timer timerNtpSync = new System.Timers.Timer();
|
||||
private Timer timerDisplayTime = new Timer();
|
||||
private Timer timerDisplayDate = new Timer();
|
||||
private Timer timerNtpSync = new Timer();
|
||||
|
||||
private TimeViewModel nowTimeVM = new TimeViewModel();
|
||||
private DateTime cachedNetworkTime = DateTime.Now;
|
||||
@@ -509,21 +507,251 @@ namespace Ink_Canvas
|
||||
return windowTitle.Length == 0 && windowRect.Height < 500;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用窗口预览模型检测前台窗口是否符合自动收纳要求(仅用于检测,不执行任何操作)
|
||||
/// </summary>
|
||||
/// <returns>如果符合自动收纳要求返回true,否则返回false</returns>
|
||||
private bool CheckShouldAutoFoldByWindowPreview()
|
||||
{
|
||||
if (_windowOverviewModel == null) return false;
|
||||
|
||||
try
|
||||
{
|
||||
// 从窗口预览模型中获取窗口列表(已按ZOrder排序,最上层在前)
|
||||
var windows = _windowOverviewModel.Windows;
|
||||
if (windows == null || windows.Count == 0) return false;
|
||||
|
||||
// 获取前台窗口(ZOrder最小的窗口,即最上层)
|
||||
var foregroundWindow = windows.FirstOrDefault();
|
||||
if (foregroundWindow == null) return false;
|
||||
|
||||
var windowProcessName = foregroundWindow.ProcessName;
|
||||
var windowTitle = foregroundWindow.Title;
|
||||
var windowRect = foregroundWindow.Rect;
|
||||
|
||||
// 检查EasiNote
|
||||
if (windowProcessName == "EasiNote")
|
||||
{
|
||||
if (foregroundWindow.ProcessPath != "Unknown")
|
||||
{
|
||||
try
|
||||
{
|
||||
var versionInfo = FileVersionInfo.GetVersionInfo(foregroundWindow.ProcessPath);
|
||||
string version = versionInfo.FileVersion;
|
||||
string prodName = versionInfo.ProductName;
|
||||
|
||||
if (version.StartsWith("5.") && Settings.Automation.IsAutoFoldInEasiNote)
|
||||
{
|
||||
bool isAnnotationWindow = windowTitle.Length == 0 && windowRect.Height < 500;
|
||||
if (Settings.Automation.IsAutoFoldInEasiNoteIgnoreDesktopAnno && isAnnotationWindow)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (!isAnnotationWindow)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (version.StartsWith("3.") && Settings.Automation.IsAutoFoldInEasiNote3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (prodName.Contains("3C") && Settings.Automation.IsAutoFoldInEasiNote3C &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
// 检查EasiCamera
|
||||
else if (Settings.Automation.IsAutoFoldInEasiCamera && windowProcessName == "EasiCamera" &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查EasiNote5C
|
||||
else if (Settings.Automation.IsAutoFoldInEasiNote5C && windowProcessName == "EasiNote5C" &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查SeewoPinco
|
||||
else if (Settings.Automation.IsAutoFoldInSeewoPincoTeacher &&
|
||||
(windowProcessName == "BoardService" || windowProcessName == "seewoPincoTeacher"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查HiteCamera
|
||||
else if (Settings.Automation.IsAutoFoldInHiteCamera && windowProcessName == "HiteCamera" &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查HiteTouchPro
|
||||
else if (Settings.Automation.IsAutoFoldInHiteTouchPro && windowProcessName == "HiteTouchPro" &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查WxBoardMain
|
||||
else if (Settings.Automation.IsAutoFoldInWxBoardMain && windowProcessName == "WxBoardMain" &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查MSWhiteboard
|
||||
else if (Settings.Automation.IsAutoFoldInMSWhiteboard &&
|
||||
(windowProcessName == "MicrosoftWhiteboard" || windowProcessName == "msedgewebview2"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查OldZyBoard
|
||||
else if (Settings.Automation.IsAutoFoldInOldZyBoard &&
|
||||
(WinTabWindowsChecker.IsWindowExisted("WhiteBoard - DrawingWindow") ||
|
||||
WinTabWindowsChecker.IsWindowExisted("InstantAnnotationWindow")))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查HiteLightBoard
|
||||
else if (Settings.Automation.IsAutoFoldInHiteLightBoard && windowProcessName == "HiteLightBoard" &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查AdmoxWhiteboard
|
||||
else if (Settings.Automation.IsAutoFoldInAdmoxWhiteboard && windowProcessName == "Amdox.WhiteBoard" &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查AdmoxBooth
|
||||
else if (Settings.Automation.IsAutoFoldInAdmoxBooth && windowProcessName == "Amdox.Booth" &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查QPoint
|
||||
else if (Settings.Automation.IsAutoFoldInQPoint && windowProcessName == "QPoint" &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查YiYunVisualPresenter
|
||||
else if (Settings.Automation.IsAutoFoldInYiYunVisualPresenter && windowProcessName == "YiYunVisualPresenter" &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// 检查MaxHubWhiteboard
|
||||
else if (Settings.Automation.IsAutoFoldInMaxHubWhiteboard && windowProcessName == "WhiteBoard" &&
|
||||
WinTabWindowsChecker.IsWindowExisted("白板书写") &&
|
||||
windowRect.Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
windowRect.Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
if (foregroundWindow.ProcessPath != "Unknown")
|
||||
{
|
||||
try
|
||||
{
|
||||
var versionInfo = FileVersionInfo.GetVersionInfo(foregroundWindow.ProcessPath);
|
||||
var version = versionInfo.FileVersion;
|
||||
var prodName = versionInfo.ProductName;
|
||||
if (version.StartsWith("6.") && prodName == "WhiteBoard")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"窗口预览模型检测失败: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void timerCheckAutoFold_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
if (isFloatingBarChangingHideMode) return;
|
||||
try
|
||||
{
|
||||
// 优先使用窗口概览模型进行检测
|
||||
if (_windowOverviewModel != null)
|
||||
bool shouldAutoFold = CheckShouldAutoFoldByWindowPreview();
|
||||
var windowProcessName = ForegroundWindowInfo.ProcessName();
|
||||
var windowTitle = ForegroundWindowInfo.WindowTitle();
|
||||
|
||||
if (shouldAutoFold)
|
||||
{
|
||||
CheckAutoFoldWithWindowOverviewModel();
|
||||
if (windowProcessName == "EasiNote")
|
||||
{
|
||||
if (ForegroundWindowInfo.ProcessPath() != "Unknown")
|
||||
{
|
||||
var versionInfo = FileVersionInfo.GetVersionInfo(ForegroundWindowInfo.ProcessPath());
|
||||
string version = versionInfo.FileVersion;
|
||||
string prodName = versionInfo.ProductName;
|
||||
|
||||
if (version.StartsWith("5.") && Settings.Automation.IsAutoFoldInEasiNote)
|
||||
{
|
||||
bool isAnnotationWindow = windowTitle.Length == 0 && ForegroundWindowInfo.WindowRect().Height < 500;
|
||||
if (Settings.Automation.IsAutoFoldInEasiNoteIgnoreDesktopAnno && isAnnotationWindow)
|
||||
{
|
||||
if (!isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
|
||||
}
|
||||
else if (!isAnnotationWindow)
|
||||
{
|
||||
if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
|
||||
}
|
||||
}
|
||||
else if (version.StartsWith("3.") && Settings.Automation.IsAutoFoldInEasiNote3)
|
||||
{
|
||||
if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
|
||||
}
|
||||
else if (prodName.Contains("3C") && Settings.Automation.IsAutoFoldInEasiNote3C &&
|
||||
ForegroundWindowInfo.WindowRect().Height >= SystemParameters.WorkArea.Height - 16 &&
|
||||
ForegroundWindowInfo.WindowRect().Width >= SystemParameters.WorkArea.Width - 16)
|
||||
{
|
||||
if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 处理其他需要检测批注窗口的情况
|
||||
else if ((Settings.Automation.IsAutoFoldInEasiCamera && windowProcessName == "EasiCamera") ||
|
||||
(Settings.Automation.IsAutoFoldInSeewoPincoTeacher && (windowProcessName == "BoardService" || windowProcessName == "seewoPincoTeacher")) ||
|
||||
(Settings.Automation.IsAutoFoldInHiteCamera && windowProcessName == "HiteCamera") ||
|
||||
(Settings.Automation.IsAutoFoldInHiteTouchPro && windowProcessName == "HiteTouchPro") ||
|
||||
(Settings.Automation.IsAutoFoldInHiteLightBoard && windowProcessName == "HiteLightBoard"))
|
||||
{
|
||||
if (IsAnnotationWindow())
|
||||
{
|
||||
if (!isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
|
||||
}
|
||||
}
|
||||
// 处理其他普通情况
|
||||
else
|
||||
{
|
||||
if (!unfoldFloatingBarByUser && !isFloatingBarFolded) FoldFloatingBar_MouseUp(null, null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果窗口概览模型未初始化,回退到传统的进程检测方式
|
||||
var windowProcessName = ForegroundWindowInfo.ProcessName();
|
||||
var windowTitle = ForegroundWindowInfo.WindowTitle();
|
||||
//LogHelper.WriteLogToFile("windowTitle | " + windowTitle + " | windowProcessName | " + windowProcessName);
|
||||
|
||||
if (windowProcessName == "EasiNote")
|
||||
@@ -742,225 +970,6 @@ namespace Ink_Canvas
|
||||
catch { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查进程是否在用户的自动收纳设置中启用
|
||||
/// </summary>
|
||||
private bool IsProcessInAutoFoldSettings(string processName, WindowInfo windowInfo = null)
|
||||
{
|
||||
// 根据进程名和窗口信息检查是否在自动收纳设置中
|
||||
switch (processName)
|
||||
{
|
||||
case "EasiNote":
|
||||
// EasiNote需要检查版本
|
||||
if (windowInfo != null && !string.IsNullOrEmpty(windowInfo.ProcessPath) && windowInfo.ProcessPath != "Unknown")
|
||||
{
|
||||
try
|
||||
{
|
||||
var versionInfo = FileVersionInfo.GetVersionInfo(windowInfo.ProcessPath);
|
||||
string version = versionInfo.FileVersion;
|
||||
string prodName = versionInfo.ProductName;
|
||||
|
||||
if (version != null && version.StartsWith("5.") && Settings.Automation.IsAutoFoldInEasiNote)
|
||||
return true;
|
||||
if (version != null && version.StartsWith("3.") && Settings.Automation.IsAutoFoldInEasiNote3)
|
||||
return true;
|
||||
if (prodName != null && prodName.Contains("3C") && Settings.Automation.IsAutoFoldInEasiNote3C)
|
||||
return true;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
return false;
|
||||
|
||||
case "EasiCamera":
|
||||
return Settings.Automation.IsAutoFoldInEasiCamera;
|
||||
|
||||
case "EasiNote5C":
|
||||
return Settings.Automation.IsAutoFoldInEasiNote5C;
|
||||
|
||||
case "BoardService":
|
||||
case "seewoPincoTeacher":
|
||||
return Settings.Automation.IsAutoFoldInSeewoPincoTeacher;
|
||||
|
||||
case "HiteCamera":
|
||||
return Settings.Automation.IsAutoFoldInHiteCamera;
|
||||
|
||||
case "HiteTouchPro":
|
||||
return Settings.Automation.IsAutoFoldInHiteTouchPro;
|
||||
|
||||
case "HiteLightBoard":
|
||||
return Settings.Automation.IsAutoFoldInHiteLightBoard;
|
||||
|
||||
case "WxBoardMain":
|
||||
return Settings.Automation.IsAutoFoldInWxBoardMain;
|
||||
|
||||
case "MicrosoftWhiteboard":
|
||||
case "msedgewebview2":
|
||||
return Settings.Automation.IsAutoFoldInMSWhiteboard;
|
||||
|
||||
case "Amdox.WhiteBoard":
|
||||
return Settings.Automation.IsAutoFoldInAdmoxWhiteboard;
|
||||
|
||||
case "Amdox.Booth":
|
||||
return Settings.Automation.IsAutoFoldInAdmoxBooth;
|
||||
|
||||
case "QPoint":
|
||||
return Settings.Automation.IsAutoFoldInQPoint;
|
||||
|
||||
case "YiYunVisualPresenter":
|
||||
return Settings.Automation.IsAutoFoldInYiYunVisualPresenter;
|
||||
|
||||
case "WhiteBoard":
|
||||
// MaxHub需要检查窗口标题
|
||||
if (windowInfo != null && !string.IsNullOrEmpty(windowInfo.Title) &&
|
||||
windowInfo.Title.Contains("白板书写") && Settings.Automation.IsAutoFoldInMaxHubWhiteboard)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(windowInfo.ProcessPath) && windowInfo.ProcessPath != "Unknown")
|
||||
{
|
||||
try
|
||||
{
|
||||
var versionInfo = FileVersionInfo.GetVersionInfo(windowInfo.ProcessPath);
|
||||
if (versionInfo.FileVersion != null && versionInfo.FileVersion.StartsWith("6.") &&
|
||||
versionInfo.ProductName == "WhiteBoard")
|
||||
return true;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用窗口概览模型检测是否需要自动收纳
|
||||
/// </summary>
|
||||
private void CheckAutoFoldWithWindowOverviewModel()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_windowOverviewModel == null) return;
|
||||
|
||||
// 获取浮动栏的位置和大小
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var floatingBarMargin = ViewboxFloatingBar.Margin;
|
||||
var floatingBarWidth = ViewboxFloatingBar.ActualWidth;
|
||||
var floatingBarHeight = ViewboxFloatingBar.ActualHeight;
|
||||
|
||||
// 如果浮动栏未显示或大小为0,跳过检测
|
||||
if (floatingBarWidth <= 0 || floatingBarHeight <= 0) return;
|
||||
|
||||
// 计算浮动栏在屏幕上的位置(考虑DPI缩放)
|
||||
var screen = WinForms.Screen.PrimaryScreen;
|
||||
var dpiScaleX = PresentationSource.FromVisual(this)?.CompositionTarget?.TransformToDevice.M11 ?? 1.0;
|
||||
var dpiScaleY = PresentationSource.FromVisual(this)?.CompositionTarget?.TransformToDevice.M22 ?? 1.0;
|
||||
|
||||
// 将WPF坐标转换为屏幕坐标
|
||||
var point = ViewboxFloatingBar.PointToScreen(new System.Windows.Point(0, 0));
|
||||
int left = (int)(point.X);
|
||||
int top = (int)(point.Y);
|
||||
int right = left + (int)(floatingBarWidth * dpiScaleX);
|
||||
int bottom = top + (int)(floatingBarHeight * dpiScaleY);
|
||||
|
||||
// 创建检测区域(稍微扩大一点,确保检测到覆盖)
|
||||
var detectionArea = new WindowRect
|
||||
{
|
||||
Left = left - 5,
|
||||
Top = top - 5,
|
||||
Right = right + 5,
|
||||
Bottom = bottom + 5
|
||||
};
|
||||
|
||||
// 排除当前应用程序的进程
|
||||
var excludeProcesses = new List<string> { "InkCanvasForClass", "Ink Canvas" };
|
||||
|
||||
// 检查 OldZyBoard(通过窗口标题检测)
|
||||
bool isOldZyBoardWindowExisted = Settings.Automation.IsAutoFoldInOldZyBoard &&
|
||||
(WinTabWindowsChecker.IsWindowExisted("WhiteBoard - DrawingWindow") ||
|
||||
WinTabWindowsChecker.IsWindowExisted("InstantAnnotationWindow"));
|
||||
|
||||
if (isOldZyBoardWindowExisted)
|
||||
{
|
||||
if (!isFloatingBarFolded)
|
||||
{
|
||||
FoldFloatingBar_MouseUp(new object(), null);
|
||||
}
|
||||
}
|
||||
else if (!isOldZyBoardWindowExisted && isFloatingBarFolded && !foldFloatingBarByUser)
|
||||
{
|
||||
// OldZyBoard窗口退出时,如果未开启保持收纳模式,则展开
|
||||
if (!Settings.Automation.KeepFoldAfterSoftwareExit)
|
||||
{
|
||||
UnFoldFloatingBar_MouseUp(new object(), null);
|
||||
}
|
||||
return; // OldZyBoard 使用特殊检测方式,处理完后直接返回
|
||||
}
|
||||
|
||||
if (isOldZyBoardWindowExisted)
|
||||
{
|
||||
return; // OldZyBoard 窗口存在时,直接返回,不继续检测其他窗口
|
||||
}
|
||||
|
||||
// 获取覆盖浮动栏的所有窗口
|
||||
var coveringWindows = _windowOverviewModel.GetCoveringWindows(detectionArea, excludeProcesses, 0.1);
|
||||
|
||||
// 检查是否有覆盖窗口在用户的自动收纳设置中
|
||||
bool shouldFold = false;
|
||||
|
||||
foreach (var window in coveringWindows)
|
||||
{
|
||||
// 检查窗口是否全屏(全屏窗口优先)
|
||||
bool isFullScreen = window.IsFullScreen;
|
||||
|
||||
// 检查窗口大小是否接近全屏(用于检测二级菜单等)
|
||||
bool isNearFullScreen = false;
|
||||
try
|
||||
{
|
||||
var screenBounds = WinForms.Screen.FromHandle(window.Handle).Bounds;
|
||||
isNearFullScreen = window.Rect.Width >= screenBounds.Width - 16 &&
|
||||
window.Rect.Height >= screenBounds.Height - 16;
|
||||
}
|
||||
catch { }
|
||||
|
||||
// 如果窗口是全屏或接近全屏,且进程在自动收纳设置中,则应该收纳
|
||||
if ((isFullScreen || isNearFullScreen) && IsProcessInAutoFoldSettings(window.ProcessName, window))
|
||||
{
|
||||
shouldFold = true;
|
||||
break; // 找到匹配的窗口就退出
|
||||
}
|
||||
}
|
||||
|
||||
// 如果检测到应该收纳的窗口,且当前未收纳,则收纳
|
||||
if (shouldFold && !isFloatingBarFolded)
|
||||
{
|
||||
FoldFloatingBar_MouseUp(new object(), null);
|
||||
}
|
||||
// 如果未检测到应该收纳的窗口,且当前已收纳(且不是用户手动收纳),则展开
|
||||
else if (!shouldFold && isFloatingBarFolded && !foldFloatingBarByUser)
|
||||
{
|
||||
// 检查是否启用了软件退出后保持收纳模式
|
||||
if (!Settings.Automation.KeepFoldAfterSoftwareExit)
|
||||
{
|
||||
UnFoldFloatingBar_MouseUp(new object(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"窗口概览模型检测失败: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"窗口概览模型自动收纳检测异常: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void timerCheckAutoUpdateWithSilence_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
// 停止计时器,避免重复触发
|
||||
@@ -1201,4 +1210,4 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ namespace Ink_Canvas
|
||||
private InkCanvasEditingMode lastInkCanvasEditingMode = InkCanvasEditingMode.Ink;
|
||||
private DateTime lastTouchDownTime = DateTime.MinValue;
|
||||
private const double MULTI_TOUCH_DELAY_MS = 100;
|
||||
private bool isMultiTouchTimerActive = false;
|
||||
|
||||
/// </summary>
|
||||
/// 保存画布上的非笔画元素(如图片、媒体元素等)
|
||||
@@ -289,33 +288,11 @@ namespace Ink_Canvas
|
||||
LogHelper.WriteLogToFile("保持当前线擦模式");
|
||||
}
|
||||
}
|
||||
SetCursorBasedOnEditingMode(inkCanvas);
|
||||
|
||||
inkCanvas.CaptureStylus();
|
||||
ViewboxFloatingBar.IsHitTestVisible = false;
|
||||
BlackboardUIGridForInkReplay.IsHitTestVisible = false;
|
||||
|
||||
// 确保手写笔模式下显示光标
|
||||
if (Settings.Canvas.IsShowCursor)
|
||||
{
|
||||
inkCanvas.ForceCursor = true;
|
||||
inkCanvas.UseCustomCursor = true;
|
||||
|
||||
// 根据当前编辑模式设置不同的光标
|
||||
if (inkCanvas.EditingMode == InkCanvasEditingMode.EraseByPoint)
|
||||
{
|
||||
inkCanvas.Cursor = Cursors.Arrow;
|
||||
}
|
||||
else if (inkCanvas.EditingMode == InkCanvasEditingMode.Ink)
|
||||
{
|
||||
var sri = Application.GetResourceStream(new Uri("Resources/Cursors/Pen.cur", UriKind.Relative));
|
||||
if (sri != null)
|
||||
inkCanvas.Cursor = new Cursor(sri.Stream);
|
||||
}
|
||||
|
||||
// 强制显示光标
|
||||
System.Windows.Forms.Cursor.Show();
|
||||
}
|
||||
SetCursorBasedOnEditingMode(inkCanvas);
|
||||
|
||||
if (inkCanvas.EditingMode == InkCanvasEditingMode.EraseByPoint
|
||||
|| inkCanvas.EditingMode == InkCanvasEditingMode.EraseByStroke
|
||||
@@ -416,6 +393,7 @@ namespace Ink_Canvas
|
||||
inkCanvas.ReleaseStylusCapture();
|
||||
ViewboxFloatingBar.IsHitTestVisible = true;
|
||||
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
|
||||
SetCursorBasedOnEditingMode(inkCanvas);
|
||||
}
|
||||
|
||||
private void MainWindow_StylusMove(object sender, StylusEventArgs e)
|
||||
@@ -439,13 +417,6 @@ namespace Ink_Canvas
|
||||
}
|
||||
catch { }
|
||||
|
||||
// 确保手写笔移动时光标保持可见
|
||||
if (Settings.Canvas.IsShowCursor)
|
||||
{
|
||||
inkCanvas.ForceCursor = true;
|
||||
inkCanvas.UseCustomCursor = true;
|
||||
System.Windows.Forms.Cursor.Show();
|
||||
}
|
||||
|
||||
var strokeVisual = GetStrokeVisual(e.StylusDevice.Id);
|
||||
var stylusPointCollection = e.GetStylusPoints(this);
|
||||
@@ -600,12 +571,6 @@ namespace Ink_Canvas
|
||||
inkCanvas.EditingMode = lastInkCanvasEditingMode;
|
||||
dec.Remove(e.TouchDevice.Id);
|
||||
|
||||
// 重置多触控点定时器状态
|
||||
if (dec.Count <= 1)
|
||||
{
|
||||
isMultiTouchTimerActive = false;
|
||||
}
|
||||
|
||||
if (dec.Count == 0)
|
||||
{
|
||||
isSingleFingerDragMode = false;
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Windows;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("CJK_mkp")]
|
||||
[assembly: AssemblyProduct("InkCanvasForClass")]
|
||||
[assembly: AssemblyCopyright("Copyright © CJK_mkp 2025")]
|
||||
[assembly: AssemblyCopyright("Copyright © CJK_mkp 2025-2026")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -49,5 +49,5 @@ using System.Windows;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.7.18.3")]
|
||||
[assembly: AssemblyFileVersion("1.7.18.3")]
|
||||
[assembly: AssemblyVersion("1.7.18.4")]
|
||||
[assembly: AssemblyFileVersion("1.7.18.4")]
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
<UserControl x:Class="Ink_Canvas.Windows.PPTQuickPanel"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="400" d:DesignWidth="300">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<!-- 展开动画 -->
|
||||
<Storyboard x:Key="ExpandAnimation">
|
||||
<DoubleAnimation Storyboard.TargetName="PanelTransform"
|
||||
Storyboard.TargetProperty="X"
|
||||
Duration="0:0:0.3">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
<CubicEase EasingMode="EaseOut"/>
|
||||
</DoubleAnimation.EasingFunction>
|
||||
</DoubleAnimation>
|
||||
</Storyboard>
|
||||
|
||||
<!-- 折叠动画 -->
|
||||
<Storyboard x:Key="CollapseAnimation">
|
||||
<DoubleAnimation Storyboard.TargetName="PanelTransform"
|
||||
Storyboard.TargetProperty="X"
|
||||
Duration="0:0:0.3">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
<CubicEase EasingMode="EaseOut"/>
|
||||
</DoubleAnimation.EasingFunction>
|
||||
</DoubleAnimation>
|
||||
</Storyboard>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Canvas x:Name="MainCanvas" HorizontalAlignment="Right" VerticalAlignment="Top">
|
||||
<!-- 主面板容器 -->
|
||||
<Grid x:Name="MainPanel" Canvas.Right="0" Canvas.Top="50">
|
||||
<Grid.RenderTransform>
|
||||
<TranslateTransform x:Name="PanelTransform" X="0"/>
|
||||
</Grid.RenderTransform>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="24"/>
|
||||
<ColumnDefinition Width="200"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 左侧圆角矩形 - 箭头按钮区域 -->
|
||||
<Border x:Name="ArrowButtonBorder"
|
||||
Grid.Column="0"
|
||||
CornerRadius="6,0,0,6"
|
||||
Cursor="Hand"
|
||||
MouseLeftButtonDown="ArrowButton_MouseLeftButtonDown"
|
||||
MouseEnter="ArrowButton_MouseEnter"
|
||||
MouseLeave="ArrowButton_MouseLeave">
|
||||
<Border.Background>
|
||||
<SolidColorBrush x:Name="ArrowButtonBackgroundBrush" Color="#CCFFFFFF"/>
|
||||
</Border.Background>
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="6" ShadowDepth="0" Opacity="0.2" Color="Black"/>
|
||||
</Border.Effect>
|
||||
|
||||
<Viewbox Width="12" Height="12" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Path x:Name="ArrowPath"
|
||||
Data="M 0,0 L 12,6 L 0,12 Z"
|
||||
Stretch="Uniform"
|
||||
RenderTransformOrigin="0.5,0.5">
|
||||
<Path.Fill>
|
||||
<SolidColorBrush x:Name="ArrowPathFillBrush" Color="#FF000000"/>
|
||||
</Path.Fill>
|
||||
<Path.RenderTransform>
|
||||
<RotateTransform x:Name="ArrowRotateTransform" Angle="180"/>
|
||||
</Path.RenderTransform>
|
||||
</Path>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
|
||||
<!-- 右侧矩形 - 面板内容区域 -->
|
||||
<Border x:Name="ContentBorder"
|
||||
Grid.Column="1"
|
||||
CornerRadius="0"
|
||||
MouseLeftButtonDown="ContentBorder_MouseLeftButtonDown"
|
||||
MouseMove="ContentBorder_MouseMove"
|
||||
MouseLeftButtonUp="ContentBorder_MouseLeftButtonUp"
|
||||
TouchDown="ContentBorder_TouchDown"
|
||||
TouchMove="ContentBorder_TouchMove"
|
||||
TouchUp="ContentBorder_TouchUp">
|
||||
<Border.Background>
|
||||
<SolidColorBrush x:Name="ContentBackgroundBrush" Color="#CCFFFFFF"/>
|
||||
</Border.Background>
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="8" ShadowDepth="0" Opacity="0.2" Color="Black"/>
|
||||
</Border.Effect>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
|
||||
<StackPanel x:Name="ContentPanel" Margin="10,8" Orientation="Vertical">
|
||||
|
||||
<!-- 系统音量控制区域 -->
|
||||
<Grid Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 左侧音量按钮 -->
|
||||
<Button x:Name="VolumeMuteButton"
|
||||
Grid.Column="0"
|
||||
Width="32" Height="32"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Hand"
|
||||
Click="VolumeMuteButton_Click"
|
||||
Margin="0,0,8,0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center">
|
||||
<Viewbox Width="20" Height="20" Stretch="Uniform">
|
||||
<Grid>
|
||||
<Path x:Name="VolumeIconPath"
|
||||
Data="M 3,9 v 6 h 4 l 5,5 v -16 l -5,5 h -4 z"
|
||||
Stretch="Uniform">
|
||||
<Path.Fill>
|
||||
<SolidColorBrush x:Name="VolumeIconFillBrush" Color="#FF000000"/>
|
||||
</Path.Fill>
|
||||
</Path>
|
||||
<Path x:Name="VolumeIconPath2"
|
||||
Data=""
|
||||
Stretch="Uniform"
|
||||
Opacity="0.5"
|
||||
Visibility="Collapsed">
|
||||
<Path.Fill>
|
||||
<SolidColorBrush x:Name="VolumeIconFillBrush2" Color="#FF000000"/>
|
||||
</Path.Fill>
|
||||
</Path>
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
</Button>
|
||||
|
||||
<!-- 中间音量滑块 -->
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,8,0">
|
||||
<Slider x:Name="VolumeSlider"
|
||||
Minimum="0"
|
||||
Maximum="100"
|
||||
Value="50"
|
||||
TickFrequency="1"
|
||||
IsSnapToTickEnabled="True"
|
||||
ValueChanged="VolumeSlider_ValueChanged"
|
||||
PreviewMouseLeftButtonUp="VolumeSlider_PreviewMouseLeftButtonUp"
|
||||
ManipulationCompleted="VolumeSlider_ManipulationCompleted"/>
|
||||
</Grid>
|
||||
|
||||
<!-- 右侧音量值 -->
|
||||
<TextBlock x:Name="VolumeValueText"
|
||||
Grid.Column="2"
|
||||
Text="50%"
|
||||
FontSize="10"
|
||||
VerticalAlignment="Center"
|
||||
MinWidth="32"
|
||||
TextAlignment="Center">
|
||||
<TextBlock.Foreground>
|
||||
<SolidColorBrush x:Name="VolumeValueForegroundBrush" Color="#80000000"/>
|
||||
</TextBlock.Foreground>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<!-- 分隔线 -->
|
||||
<Separator x:Name="Separator1" Margin="0,0,0,8" Height="1">
|
||||
<Separator.Background>
|
||||
<SolidColorBrush x:Name="Separator1BackgroundBrush" Color="#E0E0E0"/>
|
||||
</Separator.Background>
|
||||
</Separator>
|
||||
|
||||
<!-- 图片插入按钮区域 -->
|
||||
<StackPanel Orientation="Vertical" Margin="0,0,0,8">
|
||||
<!-- 选择文件按钮 -->
|
||||
<Button x:Name="InsertImageSelectFileButton"
|
||||
Content="选择文件"
|
||||
FontSize="11"
|
||||
Height="30"
|
||||
Background="#3b82f6"
|
||||
Foreground="White"
|
||||
BorderThickness="0"
|
||||
Cursor="Hand"
|
||||
Click="InsertImageSelectFileButton_Click"
|
||||
Margin="0,0,0,4">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
|
||||
<!-- 截图插入按钮 -->
|
||||
<Button x:Name="InsertImageScreenshotButton"
|
||||
Content="截图插入"
|
||||
FontSize="11"
|
||||
Height="30"
|
||||
Background="#3b82f6"
|
||||
Foreground="White"
|
||||
BorderThickness="0"
|
||||
Cursor="Hand"
|
||||
Click="InsertImageScreenshotButton_Click"
|
||||
Margin="0,0,0,0">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 聚焦放大镜(暂未设计)- 暂时隐藏 -->
|
||||
<Border x:Name="MagnifierSection" Margin="0,0,0,8" Visibility="Collapsed">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock x:Name="MagnifierTitleText" Text="聚焦放大镜" FontSize="11" FontWeight="Bold" Margin="0,0,0,6">
|
||||
<TextBlock.Foreground>
|
||||
<SolidColorBrush x:Name="MagnifierTitleForegroundBrush" Color="#FF000000"/>
|
||||
</TextBlock.Foreground>
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="MagnifierDescText" Text="功能暂未设计" FontSize="9" FontStyle="Italic">
|
||||
<TextBlock.Foreground>
|
||||
<SolidColorBrush x:Name="MagnifierDescForegroundBrush" Color="#80000000"/>
|
||||
</TextBlock.Foreground>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Canvas>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -70,9 +70,9 @@
|
||||
<Storyboard x:Key="CapsuleExpandAnimation" x:Name="CapsuleExpandStoryboard">
|
||||
<DoubleAnimation Storyboard.TargetName="MainCapsule"
|
||||
Storyboard.TargetProperty="(FrameworkElement.Width)"
|
||||
Duration="0:0:0.3">
|
||||
Duration="0:0:0.6">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
<CubicEase EasingMode="EaseOut"/>
|
||||
<BackEase EasingMode="EaseOut" Amplitude="0.4"/>
|
||||
</DoubleAnimation.EasingFunction>
|
||||
</DoubleAnimation>
|
||||
</Storyboard>
|
||||
@@ -81,9 +81,9 @@
|
||||
<Storyboard x:Key="CapsuleShrinkAnimation" x:Name="CapsuleShrinkStoryboard">
|
||||
<DoubleAnimation Storyboard.TargetName="MainCapsule"
|
||||
Storyboard.TargetProperty="(FrameworkElement.Width)"
|
||||
Duration="0:0:0.3">
|
||||
Duration="0:0:0.8">
|
||||
<DoubleAnimation.EasingFunction>
|
||||
<CubicEase EasingMode="EaseIn"/>
|
||||
<BackEase EasingMode="EaseOut" Amplitude="0.2"/>
|
||||
</DoubleAnimation.EasingFunction>
|
||||
</DoubleAnimation>
|
||||
</Storyboard>
|
||||
|
||||
@@ -19,18 +19,20 @@ namespace Ink_Canvas.Windows
|
||||
/// <summary>
|
||||
/// PPT时间显示胶囊控件
|
||||
/// </summary>
|
||||
public partial class PPTTimeCapsule : UserControl
|
||||
public partial class PPTTimeCapsule : UserControl, IDisposable
|
||||
{
|
||||
private System.Timers.Timer timeUpdateTimer;
|
||||
private System.Timers.Timer countdownUpdateTimer; // 倒计时更新定时器(参考MinimizedTimerControl)
|
||||
private System.Timers.Timer countdownUpdateTimer;
|
||||
private DateTime lastTime = DateTime.MinValue;
|
||||
private TimerControl parentControl; // 父计时器控件引用(参考MinimizedTimerControl)
|
||||
private bool wasTimerRunning = false; // 上次检查时计时器是否运行
|
||||
private TimerControl parentControl;
|
||||
private bool wasTimerRunning = false;
|
||||
private bool isOvertime = false;
|
||||
private Storyboard capsuleExpandStoryboard;
|
||||
private Storyboard capsuleShrinkStoryboard;
|
||||
private Storyboard colonBlinkStoryboard;
|
||||
private double originalCapsuleWidth = 0;
|
||||
private string lastCountdownText = ""; // 上次的倒计时文本,用于检测文本变化
|
||||
private Storyboard currentWidthAnimation; // 当前正在运行的宽度动画
|
||||
|
||||
public PPTTimeCapsule()
|
||||
{
|
||||
@@ -66,15 +68,19 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
|
||||
private void PPTTimeCapsule_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实现 IDisposable
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
StopTimeUpdate();
|
||||
SystemEvents.UserPreferenceChanged -= SystemEvents_UserPreferenceChanged;
|
||||
|
||||
if (countdownUpdateTimer != null)
|
||||
{
|
||||
countdownUpdateTimer.Stop();
|
||||
countdownUpdateTimer.Dispose();
|
||||
}
|
||||
timeUpdateTimer?.Dispose();
|
||||
countdownUpdateTimer?.Dispose();
|
||||
}
|
||||
|
||||
private void InitializeTimers()
|
||||
@@ -84,7 +90,7 @@ namespace Ink_Canvas.Windows
|
||||
timeUpdateTimer.Elapsed += TimeUpdateTimer_Elapsed;
|
||||
|
||||
// 倒计时更新定时器
|
||||
countdownUpdateTimer = new System.Timers.Timer(100);
|
||||
countdownUpdateTimer = new System.Timers.Timer(250);
|
||||
countdownUpdateTimer.Elapsed += CountdownUpdateTimer_Elapsed;
|
||||
}
|
||||
|
||||
@@ -312,7 +318,7 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
if (parentControl == null) return;
|
||||
|
||||
// 检查计时器是否正在运行(参考MinimizedTimerControl)
|
||||
// 检查计时器是否正在运行
|
||||
bool isRunning = parentControl.IsTimerRunning;
|
||||
|
||||
// 如果状态改变,更新UI
|
||||
@@ -325,6 +331,7 @@ namespace Ink_Canvas.Windows
|
||||
CountdownPanel.Visibility = Visibility.Visible;
|
||||
// 确保倒计时文本使用主题颜色
|
||||
ApplyTheme();
|
||||
UpdateCountdownText();
|
||||
PlayCapsuleExpandAnimation();
|
||||
}
|
||||
else
|
||||
@@ -355,9 +362,35 @@ namespace Ink_Canvas.Windows
|
||||
|
||||
var timeSpan = remainingTime.Value;
|
||||
bool isOvertimeMode = timeSpan.TotalSeconds < 0;
|
||||
|
||||
|
||||
// 更新倒计时文本
|
||||
UpdateCountdownText(timeSpan, isOvertimeMode);
|
||||
|
||||
// 根据文本内容动态调整胶囊宽度
|
||||
AdjustCapsuleWidthToContent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新倒计时文本内容
|
||||
/// </summary>
|
||||
private void UpdateCountdownText(TimeSpan? timeSpan = null, bool? isOvertimeMode = null)
|
||||
{
|
||||
if (CountdownText == null || parentControl == null) return;
|
||||
|
||||
if (!timeSpan.HasValue)
|
||||
{
|
||||
var remainingTime = parentControl.GetRemainingTime();
|
||||
if (!remainingTime.HasValue) return;
|
||||
timeSpan = remainingTime.Value;
|
||||
}
|
||||
|
||||
if (!isOvertimeMode.HasValue)
|
||||
{
|
||||
isOvertimeMode = timeSpan.Value.TotalSeconds < 0;
|
||||
}
|
||||
|
||||
// 处理超时状态
|
||||
if (isOvertimeMode)
|
||||
if (isOvertimeMode.Value)
|
||||
{
|
||||
if (!isOvertime)
|
||||
{
|
||||
@@ -373,7 +406,7 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
|
||||
// 显示超时时间
|
||||
var overtimeSpan = -timeSpan;
|
||||
var overtimeSpan = -timeSpan.Value;
|
||||
if (overtimeSpan.TotalHours >= 1)
|
||||
{
|
||||
int hours = (int)overtimeSpan.TotalHours;
|
||||
@@ -412,17 +445,91 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
}
|
||||
|
||||
if (timeSpan.TotalHours >= 1)
|
||||
if (timeSpan.Value.TotalHours >= 1)
|
||||
{
|
||||
int hours = (int)timeSpan.TotalHours;
|
||||
CountdownText.Text = $"{hours:D2}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}";
|
||||
int hours = (int)timeSpan.Value.TotalHours;
|
||||
CountdownText.Text = $"{hours:D2}:{timeSpan.Value.Minutes:D2}:{timeSpan.Value.Seconds:D2}";
|
||||
}
|
||||
else
|
||||
{
|
||||
CountdownText.Text = $"{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}";
|
||||
CountdownText.Text = $"{timeSpan.Value.Minutes:D2}:{timeSpan.Value.Seconds:D2}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据内容动态调整胶囊宽度
|
||||
/// </summary>
|
||||
private void AdjustCapsuleWidthToContent()
|
||||
{
|
||||
if (MainCapsule == null || !wasTimerRunning || CountdownText == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
// 检查文本是否改变(格式变化可能导致宽度变化)
|
||||
string currentText = CountdownText.Text;
|
||||
if (currentText == lastCountdownText)
|
||||
{
|
||||
// 文本未改变,不需要调整
|
||||
return;
|
||||
}
|
||||
|
||||
lastCountdownText = currentText;
|
||||
|
||||
double currentWidth = MainCapsule.ActualWidth;
|
||||
double targetWidth = CalculateTargetWidth();
|
||||
|
||||
// 如果当前宽度与目标宽度差异较大(超过2像素),则调整
|
||||
if (Math.Abs(currentWidth - targetWidth) > 2)
|
||||
{
|
||||
// 停止当前动画
|
||||
if (currentWidthAnimation != null)
|
||||
{
|
||||
currentWidthAnimation.Stop();
|
||||
currentWidthAnimation = null;
|
||||
}
|
||||
if (capsuleExpandStoryboard != null)
|
||||
{
|
||||
capsuleExpandStoryboard.Stop();
|
||||
}
|
||||
if (capsuleShrinkStoryboard != null)
|
||||
{
|
||||
capsuleShrinkStoryboard.Stop();
|
||||
}
|
||||
|
||||
// 创建新的动画
|
||||
var animation = new DoubleAnimation
|
||||
{
|
||||
From = currentWidth,
|
||||
To = targetWidth,
|
||||
Duration = new Duration(TimeSpan.FromMilliseconds(targetWidth > currentWidth ? 600 : 800)),
|
||||
EasingFunction = targetWidth > currentWidth
|
||||
? new BackEase { EasingMode = EasingMode.EaseOut, Amplitude = 0.4 }
|
||||
: new BackEase { EasingMode = EasingMode.EaseOut, Amplitude = 0.2 }
|
||||
};
|
||||
|
||||
var storyboard = new Storyboard();
|
||||
Storyboard.SetTarget(animation, MainCapsule);
|
||||
Storyboard.SetTargetProperty(animation, new PropertyPath(FrameworkElement.WidthProperty));
|
||||
storyboard.Children.Add(animation);
|
||||
currentWidthAnimation = storyboard;
|
||||
storyboard.Begin();
|
||||
|
||||
storyboard.Completed += (o, args) =>
|
||||
{
|
||||
storyboard.Remove();
|
||||
if (currentWidthAnimation == storyboard)
|
||||
{
|
||||
currentWidthAnimation = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"调整胶囊宽度失败: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayCapsuleExpandAnimation()
|
||||
{
|
||||
@@ -436,8 +543,15 @@ namespace Ink_Canvas.Windows
|
||||
originalCapsuleWidth = MainCapsule.ActualWidth > 0 ? MainCapsule.ActualWidth : 120;
|
||||
}
|
||||
|
||||
// 计算目标宽度(根据倒计时文本长度估算)
|
||||
double targetWidth = originalCapsuleWidth + 80; // 增加约80像素用于显示倒计时
|
||||
// 停止当前动画
|
||||
if (currentWidthAnimation != null)
|
||||
{
|
||||
currentWidthAnimation.Stop();
|
||||
currentWidthAnimation = null;
|
||||
}
|
||||
|
||||
// 根据倒计时文本的实际宽度动态计算目标宽度
|
||||
double targetWidth = CalculateTargetWidth();
|
||||
|
||||
if (capsuleExpandStoryboard == null)
|
||||
{
|
||||
@@ -450,7 +564,7 @@ namespace Ink_Canvas.Windows
|
||||
var animation = capsuleExpandStoryboard.Children[0] as DoubleAnimation;
|
||||
if (animation != null)
|
||||
{
|
||||
animation.From = originalCapsuleWidth;
|
||||
animation.From = MainCapsule.ActualWidth;
|
||||
animation.To = targetWidth;
|
||||
}
|
||||
|
||||
@@ -464,12 +578,52 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据倒计时文本的实际宽度计算目标宽度
|
||||
/// </summary>
|
||||
private double CalculateTargetWidth()
|
||||
{
|
||||
if (CountdownText == null || TimeDisplayPanel == null)
|
||||
{
|
||||
// 如果倒计时文本不可用,使用估算值
|
||||
return originalCapsuleWidth + 80;
|
||||
}
|
||||
|
||||
// 测量倒计时文本的实际宽度
|
||||
CountdownText.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||
double countdownTextWidth = CountdownText.DesiredSize.Width;
|
||||
|
||||
// 测量时间显示面板的宽度
|
||||
TimeDisplayPanel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||
double timeDisplayWidth = TimeDisplayPanel.DesiredSize.Width;
|
||||
|
||||
double targetWidth = timeDisplayWidth + countdownTextWidth + 8 + 32;
|
||||
|
||||
// 确保最小宽度不小于原始宽度
|
||||
if (targetWidth < originalCapsuleWidth)
|
||||
{
|
||||
targetWidth = originalCapsuleWidth;
|
||||
}
|
||||
|
||||
return targetWidth;
|
||||
}
|
||||
|
||||
private void PlayCapsuleShrinkAnimation()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MainCapsule != null && originalCapsuleWidth > 0)
|
||||
{
|
||||
// 停止当前动画
|
||||
if (currentWidthAnimation != null)
|
||||
{
|
||||
currentWidthAnimation.Stop();
|
||||
currentWidthAnimation = null;
|
||||
}
|
||||
|
||||
// 重置文本跟踪
|
||||
lastCountdownText = "";
|
||||
|
||||
if (capsuleShrinkStoryboard == null)
|
||||
{
|
||||
capsuleShrinkStoryboard = (Storyboard)Resources["CapsuleShrinkAnimation"];
|
||||
@@ -583,9 +737,37 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
try
|
||||
{
|
||||
// 检测系统主题
|
||||
bool isDarkTheme = IsDarkTheme();
|
||||
|
||||
if (MainWindow.Settings != null)
|
||||
{
|
||||
ApplyTheme(MainWindow.Settings);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"应用PPT时间胶囊主题失败: {ex.Message}", LogHelper.LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyTheme(Settings settings)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isDarkTheme = false;
|
||||
|
||||
if (settings.Appearance.Theme == 0) // 浅色主题
|
||||
{
|
||||
isDarkTheme = false;
|
||||
}
|
||||
else if (settings.Appearance.Theme == 1) // 深色主题
|
||||
{
|
||||
isDarkTheme = true;
|
||||
}
|
||||
else // 跟随系统主题
|
||||
{
|
||||
bool isSystemLight = IsSystemThemeLight();
|
||||
isDarkTheme = !isSystemLight;
|
||||
}
|
||||
|
||||
if (isDarkTheme)
|
||||
{
|
||||
// 深色主题:使用80%不透明度的深色背景
|
||||
@@ -615,45 +797,29 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsDarkTheme()
|
||||
private bool IsSystemThemeLight()
|
||||
{
|
||||
var light = false;
|
||||
try
|
||||
{
|
||||
string settingsPath = Path.Combine(App.RootPath, "Configs", "Settings.json");
|
||||
if (File.Exists(settingsPath))
|
||||
var registryKey = Microsoft.Win32.Registry.CurrentUser;
|
||||
var themeKey = registryKey.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
||||
if (themeKey != null)
|
||||
{
|
||||
string jsonText = File.ReadAllText(settingsPath);
|
||||
var settings = JsonConvert.DeserializeObject<Settings>(jsonText);
|
||||
|
||||
if (settings?.Appearance != null)
|
||||
var value = themeKey.GetValue("AppsUseLightTheme");
|
||||
if (value != null)
|
||||
{
|
||||
if (settings.Appearance.Theme == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (settings.Appearance.Theme == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int systemTheme = (int)Microsoft.Win32.Registry.GetValue(
|
||||
@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
|
||||
"AppsUseLightTheme", 1);
|
||||
return systemTheme == 0;
|
||||
}
|
||||
light = (int)value == 1;
|
||||
}
|
||||
themeKey.Close();
|
||||
}
|
||||
|
||||
int fallbackTheme = (int)Microsoft.Win32.Registry.GetValue(
|
||||
@"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
|
||||
"AppsUseLightTheme", 1);
|
||||
return fallbackTheme == 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
// 如果读取注册表失败,默认为浅色主题
|
||||
light = true;
|
||||
}
|
||||
return light;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -222,7 +222,6 @@ namespace Ink_Canvas
|
||||
{
|
||||
animationPool.Add(num);
|
||||
}
|
||||
int lastDisplayedIndex = -1;
|
||||
|
||||
for (int i = 0; i < RandWaitingTimes; i++)
|
||||
{
|
||||
|
||||
@@ -73,8 +73,8 @@
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#9a9996" FontSize="12" Margin="0,0,0,3" Text="用户版权信息" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="2024 孙笑川一中 高2026级114班" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="12" Margin="0,0,0,3" Text="设备ID" HorizontalAlignment="Left"/>
|
||||
<TextBlock Name="AboutDeviceID" Foreground="#2e3436" FontSize="14.5" Text="正在获取..." HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
@@ -84,8 +84,8 @@
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="软件版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
|
||||
<TextBlock Foreground="#878787" FontSize="14.5" Text="InkCanvasForClass v2024.8.30" VerticalAlignment="Center" />
|
||||
<Image Margin="12,0,0,0" Width="18" Height="18" VerticalAlignment="Center">
|
||||
<TextBlock Name="AboutAppVersion" Foreground="#878787" FontSize="14.5" Text="InkCanvasForClass v1.7.18.4" VerticalAlignment="Center" />
|
||||
<Image Name="UpdateAvailableIcon" Margin="12,0,0,0" Width="18" Height="18" VerticalAlignment="Center" Visibility="Collapsed">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
@@ -113,13 +113,13 @@
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="包体构建版本" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="构建时间" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<TextBlock Name="AboutBuildTime" Foreground="#878787" FontSize="14.5" Text="2024.8.22" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="版权信息" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<TextBlock Foreground="#878787" FontSize="14.5" Text="© Copyright 2024 Dubi906w 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
|
||||
<TextBlock Name="AboutCopyright" Foreground="#878787" FontSize="14.5" Text="正在获取..." VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,18,0"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
@@ -128,7 +128,7 @@
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="ICC 官方网站" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
|
||||
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="icc.bliemhax.com" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<TextBlock Name="LinkOfficialWebsite" Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="inkcanvasforclass.github.io" VerticalAlignment="Center" HorizontalAlignment="Right" Cursor="Hand" MouseLeftButtonDown="LinkOfficialWebsite_MouseLeftButtonDown"/>
|
||||
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
@@ -146,7 +146,7 @@
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="Github 仓库" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
|
||||
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="github.com/InkCanvas/InkCanvasForClass" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<TextBlock Name="LinkGithubRepo" Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="github.com/InkCanvasForClass/community" VerticalAlignment="Center" HorizontalAlignment="Right" Cursor="Hand" MouseLeftButtonDown="LinkGithubRepo_MouseLeftButtonDown"/>
|
||||
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
@@ -164,7 +164,7 @@
|
||||
<Grid Height="54">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="贡献者名单" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
|
||||
<TextBlock Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="icc.bliemhax.com/contributors" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
<TextBlock Name="LinkContributors" Foreground="#1d4ed8" TextDecorations="Underline" FontSize="14.5" Text="github.com/InkCanvasForClass/community#贡献者" VerticalAlignment="Center" HorizontalAlignment="Right" Cursor="Hand" MouseLeftButtonDown="LinkContributors_MouseLeftButtonDown"/>
|
||||
<Image Margin="12,0,0,0" Width="16" Height="16" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
@@ -181,7 +181,7 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<StackPanel Orientation="Vertical" Margin="0,16,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontWeight="Bold" FontSize="12" Text="© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,15,0"/>
|
||||
<TextBlock Name="AboutBottomCopyright" Foreground="#2e3436" FontWeight="Bold" FontSize="12" Text="正在获取..." VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,15,0"/>
|
||||
<TextBlock Foreground="#878787" Width="356" FlowDirection="RightToLeft" TextWrapping="Wrap" FontSize="12" Text="ICC 的部分元素设计参考来源于:© iNKORE! 名下产品 Inkways,已经过授权使用,最终解释权归 Yoojun Zhou 所有" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
|
||||
<TextBlock Foreground="#878787" FontWeight="Bold" Width="276" FlowDirection="RightToLeft" TextWrapping="Wrap" FontSize="12" Text="ICC 使用了 iNKORE! 开发的 UI 组件库:iNKORE.UI.WPF.Modern" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,6,15,0"/>
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using Ink_Canvas.Helpers;
|
||||
using OSVersionExtension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Management;
|
||||
using System.Reflection;
|
||||
@@ -14,6 +16,7 @@ using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -42,32 +45,135 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
CopyrightBannerImage.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 关于页面构建时间
|
||||
var buildTime = FileBuildTimeHelper.GetBuildDateTime(Assembly.GetExecutingAssembly());
|
||||
if (buildTime != null)
|
||||
try
|
||||
{
|
||||
var bt = ((DateTimeOffset)buildTime).LocalDateTime;
|
||||
var m = bt.Month.ToString().PadLeft(2, '0');
|
||||
var d = bt.Day.ToString().PadLeft(2, '0');
|
||||
var h = bt.Hour.ToString().PadLeft(2, '0');
|
||||
var min = bt.Minute.ToString().PadLeft(2, '0');
|
||||
var s = bt.Second.ToString().PadLeft(2, '0');
|
||||
AboutBuildTime.Text =
|
||||
$"build-{bt.Year}-{m}-{d}-{h}:{min}:{s}";
|
||||
var version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
AboutAppVersion.Text = $"InkCanvasForClass v{version}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AboutAppVersion.Text = "InkCanvasForClass v未知";
|
||||
System.Diagnostics.Debug.WriteLine($"获取软件版本失败: {ex.Message}");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string deviceId = DeviceIdentifier.GetDeviceId();
|
||||
AboutDeviceID.Text = deviceId;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AboutDeviceID.Text = "获取失败";
|
||||
System.Diagnostics.Debug.WriteLine($"获取设备ID失败: {ex.Message}");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var copyright = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyCopyrightAttribute>();
|
||||
if (copyright != null && !string.IsNullOrEmpty(copyright.Copyright))
|
||||
{
|
||||
var copyrightText = copyright.Copyright;
|
||||
AboutCopyright.Text = copyrightText;
|
||||
AboutBottomCopyright.Text = copyrightText.Replace("Copyright ©", "© Copyright") + " 所有";
|
||||
}
|
||||
else
|
||||
{
|
||||
AboutCopyright.Text = "© Copyright 2024 Dubi906w 所有";
|
||||
AboutBottomCopyright.Text = "© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AboutCopyright.Text = "© Copyright 2024 Dubi906w 所有";
|
||||
AboutBottomCopyright.Text = "© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有";
|
||||
System.Diagnostics.Debug.WriteLine($"获取版权信息失败: {ex.Message}");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var filePath = assembly.Location;
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
var bt = File.GetCreationTime(filePath);
|
||||
var m = bt.Month.ToString().PadLeft(2, '0');
|
||||
var d = bt.Day.ToString().PadLeft(2, '0');
|
||||
var h = bt.Hour.ToString().PadLeft(2, '0');
|
||||
var min = bt.Minute.ToString().PadLeft(2, '0');
|
||||
var s = bt.Second.ToString().PadLeft(2, '0');
|
||||
AboutBuildTime.Text = $"{bt.Year}-{m}-{d} {h}:{min}:{s}";
|
||||
}
|
||||
else
|
||||
{
|
||||
AboutBuildTime.Text = "获取失败";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AboutBuildTime.Text = "获取失败";
|
||||
System.Diagnostics.Debug.WriteLine($"获取构建时间失败: {ex.Message}");
|
||||
}
|
||||
|
||||
// 关于页面系统版本
|
||||
AboutSystemVersion.Text = $"{OSVersion.GetOperatingSystem()} {OSVersion.GetOSVersion().Version}";
|
||||
|
||||
// 关于页面触摸设备
|
||||
var _t_touch = new Thread(() =>
|
||||
{
|
||||
var touchcount = TouchTabletDetectHelper.GetTouchTabletDevices().Count;
|
||||
var support = TouchTabletDetectHelper.IsTouchEnabled();
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
AboutTouchTabletText.Text = $"{touchcount}个设备,{(support ? "支持触摸设备" : "无触摸支持")}");
|
||||
try
|
||||
{
|
||||
var support = TouchTabletDetectHelper.IsTouchEnabled();
|
||||
var touchcount = TouchTabletDetectHelper.GetTouchTabletDevices().Count;
|
||||
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (support)
|
||||
{
|
||||
if (touchcount > 0)
|
||||
{
|
||||
AboutTouchTabletText.Text = $"{touchcount}个设备,支持触摸设备";
|
||||
}
|
||||
else
|
||||
{
|
||||
AboutTouchTabletText.Text = "支持触摸设备";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AboutTouchTabletText.Text = "无触摸支持";
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
AboutTouchTabletText.Text = "检测失败");
|
||||
System.Diagnostics.Debug.WriteLine($"检测触摸设备失败: {ex.Message}");
|
||||
}
|
||||
});
|
||||
_t_touch.Start();
|
||||
|
||||
CheckUpdateStatus();
|
||||
}
|
||||
|
||||
private void CheckUpdateStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var field = typeof(MainWindow).GetField("AvailableLatestVersion", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (field != null)
|
||||
{
|
||||
var availableVersion = field.GetValue(mainWindow) as string;
|
||||
if (!string.IsNullOrEmpty(availableVersion))
|
||||
{
|
||||
UpdateAvailableIcon.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static class TouchTabletDetectHelper
|
||||
@@ -100,22 +206,51 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
List<USBDeviceInfo> devices = new List<USBDeviceInfo>();
|
||||
|
||||
ManagementObjectCollection collection;
|
||||
using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_PnPEntity"))
|
||||
collection = searcher.Get();
|
||||
|
||||
foreach (var device in collection)
|
||||
try
|
||||
{
|
||||
var name = new StringBuilder((string)device.GetPropertyValue("Name")).ToString();
|
||||
if (!name.Contains("Pentablet")) continue;
|
||||
devices.Add(new USBDeviceInfo(
|
||||
(string)device.GetPropertyValue("DeviceID"),
|
||||
(string)device.GetPropertyValue("PNPDeviceID"),
|
||||
(string)device.GetPropertyValue("Description")
|
||||
));
|
||||
ManagementObjectCollection collection;
|
||||
using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_PnPEntity"))
|
||||
collection = searcher.Get();
|
||||
|
||||
foreach (var device in collection)
|
||||
{
|
||||
try
|
||||
{
|
||||
var name = device.GetPropertyValue("Name")?.ToString() ?? "";
|
||||
var description = device.GetPropertyValue("Description")?.ToString() ?? "";
|
||||
|
||||
if (string.IsNullOrEmpty(name)) continue;
|
||||
|
||||
var nameLower = name.ToLower();
|
||||
var descLower = description.ToLower();
|
||||
|
||||
if (nameLower.Contains("pentablet") ||
|
||||
nameLower.Contains("tablet") ||
|
||||
nameLower.Contains("touch") ||
|
||||
nameLower.Contains("digitizer") ||
|
||||
descLower.Contains("touch") ||
|
||||
descLower.Contains("digitizer"))
|
||||
{
|
||||
devices.Add(new USBDeviceInfo(
|
||||
device.GetPropertyValue("DeviceID")?.ToString() ?? "",
|
||||
device.GetPropertyValue("PNPDeviceID")?.ToString() ?? "",
|
||||
description
|
||||
));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
collection.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"获取触摸设备列表失败: {ex.Message}");
|
||||
}
|
||||
|
||||
collection.Dispose();
|
||||
return devices;
|
||||
}
|
||||
}
|
||||
@@ -135,30 +270,48 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
|
||||
public static DateTimeOffset? GetBuildDateTime(Assembly assembly)
|
||||
{
|
||||
var path = assembly.Location;
|
||||
if (File.Exists(path))
|
||||
try
|
||||
{
|
||||
var buffer = new byte[Math.Max(Marshal.SizeOf(typeof(_IMAGE_FILE_HEADER)), 4)];
|
||||
using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
|
||||
var path = assembly.Location;
|
||||
if (string.IsNullOrEmpty(path) || !File.Exists(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
{
|
||||
var peHeader = new byte[4];
|
||||
fileStream.Position = 0x3C;
|
||||
fileStream.Read(buffer, 0, 4);
|
||||
fileStream.Position = BitConverter.ToUInt32(buffer, 0); // COFF header offset
|
||||
fileStream.Read(buffer, 0, 4); // "PE\0\0"
|
||||
fileStream.Read(buffer, 0, buffer.Length);
|
||||
}
|
||||
var pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
|
||||
try
|
||||
{
|
||||
var coffHeader = (_IMAGE_FILE_HEADER)Marshal.PtrToStructure(pinnedBuffer.AddrOfPinnedObject(), typeof(_IMAGE_FILE_HEADER));
|
||||
return DateTimeOffset.FromUnixTimeSeconds(coffHeader.TimeDateStamp);
|
||||
}
|
||||
finally
|
||||
{
|
||||
pinnedBuffer.Free();
|
||||
fileStream.Read(peHeader, 0, 4);
|
||||
var peHeaderOffset = BitConverter.ToUInt32(peHeader, 0);
|
||||
|
||||
fileStream.Position = peHeaderOffset;
|
||||
var signature = new byte[4];
|
||||
fileStream.Read(signature, 0, 4);
|
||||
|
||||
if (signature[0] != 0x50 || signature[1] != 0x45 || signature[2] != 0x00 || signature[3] != 0x00)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var fileHeader = new byte[Marshal.SizeOf(typeof(_IMAGE_FILE_HEADER))];
|
||||
fileStream.Read(fileHeader, 0, fileHeader.Length);
|
||||
|
||||
var pinnedBuffer = GCHandle.Alloc(fileHeader, GCHandleType.Pinned);
|
||||
try
|
||||
{
|
||||
var coffHeader = (_IMAGE_FILE_HEADER)Marshal.PtrToStructure(pinnedBuffer.AddrOfPinnedObject(), typeof(_IMAGE_FILE_HEADER));
|
||||
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
var buildTime = epoch.AddSeconds(coffHeader.TimeDateStamp);
|
||||
return new DateTimeOffset(buildTime.ToLocalTime());
|
||||
}
|
||||
finally
|
||||
{
|
||||
pinnedBuffer.Free();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -259,5 +412,69 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = thumb.Template.FindName("ScrollbarThumbEx", thumb);
|
||||
((Border)border).Background = new SolidColorBrush(Color.FromRgb(138, 138, 138));
|
||||
}
|
||||
|
||||
|
||||
private void LinkOfficialWebsite_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "https://inkcanvasforclass.github.io",
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"打开官方网站失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void LinkGithubRepo_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "https://github.com/InkCanvasForClass/community",
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"打开GitHub仓库失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void LinkContributors_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "https://github.com/InkCanvasForClass/community#贡献者",
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"打开贡献者名单失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AboutPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,641 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<!-- 特殊屏幕和触摸设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="可在手指触摸画板时显示圆形橡皮或手掌触摸画板时显示的橡皮比手掌大很多时调整"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="特殊屏幕模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用特殊屏幕模式以优化触摸体验" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsSpecialScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsSpecialScreen" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="触摸倍数" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整触摸大小的倍数" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="TouchMultiplierSlider" Width="150" Minimum="0" Maximum="2" Value="0.3" TickFrequency="0.01" IsSnapToTickEnabled="True" ValueChanged="TouchMultiplierSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="TouchMultiplierText" Text="0.30" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="橡皮擦绑定触摸大小倍数" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="橡皮擦大小与触摸大小倍数绑定" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEraserBindTouchMultiplier" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EraserBindTouchMultiplier" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="笔尖模式 BoundsWidth" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="笔尖模式的接触面积区分界限" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="NibModeBoundsWidthSlider" Width="150" Minimum="1" Maximum="50" Value="5" TickFrequency="1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="NibModeBoundsWidthText" Text="5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="手指模式 BoundsWidth" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="手指模式的接触面积区分界限" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="FingerModeBoundsWidthSlider" Width="150" Minimum="1" Maximum="50" Value="20" TickFrequency="1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="FingerModeBoundsWidthText" Text="20" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="四边红外模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用四边红外触摸屏模式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsQuadIR" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 日志和系统设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="记录日志" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用日志记录功能" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsLogEnabled" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="日志以日期保存" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="日志文件超过 512 KB 时会自动删除。开启日期保存后,日志将保存在Logs文件夹中,当文件夹大小超过5MB时自动清空" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsSaveLogByDate" Grid.Column="1" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" VerticalAlignment="Top" Margin="0,8,15,8">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="关闭软件时二次弹窗确认" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="关闭软件时显示确认对话框" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsSecondConfimeWhenShutdownApp" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 实验性功能 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="实验性选项" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Border Height="20" CornerRadius="3" Background="#7f1d1d" Padding="4,0" Margin="0,0,12,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="15" Height="15" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#fca5a5"
|
||||
Geometry="F1 M24,24z M0,0z M20.1758,20.0951L15.1058,9.97512C15.0358,9.83512,14.9958,9.68512,14.9958,9.52512L14.9958,2.99512 15.4958,2.99512C16.0458,2.99512 16.4958,2.54512 16.4958,1.99512 16.4958,1.44512 16.0458,0.995117 15.4958,0.995117L8.49582,0.995117C7.94582,0.995117 7.49582,1.44512 7.49582,1.99512 7.49582,2.54512 7.94582,2.99512 8.49582,2.99512L8.99582,2.99512 8.99582,9.52512C8.99582,9.67512,8.95582,9.83512,8.89582,9.97512L3.82582,20.0951C3.67582,20.4051 3.59582,20.7451 3.61582,21.0851 3.62582,21.4251 3.73582,21.7651 3.91582,22.0551 4.09582,22.3451 4.34582,22.5851 4.64582,22.7551 4.94582,22.9151 5.27582,23.0051 5.60582,23.0051L18.3758,23.0051C18.7558,23.0051 19.0558,22.9251 19.3558,22.7551 19.6558,22.5851 19.9058,22.3451 20.0858,22.0551 20.2658,21.7651 20.3658,21.4351 20.3858,21.0851 20.3958,20.7451 20.3258,20.4051 20.1758,20.1051L20.1758,20.0951z M10.6858,10.8651C10.8958,10.4451,11.0058,9.98512,11.0058,9.52512L11.0058,2.99512 13.0058,2.99512 13.0058,9.52512C13.0058,9.98512,13.1158,10.4551,13.3258,10.8651L15.3858,14.9951 8.62582,14.9951 10.6958,10.8651 10.6858,10.8651z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<TextBlock Foreground="#fca5a5" Text="实验性选项" FontSize="12" VerticalAlignment="Center" Margin="4,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用FullScreenHelper" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableFullScreenHelper" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock Text="感谢lindexi大佬提供的FullScreenHelper,可以减少任务栏弹出的问题,且支持多显示器自动全屏"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Border Height="20" CornerRadius="3" Background="#7f1d1d" Padding="4,0" Margin="0,0,12,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="15" Height="15" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#fca5a5"
|
||||
Geometry="F1 M24,24z M0,0z M20.1758,20.0951L15.1058,9.97512C15.0358,9.83512,14.9958,9.68512,14.9958,9.52512L14.9958,2.99512 15.4958,2.99512C16.0458,2.99512 16.4958,2.54512 16.4958,1.99512 16.4958,1.44512 16.0458,0.995117 15.4958,0.995117L8.49582,0.995117C7.94582,0.995117 7.49582,1.44512 7.49582,1.99512 7.49582,2.54512 7.94582,2.99512 8.49582,2.99512L8.99582,2.99512 8.99582,9.52512C8.99582,9.67512,8.95582,9.83512,8.89582,9.97512L3.82582,20.0951C3.67582,20.4051 3.59582,20.7451 3.61582,21.0851 3.62582,21.4251 3.73582,21.7651 3.91582,22.0551 4.09582,22.3451 4.34582,22.5851 4.64582,22.7551 4.94582,22.9151 5.27582,23.0051 5.60582,23.0051L18.3758,23.0051C18.7558,23.0051 19.0558,22.9251 19.3558,22.7551 19.6558,22.5851 19.9058,22.3451 20.0858,22.0551 20.2658,21.7651 20.3658,21.4351 20.3858,21.0851 20.3958,20.7451 20.3258,20.4051 20.1758,20.1051L20.1758,20.0951z M10.6858,10.8651C10.8958,10.4451,11.0058,9.98512,11.0058,9.52512L11.0058,2.99512 13.0058,2.99512 13.0058,9.52512C13.0058,9.98512,13.1158,10.4551,13.3258,10.8651L15.3858,14.9951 8.62582,14.9951 10.6958,10.8651 10.6858,10.8651z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<TextBlock Foreground="#fca5a5" Text="实验性选项" FontSize="12" VerticalAlignment="Center" Margin="4,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用AvoidFullScreenHelper" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableAvoidFullScreenHelper" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock Text="避免画布全屏,可解决开启dock栏软件后浮动工具栏偏高的问题"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Border Height="20" CornerRadius="3" Background="#7f1d1d" Padding="4,0" Margin="0,0,12,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="15" Height="15" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#fca5a5"
|
||||
Geometry="F1 M24,24z M0,0z M20.1758,20.0951L15.1058,9.97512C15.0358,9.83512,14.9958,9.68512,14.9958,9.52512L14.9958,2.99512 15.4958,2.99512C16.0458,2.99512 16.4958,2.54512 16.4958,1.99512 16.4958,1.44512 16.0458,0.995117 15.4958,0.995117L8.49582,0.995117C7.94582,0.995117 7.49582,1.44512 7.49582,1.99512 7.49582,2.54512 7.94582,2.99512 8.49582,2.99512L8.99582,2.99512 8.99582,9.52512C8.99582,9.67512,8.95582,9.83512,8.89582,9.97512L3.82582,20.0951C3.67582,20.4051 3.59582,20.7451 3.61582,21.0851 3.62582,21.4251 3.73582,21.7651 3.91582,22.0551 4.09582,22.3451 4.34582,22.5851 4.64582,22.7551 4.94582,22.9151 5.27582,23.0051 5.60582,23.0051L18.3758,23.0051C18.7558,23.0051 19.0558,22.9251 19.3558,22.7551 19.6558,22.5851 19.9058,22.3451 20.0858,22.0551 20.2658,21.7651 20.3658,21.4351 20.3858,21.0851 20.3958,20.7451 20.3258,20.4051 20.1758,20.1051L20.1758,20.0951z M10.6858,10.8651C10.8958,10.4451,11.0058,9.98512,11.0058,9.52512L11.0058,2.99512 13.0058,2.99512 13.0058,9.52512C13.0058,9.98512,13.1158,10.4551,13.3258,10.8651L15.3858,14.9951 8.62582,14.9951 10.6958,10.8651 10.6858,10.8651z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<TextBlock Foreground="#fca5a5" Text="实验性选项" FontSize="12" VerticalAlignment="Center" Margin="4,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用EdgeGestureUtil" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableEdgeGestureUtil" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock Text="EdgeGestureUtil可以暂时阻止在使用触摸时触发边缘手势(如Windows10环境下,屏幕左边缘滑动进入任务视图,右边缘滑动弹出通知中心;Windows11环境下,底部向上滑动打开开始菜单)"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Border Height="20" CornerRadius="3" Background="#7f1d1d" Padding="4,0" Margin="0,0,12,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="15" Height="15" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#fca5a5"
|
||||
Geometry="F1 M24,24z M0,0z M20.1758,20.0951L15.1058,9.97512C15.0358,9.83512,14.9958,9.68512,14.9958,9.52512L14.9958,2.99512 15.4958,2.99512C16.0458,2.99512 16.4958,2.54512 16.4958,1.99512 16.4958,1.44512 16.0458,0.995117 15.4958,0.995117L8.49582,0.995117C7.94582,0.995117 7.49582,1.44512 7.49582,1.99512 7.49582,2.54512 7.94582,2.99512 8.49582,2.99512L8.99582,2.99512 8.99582,9.52512C8.99582,9.67512,8.95582,9.83512,8.89582,9.97512L3.82582,20.0951C3.67582,20.4051 3.59582,20.7451 3.61582,21.0851 3.62582,21.4251 3.73582,21.7651 3.91582,22.0551 4.09582,22.3451 4.34582,22.5851 4.64582,22.7551 4.94582,22.9151 5.27582,23.0051 5.60582,23.0051L18.3758,23.0051C18.7558,23.0051 19.0558,22.9251 19.3558,22.7551 19.6558,22.5851 19.9058,22.3451 20.0858,22.0551 20.2658,21.7651 20.3658,21.4351 20.3858,21.0851 20.3958,20.7451 20.3258,20.4051 20.1758,20.1051L20.1758,20.0951z M10.6858,10.8651C10.8958,10.4451,11.0058,9.98512,11.0058,9.52512L11.0058,2.99512 13.0058,2.99512 13.0058,9.52512C13.0058,9.98512,13.1158,10.4551,13.3258,10.8651L15.3858,14.9951 8.62582,14.9951 10.6958,10.8651 10.6858,10.8651z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<TextBlock Foreground="#fca5a5" Text="实验性选项" FontSize="12" VerticalAlignment="Center" Margin="4,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用ForceFullScreen" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableForceFullScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock Text="当检测到窗口大小变化时,自动使用Win32API将本窗口的大小设置为主显示器大小(设备像素大小),不需要可以关闭,实时生效"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Border Height="20" CornerRadius="3" Background="#7f1d1d" Padding="4,0" Margin="0,0,12,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="15" Height="15" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#fca5a5"
|
||||
Geometry="F1 M24,24z M0,0z M20.1758,20.0951L15.1058,9.97512C15.0358,9.83512,14.9958,9.68512,14.9958,9.52512L14.9958,2.99512 15.4958,2.99512C16.0458,2.99512 16.4958,2.54512 16.4958,1.99512 16.4958,1.44512 16.0458,0.995117 15.4958,0.995117L8.49582,0.995117C7.94582,0.995117 7.49582,1.44512 7.49582,1.99512 7.49582,2.54512 7.94582,2.99512 8.49582,2.99512L8.99582,2.99512 8.99582,9.52512C8.99582,9.67512,8.95582,9.83512,8.89582,9.97512L3.82582,20.0951C3.67582,20.4051 3.59582,20.7451 3.61582,21.0851 3.62582,21.4251 3.73582,21.7651 3.91582,22.0551 4.09582,22.3451 4.34582,22.5851 4.64582,22.7551 4.94582,22.9151 5.27582,23.0051 5.60582,23.0051L18.3758,23.0051C18.7558,23.0051 19.0558,22.9251 19.3558,22.7551 19.6558,22.5851 19.9058,22.3451 20.0858,22.0551 20.2658,21.7651 20.3658,21.4351 20.3858,21.0851 20.3958,20.7451 20.3258,20.4051 20.1758,20.1051L20.1758,20.0951z M10.6858,10.8651C10.8958,10.4451,11.0058,9.98512,11.0058,9.52512L11.0058,2.99512 13.0058,2.99512 13.0058,9.52512C13.0058,9.98512,13.1158,10.4551,13.3258,10.8651L15.3858,14.9951 8.62582,14.9951 10.6958,10.8651 10.6858,10.8651z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<TextBlock Foreground="#fca5a5" Text="实验性选项" FontSize="12" VerticalAlignment="Center" Margin="4,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用DPIChangeDetection" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableDPIChangeDetection" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock Text="当检测到系统DPI变化时,会尝试检测FloatingBar是否在屏幕内显示,如果不在屏幕内显示将会尝试移动到屏幕内可见区域"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Border Height="20" CornerRadius="3" Background="#7f1d1d" Padding="4,0" Margin="0,0,12,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="15" Height="15" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#fca5a5"
|
||||
Geometry="F1 M24,24z M0,0z M20.1758,20.0951L15.1058,9.97512C15.0358,9.83512,14.9958,9.68512,14.9958,9.52512L14.9958,2.99512 15.4958,2.99512C16.0458,2.99512 16.4958,2.54512 16.4958,1.99512 16.4958,1.44512 16.0458,0.995117 15.4958,0.995117L8.49582,0.995117C7.94582,0.995117 7.49582,1.44512 7.49582,1.99512 7.49582,2.54512 7.94582,2.99512 8.49582,2.99512L8.99582,2.99512 8.99582,9.52512C8.99582,9.67512,8.95582,9.83512,8.89582,9.97512L3.82582,20.0951C3.67582,20.4051 3.59582,20.7451 3.61582,21.0851 3.62582,21.4251 3.73582,21.7651 3.91582,22.0551 4.09582,22.3451 4.34582,22.5851 4.64582,22.7551 4.94582,22.9151 5.27582,23.0051 5.60582,23.0051L18.3758,23.0051C18.7558,23.0051 19.0558,22.9251 19.3558,22.7551 19.6558,22.5851 19.9058,22.3451 20.0858,22.0551 20.2658,21.7651 20.3658,21.4351 20.3858,21.0851 20.3958,20.7451 20.3258,20.4051 20.1758,20.1051L20.1758,20.0951z M10.6858,10.8651C10.8958,10.4451,11.0058,9.98512,11.0058,9.52512L11.0058,2.99512 13.0058,2.99512 13.0058,9.52512C13.0058,9.98512,13.1158,10.4551,13.3258,10.8651L15.3858,14.9951 8.62582,14.9951 10.6958,10.8651 10.6858,10.8651z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<TextBlock Foreground="#fca5a5" Text="实验性选项" FontSize="12" VerticalAlignment="Center" Margin="4,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用ResolutionChangeDetection" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsEnableResolutionChangeDetection" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock Text="当检测到系统分辨率变化时,会尝试检测FloatingBar是否在屏幕内显示,如果不在屏幕内显示将会尝试移动到屏幕内可见区域"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 设置备份与还原 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="设置备份与还原" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<TextBlock Text="可手动备份当前设置或还原之前的备份,自动更新前也会自动备份"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动更新前备份" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在自动更新前自动备份当前设置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsAutoBackupBeforeUpdate" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="定期自动备份" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="定期自动备份设置文件" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsAutoBackupEnabled" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="备份间隔" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置定期备份的时间间隔" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="AutoBackupInterval1DayBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoBackupInterval_1" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="1天"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoBackupInterval3DaysBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoBackupInterval_3" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="3天"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoBackupInterval7DaysBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="AutoBackupInterval_7" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="7天"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoBackupInterval14DaysBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoBackupInterval_14" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="14天"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoBackupInterval30DaysBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoBackupInterval_30" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="30天"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,8,0,0">
|
||||
<Button x:Name="BtnManualBackup" Content="手动备份" Padding="12,6" Margin="0,0,12,0" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="BtnRestoreBackup" Content="还原备份" Padding="12,6" Background="#2563eb" Foreground="White"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 文件关联管理 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="文件关联管理" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<TextBlock Text="管理.icstk文件的关联设置,双击.icstk文件可直接在Ink Canvas中打开"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,0,0,12"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,8,0,0">
|
||||
<Button x:Name="BtnUnregisterFileAssociation" Content="取消文件关联" Padding="15,5" Margin="0,0,8,0" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="BtnCheckFileAssociation" Content="检查关联状态" Padding="15,5" Margin="0,0,8,0" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="BtnRegisterFileAssociation" Content="重新注册关联" Padding="15,5" Background="#2563eb" Foreground="White"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 悬浮窗拦截 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="悬浮窗拦截" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<TextBlock Text="自动检测并拦截同类软件的悬浮窗"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用悬浮窗拦截" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后自动检测并拦截同类软件的悬浮窗" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchFloatingWindowInterceptorEnabled" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<!-- 拦截规则网格 -->
|
||||
<Grid x:Name="FloatingWindowInterceptorGrid" Margin="0,12,0,0" Visibility="Collapsed">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 希沃白板3 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote3.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃白板3" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoWhiteboard3Floating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃白板5 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃白板5" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoWhiteboard5Floating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃白板5C -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote5C.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃白板5C" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoWhiteboard5CFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃品课 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<Image Source="/Resources/Icons-png/SeewoPinco.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃品课" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoPincoSideBarFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃品课画笔 -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/SeewoPinco.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃品课画笔" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoPincoDrawingFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃PPT小工具 -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/PPTTools.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃PPT小工具" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoPPTFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- AiClass -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/AiClass.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="AiClass" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAiClassFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 鸿合屏幕书写 -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<Image Source="/Resources/Icons-png/HiteAnnotation.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="鸿合屏幕书写" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchHiteAnnotationFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 畅言智慧课堂 -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/畅言智慧课堂.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="畅言智慧课堂" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchChangYanFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 畅言PPT -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/畅言智慧课堂.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="畅言PPT" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchChangYanPptFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 天喻教育云 -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/天喻教育云.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="天喻教育云" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchIntelligentClassFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃桌面画笔 -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<Image Source="/Resources/Icons-png/SeewoPinco.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃桌面画笔" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoDesktopAnnotationFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 希沃桌面侧栏 -->
|
||||
<StackPanel Grid.Row="3" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,0">
|
||||
<Image Source="/Resources/Icons-png/SeewoPinco.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃桌面侧栏" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchSeewoDesktopSideBarFloating" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<TextBlock x:Name="TextBlockFloatingWindowInterceptorStatus" Text="拦截器未启动"
|
||||
Foreground="#9a9996" FontSize="12" Margin="0,8,0,0" Visibility="Collapsed"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Dlass设置管理 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="Dlass设置管理" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Button x:Name="BtnDlassSettingsManage" Content="Dlass设置管理" Padding="15,5" HorizontalAlignment="Left" Background="#2563eb" Foreground="White"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +14,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class AdvancedPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public AdvancedPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += AdvancedPanel_Loaded;
|
||||
}
|
||||
|
||||
private void AdvancedPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AdvancedPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +66,442 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Advanced == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
var advanced = MainWindow.Settings.Advanced;
|
||||
|
||||
// 特殊屏幕模式
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsSpecialScreen"), advanced.IsSpecialScreen);
|
||||
|
||||
// 触摸倍数
|
||||
if (TouchMultiplierSlider != null)
|
||||
{
|
||||
TouchMultiplierSlider.Value = advanced.TouchMultiplier;
|
||||
if (TouchMultiplierText != null)
|
||||
{
|
||||
TouchMultiplierText.Text = advanced.TouchMultiplier.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 橡皮擦绑定触摸大小倍数
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEraserBindTouchMultiplier"), advanced.EraserBindTouchMultiplier);
|
||||
|
||||
// 笔尖模式 BoundsWidth
|
||||
if (NibModeBoundsWidthSlider != null)
|
||||
{
|
||||
NibModeBoundsWidthSlider.Value = advanced.NibModeBoundsWidth;
|
||||
if (NibModeBoundsWidthText != null)
|
||||
{
|
||||
NibModeBoundsWidthText.Text = advanced.NibModeBoundsWidth.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 手指模式 BoundsWidth
|
||||
if (FingerModeBoundsWidthSlider != null)
|
||||
{
|
||||
FingerModeBoundsWidthSlider.Value = advanced.FingerModeBoundsWidth;
|
||||
if (FingerModeBoundsWidthText != null)
|
||||
{
|
||||
FingerModeBoundsWidthText.Text = advanced.FingerModeBoundsWidth.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 四边红外模式
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsQuadIR"), advanced.IsQuadIR);
|
||||
|
||||
// 记录日志
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsLogEnabled"), advanced.IsLogEnabled);
|
||||
|
||||
// 日志以日期保存
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsSaveLogByDate"), advanced.IsSaveLogByDate);
|
||||
|
||||
// 关闭软件时二次弹窗确认
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsSecondConfimeWhenShutdownApp"), advanced.IsSecondConfirmWhenShutdownApp);
|
||||
|
||||
// 实验性功能
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableFullScreenHelper"), advanced.IsEnableFullScreenHelper);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableAvoidFullScreenHelper"), advanced.IsEnableAvoidFullScreenHelper);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableEdgeGestureUtil"), advanced.IsEnableEdgeGestureUtil);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableForceFullScreen"), advanced.IsEnableForceFullScreen);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableDPIChangeDetection"), advanced.IsEnableDPIChangeDetection);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsEnableResolutionChangeDetection"), advanced.IsEnableResolutionChangeDetection);
|
||||
|
||||
// 备份设置
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsAutoBackupBeforeUpdate"), advanced.IsAutoBackupBeforeUpdate);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchIsAutoBackupEnabled"), advanced.IsAutoBackupEnabled);
|
||||
SetOptionButtonState("AutoBackupInterval", advanced.AutoBackupIntervalDays);
|
||||
|
||||
// 悬浮窗拦截
|
||||
// 注意:IsEnableFloatingWindowInterception 可能不在 Advanced 类中,需要确认
|
||||
// 这里先假设它在 Advanced 类中,如果不在,需要调整
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载高级设置时出错: {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedValue)
|
||||
{
|
||||
var buttons = new Dictionary<string, Dictionary<int, string>>
|
||||
{
|
||||
{ "AutoBackupInterval", new Dictionary<int, string> { { 1, "1Day" }, { 3, "3Days" }, { 7, "7Days" }, { 14, "14Days" }, { 30, "30Days" } } }
|
||||
};
|
||||
|
||||
if (!buttons.ContainsKey(group)) return;
|
||||
|
||||
var buttonNames = buttons[group];
|
||||
if (!buttonNames.ContainsKey(selectedValue)) return;
|
||||
|
||||
string buttonName = buttonNames[selectedValue];
|
||||
var button = this.FindDescendantByName($"{group}{buttonName}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = button.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (child is Border childBorder && childBorder != button)
|
||||
{
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = button.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
var advanced = MainWindow.Settings.Advanced;
|
||||
if (advanced == null) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "IsSpecialScreen":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsSpecialScreen", newState);
|
||||
break;
|
||||
|
||||
case "EraserBindTouchMultiplier":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEraserBindTouchMultiplier", newState);
|
||||
break;
|
||||
|
||||
case "IsQuadIR":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsQuadIR", newState);
|
||||
break;
|
||||
|
||||
case "IsLogEnabled":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsLogEnabled", newState);
|
||||
break;
|
||||
|
||||
case "IsSaveLogByDate":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsSaveLogByDate", newState);
|
||||
break;
|
||||
|
||||
case "IsSecondConfirmWhenShutdownApp":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsSecondConfimeWhenShutdownApp", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableFullScreenHelper":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableFullScreenHelper", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableAvoidFullScreenHelper":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableAvoidFullScreenHelper", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableEdgeGestureUtil":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableEdgeGestureUtil", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableForceFullScreen":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableForceFullScreen", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableDPIChangeDetection":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableDPIChangeDetection", newState);
|
||||
break;
|
||||
|
||||
case "IsEnableResolutionChangeDetection":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsEnableResolutionChangeDetection", newState);
|
||||
break;
|
||||
|
||||
case "IsAutoBackupBeforeUpdate":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsAutoBackupBeforeUpdate", newState);
|
||||
break;
|
||||
|
||||
case "IsAutoBackupEnabled":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsAutoBackupEnabled", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void TouchMultiplierSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (TouchMultiplierSlider != null && TouchMultiplierText != null)
|
||||
{
|
||||
double value = TouchMultiplierSlider.Value;
|
||||
TouchMultiplierText.Text = value.ToString("F2");
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("TouchMultiplierSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void NibModeBoundsWidthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (NibModeBoundsWidthSlider != null && NibModeBoundsWidthText != null)
|
||||
{
|
||||
double value = NibModeBoundsWidthSlider.Value;
|
||||
NibModeBoundsWidthText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("NibModeBoundsWidthSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void FingerModeBoundsWidthSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (FingerModeBoundsWidthSlider != null && FingerModeBoundsWidthText != null)
|
||||
{
|
||||
double value = FingerModeBoundsWidthSlider.Value;
|
||||
FingerModeBoundsWidthText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("FingerModeBoundsWidthSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
string[] parts = tag.Split('_');
|
||||
if (parts.Length < 2) return;
|
||||
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (child is Border childBorder && childBorder != border)
|
||||
{
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
if (MainWindow.Settings.Advanced == null) return;
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "AutoBackupInterval":
|
||||
int days;
|
||||
if (int.TryParse(value, out days))
|
||||
{
|
||||
// 尝试调用 MainWindow 中的方法
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxAutoBackupInterval") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
// 找到对应的选项并设置
|
||||
foreach (ComboBoxItem item in comboBox.Items)
|
||||
{
|
||||
if (item.Tag != null && int.TryParse(item.Tag.ToString(), out int tagValue) && tagValue == days)
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxAutoBackupInterval", item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
MainWindow.Settings.Advanced.AutoBackupIntervalDays = days;
|
||||
}, "ComboBoxAutoBackupInterval");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按钮点击事件处理(备份还原、文件关联等)
|
||||
/// </summary>
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
if (button == null) return;
|
||||
|
||||
string name = button.Name;
|
||||
// 这些按钮的功能可能需要调用 MainWindow 中的方法
|
||||
// 暂时先留空,后续可以根据需要实现
|
||||
switch (name)
|
||||
{
|
||||
case "BtnManualBackup":
|
||||
// TODO: 调用 MainWindow 的备份方法
|
||||
break;
|
||||
|
||||
case "BtnRestoreBackup":
|
||||
// TODO: 调用 MainWindow 的还原方法
|
||||
break;
|
||||
|
||||
case "BtnUnregisterFileAssociation":
|
||||
// TODO: 调用 MainWindow 的取消文件关联方法
|
||||
break;
|
||||
|
||||
case "BtnCheckFileAssociation":
|
||||
// TODO: 调用 MainWindow 的检查文件关联方法
|
||||
break;
|
||||
|
||||
case "BtnRegisterFileAssociation":
|
||||
// TODO: 调用 MainWindow 的注册文件关联方法
|
||||
break;
|
||||
|
||||
case "BtnDlassSettingsManage":
|
||||
// TODO: 调用 MainWindow 的 Dlass 设置管理方法
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AdvancedPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,491 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<local:SettingsBaseView x:Name="BaseView"/>
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 主题设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="主题" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择应用程序的主题样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="ThemeLightBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_Light">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="浅色主题"/>
|
||||
</Border>
|
||||
<Border x:Name="ThemeDarkBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_Dark" Margin="8,0,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="深色主题"/>
|
||||
</Border>
|
||||
<Border x:Name="ThemeSystemBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="Theme_System" Margin="8,0,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="跟随系统"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 启动动画设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用启动动画" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启动时显示动画效果" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableSplashScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<StackPanel Margin="18,8,18,8" x:Name="SplashScreenStylePanel">
|
||||
<StackPanel Orientation="Vertical" Margin="0,0,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启动动画样式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择启动动画的样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<Border x:Name="SplashScreenStyleRandomBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="SplashScreenStyle_Random" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="随机"/>
|
||||
</Border>
|
||||
<Border x:Name="SplashScreenStyleSeasonBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="SplashScreenStyle_Season" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="跟随四季"/>
|
||||
</Border>
|
||||
<Border x:Name="SplashScreenStyleSpringBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="SplashScreenStyle_Spring" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="春季"/>
|
||||
</Border>
|
||||
<Border x:Name="SplashScreenStyleSummerBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="SplashScreenStyle_Summer" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="夏季"/>
|
||||
</Border>
|
||||
<Border x:Name="SplashScreenStyleAutumnBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="SplashScreenStyle_Autumn" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="秋季"/>
|
||||
</Border>
|
||||
<Border x:Name="SplashScreenStyleWinterBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="SplashScreenStyle_Winter" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="冬季"/>
|
||||
</Border>
|
||||
<Border x:Name="SplashScreenStyleHorseBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="SplashScreenStyle_Horse" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="马年限定"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 浮动工具栏设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Margin="18,8,18,8">
|
||||
<StackPanel Orientation="Vertical" Margin="0,0,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="浮动工具栏图标" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择浮动工具栏的图标样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<Border x:Name="FloatingBarImgDefaultBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="FloatingBarImg_Default" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text=""ICC-CE"默认"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgNoShadowBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_NoShadow" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text=""ICC-CE"无阴影"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgDarkBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_Dark" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text=""ICC-CE"深色"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgDarkBreathingBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_DarkBreathing" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text=""ICC-CE"深色呼吸版"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgWhiteTransparentBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_WhiteTransparent" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text=""ICC-CE"白色透明版"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgBlackTransparentBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_BlackTransparent" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text=""ICC-CE"黑色透明版"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgKuan1Border" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_Kuan1" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="酷安斗鸡眼滑稽"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgKuan2Border" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_Kuan2" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="酷安受虐滑稽"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgKuan3Border" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_Kuan3" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="酷安呲牙笑"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgKuan4Border" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_Kuan4" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="酷安头戴内裤滑稽"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgKuan5Border" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_Kuan5" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="酷安绿帽Doge"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgTiebaBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_Tieba" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="贴吧滑稽"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自定义浮动栏图标" HorizontalAlignment="Left" Margin="0,0,12,0"/>
|
||||
<Button x:Name="ButtonAddCustomIcon" Content="上传" Padding="10,3"/>
|
||||
<Button x:Name="ButtonManageCustomIcons" Content="管理" Padding="10,3" Margin="5,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="浮动工具栏缩放" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整浮动工具栏的大小" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="ViewboxFloatingBarScaleTransformValueSlider" Width="150" Minimum="0.5" Maximum="1.25" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="ViewboxFloatingBarScaleTransformValueText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="浮动工具栏透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整浮动工具栏的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="ViewboxFloatingBarOpacityValueSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="ViewboxFloatingBarOpacityValueText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="浮栏在PPT下透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在PPT模式下浮动工具栏的透明度(重新进入PPT放映后生效)" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="ViewboxFloatingBarOpacityInPPTValueSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="ViewboxFloatingBarOpacityInPPTValueText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在调色盘窗口中显示 笔尖模式 按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在调色盘窗口中显示笔尖模式切换按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableDisPlayNibModeToggle" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="使用老版浮动栏按钮UI" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用旧版浮动栏按钮的界面样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxUseLegacyFloatingBarUI" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 浮动栏按钮显示设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="浮动栏按钮显示" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示形状按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示形状按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowShapeButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示撤销按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示撤销按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowUndoButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示重做按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示重做按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowRedoButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示清空按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示清空按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowClearButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示白板按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示白板按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowWhiteboardButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示隐藏按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示隐藏按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowHideButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示套索选择按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示套索选择按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowLassoSelectButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示清并鼠按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示清并鼠按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowClearAndMouseButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示快捷调色盘" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示快捷调色盘" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowQuickColorPalette" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="快捷调色盘显示模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择快捷调色盘的显示模式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="QuickColorPaletteDisplayModeSingleBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Single">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="单行显示(6色)"/>
|
||||
</Border>
|
||||
<Border x:Name="QuickColorPaletteDisplayModeDoubleBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Double" Margin="8,0,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="双行显示(8色)"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="橡皮按钮显示" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="选择橡皮按钮的显示方式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Border x:Name="EraserDisplayOptionBothBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="EraserDisplayOption_Both" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="两个都显示"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserDisplayOptionAreaBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Area" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="仅显示面积擦"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserDisplayOptionLineBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Line" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="仅显示线擦"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserDisplayOptionNoneBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_None" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="都不显示"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 任务栏托盘图标设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="任务栏托盘图标" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用托盘图标" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在任务栏系统托盘显示图标" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTrayIcon" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 白板设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="白板 UI 80% 缩放" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="将白板界面缩放至80%" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableViewboxBlackBoardScaleTransform" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在白板中显示当前时间和日期" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在白板界面显示当前时间和日期" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTimeDisplayInWhiteboardMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在白板中显示信仰の源1(好喝的/毒的鸡汤)" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在白板界面显示励志语句" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableChickenSoupInWhiteboardMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="信仰の源出自Where?" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="选择励志语句的来源" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Border x:Name="ChickenSoupSourceOsuBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Osu" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="osu!玩家语录"/>
|
||||
</Border>
|
||||
<Border x:Name="ChickenSoupSourceMotivationalBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Motivational" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="励志立志的名言警句"/>
|
||||
</Border>
|
||||
<Border x:Name="ChickenSoupSourceGaokaoBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Gaokao" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="高考祝福语"/>
|
||||
</Border>
|
||||
<Border x:Name="ChickenSoupSourceHitokotoBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="ChickenSoupSource_Hitokoto" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="一言(Hitokoto API)"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 收纳模式设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在收纳模式下启用快速面板" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在收纳模式下显示快速操作面板" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableQuickPanel" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="取消收纳按钮图标" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择取消收纳按钮的图标样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="UnFoldBtnImgArrowBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="UnFoldBtnImg_Arrow" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="箭头"/>
|
||||
</Border>
|
||||
<Border x:Name="UnFoldBtnImgPenBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UnFoldBtnImg_Pen" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="笔"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出收纳模式时自动切换至批注模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出收纳模式时将自动切换至批注模式,便于快速批注" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoEnterAnnotationModeWhenExitFoldMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出PPT放映后自动收纳浮动栏" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出PPT放映后会自动收纳浮动栏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldAfterPPTSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出白板时自动收纳" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出白板模式时会自动收纳到侧边栏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldWhenExitWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,69 +1,48 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// AppearancePanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AppearancePanel : UserControl
|
||||
{
|
||||
public AppearancePanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
BaseView.SettingsPanels.Add(new SettingsViewPanel()
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedNoShadowEffect;
|
||||
|
||||
private void ScrollViewerEx_ScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||
{
|
||||
var scrollViewer = (ScrollViewer)sender;
|
||||
if (scrollViewer.VerticalOffset >= 10)
|
||||
{
|
||||
Title = "新版设置测试",
|
||||
Items = new ObservableCollection<SettingsItem>(new SettingsItem[] {
|
||||
new SettingsItem() {
|
||||
Title = "默认ToggleSwitch",
|
||||
Description = "这是测试文本,这是测试文本",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true
|
||||
},
|
||||
new SettingsItem() {
|
||||
Title = "默认开启的ToggleSwitch",
|
||||
Description = "这是测试文本,这是测试文本324234324",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true,
|
||||
ToggleSwitchToggled = true,
|
||||
},
|
||||
new SettingsItem() {
|
||||
Title = "默认关闭的ToggleSwitch",
|
||||
Description = "这是测试文本,这是测试文本fsdsdffsd",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true,
|
||||
ToggleSwitchToggled = false,
|
||||
},
|
||||
new SettingsItem() {
|
||||
Title = "绿色的ToggleSwitch",
|
||||
Description = "这是测试文本,这是测试文本fs大风刮过4sd",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true,
|
||||
ToggleSwitchToggled = true,
|
||||
ToggleSwitchBackground = new SolidColorBrush(Color.FromRgb(51, 209, 122)),
|
||||
},
|
||||
new SettingsItem() {
|
||||
Title = "默认禁用的的ToggleSwitch",
|
||||
Description = "这是测试文本",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true,
|
||||
ToggleSwitchToggled = true,
|
||||
ToggleSwitchEnabled = false,
|
||||
ToggleSwitchBackground = new SolidColorBrush(Color.FromRgb(51, 209, 122)),
|
||||
},
|
||||
new SettingsItem() {
|
||||
Title = "控制上面的ToggleSwitch是否启用",
|
||||
Description = "12423432452312322335",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true,
|
||||
ToggleSwitchToggled = false,
|
||||
},
|
||||
})
|
||||
});
|
||||
BaseView.SettingsPanels[0].Items[5].OnToggleSwitchToggled += (sender, args) =>
|
||||
IsTopBarNeedShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = (SettingsItem)sender;
|
||||
BaseView.SettingsPanels[0].Items[4].ToggleSwitchEnabled = item.ToggleSwitchToggled;
|
||||
};
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AppearancePanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,417 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<!-- 自动收纳设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="自动收纳" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 第一行 -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃白板5" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNote" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiCamera.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃展台" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiCamera" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/HiteBoard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="鸿合白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInHiteTouchPro" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote3.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃白板3" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNote3" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 第二行 -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote3C.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃轻白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNote3C" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/EasiNote5C.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃轻白板5C" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNote5C" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/SeewoPinco.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="希沃品课" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInSeewoPincoTeacher" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<Image Source="/Resources/Icons-png/HiteCamera.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="鸿合展台" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInHiteCamera" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 第三行 -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/HiteLightBoard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="鸿合轻量白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInHiteLightBoard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/WenXiang.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="文香白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInWxBoardMain" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/Whiteboard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="微软白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInMSWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<Image Source="/Resources/Icons-png/AdmoxWhiteboard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="安道白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInAdmoxWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<!-- 第四行 -->
|
||||
<StackPanel Grid.Row="3" Grid.Column="0" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/AdmoxBooth.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="安道展台" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInAdmoxBooth" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="3" Grid.Column="1" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/YiYunWhiteboard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="艺云白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInQPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="3" Grid.Column="2" Orientation="Vertical" Margin="0,0,8,12">
|
||||
<Image Source="/Resources/Icons-png/YiYunVisualPresenter.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="艺云展台" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInYiYunVisualPresenter" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="3" Grid.Column="3" Orientation="Vertical" Margin="0,0,0,12">
|
||||
<Image Source="/Resources/Icons-png/MaxHubWhiteboard.png" Width="42" Height="42" HorizontalAlignment="Center" Margin="0,0,0,4"/>
|
||||
<TextBlock Text="MaxHub白板" HorizontalAlignment="Center" FontSize="14" Margin="0,0,0,4" Foreground="#2e3436"/>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInMaxHubWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" HorizontalAlignment="Center" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/Powerpoint.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="播放PPT时自动收纳" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInPPTSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="软件退出后保持收纳模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,执行自动收纳的软件在软件退出后不退出收纳模式,保持收纳状态" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchKeepFoldAfterSoftwareExit" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/EasiNote.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动收纳忽略桌面EN5批注窗口" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInEasiNoteIgnoreDesktopAnno" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/Donview.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="进入"中原旧白板"时自动收纳" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldInOldZyBoard" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 自动查杀设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="自动查杀" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/PPTTools.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动查杀希沃"PPT 小工具"" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoKillPptService" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock Text="请注意,查杀 PPT 小工具会导致希沃课堂授课助手无法使用"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/EasiNote.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动查杀 希沃白板5" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoKillEasiNote" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/HiteAnnotation.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动查杀 鸿合屏幕书写" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoKillHiteAnnotation" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="鸿合屏幕书写查杀后自动进入批注" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="查杀鸿合屏幕书写后自动进入批注模式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoEnterAnnotationAfterKillHite" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/VComYouJiao.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动查杀 优教授课端" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoKillVComYouJiao" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/Seewo2Annotation.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动查杀 希沃桌面2.0 桌面批注" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoKillSeewoLauncher2DesktopAnnotation" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock Text="由于希沃桌面2.0提供的桌面批注是64位应用程序,icc是32位程序无法访问,所以目前暂不做精准匹配,只匹配进程名称DesktopAnnotation"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<TextBlock Text="同类软件查杀" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/InkCanvas.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动查杀 Ink Canvas 和 IC+" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoKillInkCanvas" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/ica.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动查杀ICA(新版旧版通杀)" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoKillICA" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/idt.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动查杀 智绘教Inkeys(仅限新版)" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoKillIDT" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Ink_Canvas.Windows.SettingsViews;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +10,129 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class AutomationPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public AutomationPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += AutomationPanel_Loaded;
|
||||
}
|
||||
|
||||
private void AutomationPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置
|
||||
/// </summary>
|
||||
private void LoadSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Automation == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
var automation = MainWindow.Settings.Automation;
|
||||
|
||||
// 设置所有 ToggleSwitch 的状态
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiNote", automation.IsAutoFoldInEasiNote);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiCamera", automation.IsAutoFoldInEasiCamera);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInHiteTouchPro", automation.IsAutoFoldInHiteTouchPro);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiNote3", automation.IsAutoFoldInEasiNote3);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiNote3C", automation.IsAutoFoldInEasiNote3C);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiNote5C", automation.IsAutoFoldInEasiNote5C);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInSeewoPincoTeacher", automation.IsAutoFoldInSeewoPincoTeacher);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInHiteCamera", automation.IsAutoFoldInHiteCamera);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInHiteLightBoard", automation.IsAutoFoldInHiteLightBoard);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInWxBoardMain", automation.IsAutoFoldInWxBoardMain);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInMSWhiteboard", automation.IsAutoFoldInMSWhiteboard);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInAdmoxWhiteboard", automation.IsAutoFoldInAdmoxWhiteboard);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInAdmoxBooth", automation.IsAutoFoldInAdmoxBooth);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInQPoint", automation.IsAutoFoldInQPoint);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInYiYunVisualPresenter", automation.IsAutoFoldInYiYunVisualPresenter);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInMaxHubWhiteboard", automation.IsAutoFoldInMaxHubWhiteboard);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInPPTSlideShow", automation.IsAutoFoldInPPTSlideShow);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInEasiNoteIgnoreDesktopAnno", automation.IsAutoFoldInEasiNoteIgnoreDesktopAnno);
|
||||
SetToggleSwitchState("ToggleSwitchAutoFoldInOldZyBoard", automation.IsAutoFoldInOldZyBoard);
|
||||
SetToggleSwitchState("ToggleSwitchKeepFoldAfterSoftwareExit", automation.KeepFoldAfterSoftwareExit);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 加载设置时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置 ToggleSwitch 状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(string name, bool isOn)
|
||||
{
|
||||
try
|
||||
{
|
||||
var border = FindName(name) as System.Windows.Controls.Border;
|
||||
if (border != null)
|
||||
{
|
||||
bool currentState = border.Background.ToString().Contains("3584e4");
|
||||
if (currentState != isOn)
|
||||
{
|
||||
border.Background = isOn ? new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0x35, 0x84, 0xe4)) : new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0xe1, 0xe1, 0xe1));
|
||||
var innerBorder = border.Child as System.Windows.Controls.Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 设置 ToggleSwitch {name} 状态时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch 点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as System.Windows.Controls.Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool currentState = border.Background.ToString().Contains("3584e4");
|
||||
bool newState = !currentState;
|
||||
SetToggleSwitchState(border.Name, newState);
|
||||
|
||||
// 通过 MainWindowSettingsHelper 调用 MainWindow 中的方法
|
||||
string toggleSwitchName = border.Name;
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled(toggleSwitchName, newState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +150,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"AutomationPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,353 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<!-- 画笔和光标设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示画笔光标" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="绘制时显示画笔光标" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowCursor" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowCursor" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用压感触屏模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,触屏设备也将支持压感效果,适用于部分支持压感但无法被系统识别的触屏设备" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnablePressureTouchMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnablePressureTouchMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="屏蔽压感" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,将忽略所有设备的压感信息,使所有笔画具有统一的粗细。与压感触屏模式互斥" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchDisablePressure" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="DisablePressure" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="板擦橡皮大小" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="EraserSizeVerySmall" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_VerySmall" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="很小"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserSizeSmall" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_Small" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="较小"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserSizeMedium" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="EraserSize_Medium" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="中等"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserSizeLarge" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_Large" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="较大"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserSizeVeryLarge" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserSize_VeryLarge" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="很大"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 墨迹显示设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出画板模式后隐藏墨迹" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,进入 PPT 模式时未处于批注模式时不会显示墨迹" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchHideStrokeWhenSelecting" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="HideStrokeWhenSelecting" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="清空墨迹时删除墨迹历史记录" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,清空墨迹后将无法通过"撤销"功能恢复" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchClearCanvasAndClearTimeMachine" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ClearCanvasAndClearTimeMachine" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="清空画布时同时清空图片" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="清空画布时同时删除所有插入的图片" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchClearCanvasAlsoClearImages" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="ClearCanvasAlsoClearImages" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="插入图片时自动压缩(大于1920x1080)" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="插入的图片大于1920x1080时自动压缩以节省内存" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchCompressPicturesUploaded" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="CompressPicturesUploaded" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 形状和曲线设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="保留双曲线渐近线" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="HyperbolaAsymptoteYes" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="HyperbolaAsymptote_Yes" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="是"/>
|
||||
</Border>
|
||||
<Border x:Name="HyperbolaAsymptoteNo" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="HyperbolaAsymptote_No" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="否"/>
|
||||
</Border>
|
||||
<Border x:Name="HyperbolaAsymptoteAsk" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="HyperbolaAsymptote_Ask" Margin="8,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="每次询问"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="绘制圆时显示圆心位置" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="绘制圆形时显示圆心标记" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowCircleCenter" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowCircleCenter" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="使用WPF默认贝塞尔曲线平滑" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用WPF内置的曲线平滑算法" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchFitToCurve" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="FitToCurve" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="使用高级曲线平滑(推荐)" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用改进的贝塞尔曲线平滑算法,提供更好的绘制效果" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAdvancedBezierSmoothing" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AdvancedBezierSmoothing" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 墨迹渐隐设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用墨迹渐隐功能" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后墨迹不会绘制到画布上,而是保持湿墨迹状态,根据设置的渐隐时间自动消失" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableInkFade" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableInkFade" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54" x:Name="InkFadeTimePanel" Visibility="Collapsed">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="墨迹渐隐时间" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置墨迹从绘制到完全消失的时间" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="InkFadeTimeSlider" Width="150" Minimum="1000" Maximum="10000" Value="3000" TickFrequency="1000" IsSnapToTickEnabled="True" ValueChanged="InkFadeTimeSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="InkFadeTimeText" Text="3000ms" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 墨迹保存设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="墨迹保存设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="定时自动保存墨迹" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后将在设定时间间隔自动保存墨迹,仅在画布可见且有墨迹时才会保存" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableAutoSaveStrokes" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableAutoSaveStrokes" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<StackPanel x:Name="AutoSaveIntervalPanel" Visibility="Collapsed">
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="保存间隔" HorizontalAlignment="Left" Margin="0,0,12,0"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,0,15,0">
|
||||
<Border x:Name="AutoSaveStrokesInterval1MinBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="AutoSaveStrokesInterval_1" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="1分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval3MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_3" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="3分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval5MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_5" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="5分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval10MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_10" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="10分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval15MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_15" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="15分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval30MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_30" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="30分钟"/>
|
||||
</Border>
|
||||
<Border x:Name="AutoSaveStrokesInterval60MinBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="AutoSaveStrokesInterval_60" Margin="0,0,8,8" MouseLeftButtonDown="AutoSaveIntervalButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="60分钟"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="墨迹全页面保存" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后自动保存和手动保存墨迹时将以全屏模式保存。如果存在多个画布和墨迹,将把所有页面的墨迹按照每页为单位保存进一个压缩包中" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSaveFullPageStrokes" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,15,8" Tag="SaveFullPageStrokes" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="保存为XML格式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后保存墨迹时将使用XML格式(ISF格式),便于查看和编辑墨迹数据" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSaveStrokesAsXML" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="SaveStrokesAsXML" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动保存幻灯片墨迹" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后将在结束幻灯片放映时自动保存已有墨迹,并在下次打开时自动加载(文件名和幻灯片页数都要相同)" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSaveStrokesInPowerPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,15,8" Tag="AutoSaveStrokesInPowerPoint" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -13,9 +15,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class CanvasAndInkPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public CanvasAndInkPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += CanvasAndInkPanel_Loaded;
|
||||
}
|
||||
|
||||
private void CanvasAndInkPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CanvasAndInkPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -33,6 +67,541 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Canvas == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
var canvas = MainWindow.Settings.Canvas;
|
||||
|
||||
// 显示画笔光标
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowCursor"), canvas.IsShowCursor);
|
||||
|
||||
// 启用压感触屏模式
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePressureTouchMode"), canvas.EnablePressureTouchMode);
|
||||
|
||||
// 屏蔽压感
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchDisablePressure"), canvas.DisablePressure);
|
||||
|
||||
// 板擦橡皮大小
|
||||
SetOptionButtonState("EraserSize", canvas.EraserSize);
|
||||
|
||||
// 退出画板模式后隐藏墨迹
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchHideStrokeWhenSelecting"), canvas.HideStrokeWhenSelecting);
|
||||
|
||||
// 清空墨迹时删除墨迹历史记录
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchClearCanvasAndClearTimeMachine"), canvas.ClearCanvasAndClearTimeMachine);
|
||||
|
||||
// 清空画布时同时清空图片
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchClearCanvasAlsoClearImages"), canvas.ClearCanvasAlsoClearImages);
|
||||
|
||||
// 插入图片时自动压缩
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchCompressPicturesUploaded"), canvas.IsCompressPicturesUploaded);
|
||||
|
||||
// 保留双曲线渐近线
|
||||
SetOptionButtonState("HyperbolaAsymptote", (int)canvas.HyperbolaAsymptoteOption);
|
||||
|
||||
// 绘制圆时显示圆心位置
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowCircleCenter"), canvas.ShowCircleCenter);
|
||||
|
||||
// 使用WPF默认贝塞尔曲线平滑
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchFitToCurve"), canvas.FitToCurve && !canvas.UseAdvancedBezierSmoothing);
|
||||
|
||||
// 使用高级贝塞尔曲线平滑
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAdvancedBezierSmoothing"), canvas.UseAdvancedBezierSmoothing);
|
||||
|
||||
// 启用异步墨迹平滑
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchUseAsyncInkSmoothing"), canvas.UseAsyncInkSmoothing);
|
||||
|
||||
// 启用硬件加速
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchUseHardwareAcceleration"), canvas.UseHardwareAcceleration);
|
||||
|
||||
// 启用直线自动拉直
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoStraightenLine"), canvas.AutoStraightenLine);
|
||||
|
||||
// 启用高精度直线拉直
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchHighPrecisionLineStraighten"), canvas.HighPrecisionLineStraighten);
|
||||
|
||||
// 启用直线端点吸附
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchLineEndpointSnapping"), canvas.LineEndpointSnapping);
|
||||
|
||||
// 启用墨迹渐隐功能
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableInkFade"), canvas.EnableInkFade);
|
||||
if (InkFadeTimePanel != null)
|
||||
{
|
||||
InkFadeTimePanel.Visibility = canvas.EnableInkFade ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
if (InkFadeTimeSlider != null)
|
||||
{
|
||||
InkFadeTimeSlider.Value = canvas.InkFadeTime;
|
||||
}
|
||||
|
||||
// 定时自动保存墨迹
|
||||
// 注意:这个设置可能在 Automation 或 Canvas 中,需要根据实际情况调整
|
||||
// SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableAutoSaveStrokes"), ...);
|
||||
|
||||
// 墨迹全页面保存
|
||||
// SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSaveFullPageStrokes"), ...);
|
||||
|
||||
// 保存为XML格式
|
||||
// SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSaveStrokesAsXML"), ...);
|
||||
|
||||
// 自动保存幻灯片墨迹
|
||||
if (MainWindow.Settings.PowerPointSettings != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveStrokesInPowerPoint"),
|
||||
MainWindow.Settings.PowerPointSettings.IsAutoSaveStrokesInPowerPoint);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载画板和墨迹设置时出错: {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new[] { "VerySmall", "Small", "Medium", "Large", "VeryLarge" };
|
||||
var hyperbolaButtons = new[] { "Yes", "No", "Ask" };
|
||||
|
||||
string[] buttonNames = group == "EraserSize" ? buttons : hyperbolaButtons;
|
||||
|
||||
for (int i = 0; i < buttonNames.Length && i <= selectedIndex; i++)
|
||||
{
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
var canvas = MainWindow.Settings.Canvas;
|
||||
if (canvas == null) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "ShowCursor":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowCursor", newState);
|
||||
break;
|
||||
|
||||
case "EnablePressureTouchMode":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePressureTouchMode", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState && canvas.DisablePressure)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchDisablePressure", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchDisablePressure"), false);
|
||||
}
|
||||
break;
|
||||
|
||||
case "DisablePressure":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchDisablePressure", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState && canvas.EnablePressureTouchMode)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePressureTouchMode", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePressureTouchMode"), false);
|
||||
}
|
||||
break;
|
||||
|
||||
case "HideStrokeWhenSelecting":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchHideStrokeWhenSelecting", newState);
|
||||
break;
|
||||
|
||||
case "ClearCanvasAndClearTimeMachine":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchClearCanvasAndClearTimeMachine", newState);
|
||||
break;
|
||||
|
||||
case "ClearCanvasAlsoClearImages":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchClearCanvasAlsoClearImages", newState);
|
||||
break;
|
||||
|
||||
case "CompressPicturesUploaded":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchCompressPicturesUploaded", newState);
|
||||
break;
|
||||
|
||||
case "ShowCircleCenter":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowCircleCenter", newState);
|
||||
break;
|
||||
|
||||
case "FitToCurve":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFitToCurve", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAdvancedBezierSmoothing", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAdvancedBezierSmoothing"), false);
|
||||
}
|
||||
break;
|
||||
|
||||
case "AdvancedBezierSmoothing":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAdvancedBezierSmoothing", newState);
|
||||
// 处理互斥逻辑
|
||||
if (newState)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFitToCurve", false);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchFitToCurve"), false);
|
||||
}
|
||||
break;
|
||||
|
||||
case "UseAsyncInkSmoothing":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAsyncInkSmoothing", newState);
|
||||
break;
|
||||
|
||||
case "UseHardwareAcceleration":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchHardwareAcceleration", newState);
|
||||
break;
|
||||
|
||||
case "AutoStraightenLine":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoStraightenLine", newState);
|
||||
break;
|
||||
|
||||
case "HighPrecisionLineStraighten":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchHighPrecisionLineStraighten", newState);
|
||||
break;
|
||||
|
||||
case "LineEndpointSnapping":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchLineEndpointSnapping", newState);
|
||||
break;
|
||||
|
||||
case "EnableInkFade":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableInkFade", newState);
|
||||
// 更新UI状态
|
||||
if (InkFadeTimePanel != null)
|
||||
{
|
||||
InkFadeTimePanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "EnableAutoSaveStrokes":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableAutoSaveStrokes", newState);
|
||||
break;
|
||||
|
||||
case "SaveFullPageStrokes":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSaveFullPageStrokes", newState);
|
||||
break;
|
||||
|
||||
case "SaveStrokesAsXML":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSaveStrokesAsXML", newState);
|
||||
break;
|
||||
|
||||
case "AutoSaveStrokesInPowerPoint":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSaveStrokesInPowerPoint", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
string[] parts = tag.Split('_');
|
||||
if (parts.Length < 2) return;
|
||||
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (child is Border childBorder && childBorder != border)
|
||||
{
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
var canvas = MainWindow.Settings.Canvas;
|
||||
if (canvas == null) return;
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "EraserSize":
|
||||
int eraserSize;
|
||||
switch (value)
|
||||
{
|
||||
case "VerySmall":
|
||||
eraserSize = 0;
|
||||
break;
|
||||
case "Small":
|
||||
eraserSize = 1;
|
||||
break;
|
||||
case "Medium":
|
||||
eraserSize = 2;
|
||||
break;
|
||||
case "Large":
|
||||
eraserSize = 3;
|
||||
break;
|
||||
case "VeryLarge":
|
||||
eraserSize = 4;
|
||||
break;
|
||||
default:
|
||||
eraserSize = 2;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxEraserSize") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > eraserSize)
|
||||
{
|
||||
comboBox.SelectedIndex = eraserSize;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxEraserSize", comboBox.Items[eraserSize]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
canvas.EraserSize = eraserSize;
|
||||
}, "ComboBoxEraserSize");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "HyperbolaAsymptote":
|
||||
OptionalOperation option;
|
||||
switch (value)
|
||||
{
|
||||
case "Yes":
|
||||
option = OptionalOperation.Yes;
|
||||
break;
|
||||
case "No":
|
||||
option = OptionalOperation.No;
|
||||
break;
|
||||
case "Ask":
|
||||
option = OptionalOperation.Ask;
|
||||
break;
|
||||
default:
|
||||
option = OptionalOperation.Ask;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow2 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow2 != null)
|
||||
{
|
||||
var comboBox = mainWindow2.FindName("ComboBoxHyperbolaAsymptoteOption") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
int optionIndex = (int)option;
|
||||
if (comboBox.Items.Count > optionIndex)
|
||||
{
|
||||
comboBox.SelectedIndex = optionIndex;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxHyperbolaAsymptoteOption", comboBox.Items[optionIndex]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
canvas.HyperbolaAsymptoteOption = option;
|
||||
}, "ComboBoxHyperbolaAsymptoteOption");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "AutoSaveStrokesInterval":
|
||||
// 调用 MainWindow 中的方法
|
||||
int interval = int.Parse(value);
|
||||
var mainWindow3 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow3 != null)
|
||||
{
|
||||
var comboBox = mainWindow3.FindName("ComboBoxAutoSaveStrokesInterval") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
// 查找对应的选项(根据 Tag 或 Content 匹配)
|
||||
foreach (System.Windows.Controls.ComboBoxItem item in comboBox.Items)
|
||||
{
|
||||
if (item.Tag != null && int.TryParse(item.Tag.ToString(), out int tagValue) && tagValue == interval)
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxAutoSaveStrokesInterval", item);
|
||||
break;
|
||||
}
|
||||
else if (item.Content != null && item.Content.ToString().Contains(interval.ToString()))
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxAutoSaveStrokesInterval", item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
MainWindow.Settings.Automation.AutoSaveStrokesIntervalMinutes = interval;
|
||||
}
|
||||
}, "ComboBoxAutoSaveStrokesInterval");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自动保存间隔选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void AutoSaveIntervalButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
OptionButton_Click(sender, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void InkFadeTimeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (InkFadeTimeSlider != null && InkFadeTimeText != null)
|
||||
{
|
||||
double value = InkFadeTimeSlider.Value;
|
||||
InkFadeTimeText.Text = $"{(int)value}ms";
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("InkFadeTimeSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CanvasAndInkPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style x:Key="ComboBoxStyle" TargetType="ComboBox">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="BorderBrush" Value="#e6e6e6"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="13,7"/>
|
||||
<Setter Property="FontFamily" Value="Microsoft YaHei UI"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="Foreground" Value="#2e3436"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||||
<Setter Property="MinHeight" Value="32"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
<Grid>
|
||||
<ToggleButton x:Name="ToggleButton"
|
||||
Focusable="False"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
ClickMode="Press"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
<ToggleButton.Template>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Border Background="Transparent"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"/>
|
||||
</ControlTemplate>
|
||||
</ToggleButton.Template>
|
||||
</ToggleButton>
|
||||
<Border x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="8"
|
||||
IsHitTestVisible="False">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter Grid.Column="0"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Content="{TemplateBinding SelectionBoxItem}"
|
||||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"/>
|
||||
<Path x:Name="Arrow" Grid.Column="1"
|
||||
Data="M 0 0 L 5 5 L 10 0 Z"
|
||||
Fill="#9a9996"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,0,12,0"
|
||||
Width="10"
|
||||
Height="5"
|
||||
Stretch="Uniform"
|
||||
IsHitTestVisible="False"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Popup x:Name="Popup"
|
||||
Placement="Bottom"
|
||||
PlacementTarget="{Binding ElementName=Border}"
|
||||
AllowsTransparency="True"
|
||||
PopupAnimation="Fade"
|
||||
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
StaysOpen="False">
|
||||
<Border Background="White"
|
||||
BorderBrush="#e6e6e6"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
MaxHeight="300"
|
||||
MinWidth="{Binding ActualWidth, ElementName=Border}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="8" Direction="270" ShadowDepth="4" Color="Black" Opacity="0.15"/>
|
||||
</Border.Effect>
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
Padding="4">
|
||||
<ItemsPresenter/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#3584e4"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsFocused" Value="True">
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#3584e4"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsDropDownOpen" Value="True">
|
||||
<Setter TargetName="Arrow" Property="Data" Value="M 0 5 L 5 0 L 10 5 Z"/>
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="#3584e4"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Border" Property="Opacity" Value="0.5"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- ComboBoxItem样式 - 符合设置页面风格 -->
|
||||
<Style x:Key="ComboBoxItemStyle" TargetType="ComboBoxItem">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="Foreground" Value="#2e3436"/>
|
||||
<Setter Property="Padding" Value="13,8"/>
|
||||
<Setter Property="FontFamily" Value="Microsoft YaHei UI"/>
|
||||
<Setter Property="FontSize" Value="14"/>
|
||||
<Setter Property="MinHeight" Value="36"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBoxItem">
|
||||
<Border x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#f5f5f5"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#e1e1e1"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -4,12 +4,34 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,8">
|
||||
<TextBlock Text="请选择软件发生未处理异常时的自动操作:" Foreground="#2e3436" FontSize="14.5" HorizontalAlignment="Left"/>
|
||||
<TextBlock Text="静默重启:崩溃后自动重启软件,无提示。无操作:崩溃后仅记录日志,不自动重启。"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,8,15,8">
|
||||
<Border x:Name="CrashActionSilentRestartBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="CrashAction_SilentRestart" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="静默重启软件"/>
|
||||
</Border>
|
||||
<Border x:Name="CrashActionNoActionBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="CrashAction_NoAction" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="无操作"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -29,6 +29,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CrashActionPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using iNKORE.UI.WPF.DragDrop;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
@@ -143,5 +144,20 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IconSource = FindResource("PenIcon") as DrawingImage,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"FloatingBarDnDSettingsPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,98 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<!-- 双指手势设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="进退白板模式自动开关双指移动功能" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后退出画板模式时自动关闭双指移动手势,进入白板模式时自动开启双指移动手势" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSwitchTwoFingerGesture" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoSwitchTwoFingerGesture" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="允许双指旋转与缩放选中的墨迹" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="允许选中墨迹后对墨迹进行双指或多指缩放操作" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTwoFingerRotationOnSelection" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableTwoFingerRotationOnSelection" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 手掌擦设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用手掌擦" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,两个及以上触点且触摸面积较大时自动切换为橡皮擦,抬手后恢复原编辑模式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnablePalmEraser" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnablePalmEraser" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<StackPanel Orientation="Vertical" x:Name="PalmEraserSensitivityPanel" Visibility="Collapsed" Margin="0,12,0,12">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="手掌擦敏感度" HorizontalAlignment="Left" Margin="0,0,0,8"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,0,0,12" Text="低敏感度:需要更大的触摸面积和更多触摸点,减少误判;高敏感度:更容易触发手掌擦,但可能误判手指" HorizontalAlignment="Left" TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="18,0,15,0">
|
||||
<Border x:Name="PalmEraserSensitivityLowBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="PalmEraserSensitivity_Low" Margin="0,0,8,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="低敏感度"/>
|
||||
</Border>
|
||||
<Border x:Name="PalmEraserSensitivityMediumBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PalmEraserSensitivity_Medium" Margin="0,0,8,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="中敏感度"/>
|
||||
</Border>
|
||||
<Border x:Name="PalmEraserSensitivityHighBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PalmEraserSensitivity_High" Margin="0,0,0,0" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="高敏感度"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +14,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class GesturesPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public GesturesPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += GesturesPanel_Loaded;
|
||||
}
|
||||
|
||||
private void GesturesPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"GesturesPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +66,261 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
// 进退白板模式自动开关双指移动功能
|
||||
if (MainWindow.Settings.Gesture != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSwitchTwoFingerGesture"), MainWindow.Settings.Gesture.AutoSwitchTwoFingerGesture);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableTwoFingerRotationOnSelection"), MainWindow.Settings.Gesture.IsEnableTwoFingerRotationOnSelection);
|
||||
}
|
||||
|
||||
// 启用手掌擦
|
||||
if (MainWindow.Settings.Canvas != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePalmEraser"), MainWindow.Settings.Canvas.EnablePalmEraser);
|
||||
if (PalmEraserSensitivityPanel != null)
|
||||
{
|
||||
PalmEraserSensitivityPanel.Visibility = MainWindow.Settings.Canvas.EnablePalmEraser ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 手掌擦敏感度
|
||||
SetOptionButtonState("PalmEraserSensitivity", MainWindow.Settings.Canvas.PalmEraserSensitivity);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载手势操作设置时出错: {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
{
|
||||
{ "PalmEraserSensitivity", new[] { "Low", "Medium", "High" } }
|
||||
};
|
||||
|
||||
if (!buttons.ContainsKey(group)) return;
|
||||
|
||||
string[] buttonNames = buttons[group];
|
||||
|
||||
for (int i = 0; i < buttonNames.Length; i++)
|
||||
{
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "AutoSwitchTwoFingerGesture":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSwitchTwoFingerGesture", newState);
|
||||
break;
|
||||
|
||||
case "EnableTwoFingerRotationOnSelection":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableTwoFingerRotationOnSelection", newState);
|
||||
break;
|
||||
|
||||
case "EnablePalmEraser":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePalmEraser", newState);
|
||||
// 更新UI状态
|
||||
if (PalmEraserSensitivityPanel != null)
|
||||
{
|
||||
PalmEraserSensitivityPanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
string[] parts = tag.Split('_');
|
||||
if (parts.Length < 2) return;
|
||||
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (child is Border childBorder && childBorder != border)
|
||||
{
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "PalmEraserSensitivity":
|
||||
int sensitivity;
|
||||
switch (value)
|
||||
{
|
||||
case "Low":
|
||||
sensitivity = 0;
|
||||
break;
|
||||
case "Medium":
|
||||
sensitivity = 1;
|
||||
break;
|
||||
case "High":
|
||||
sensitivity = 2;
|
||||
break;
|
||||
default:
|
||||
sensitivity = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法(通过设置 ComboBox 的 SelectedIndex)
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxPalmEraserSensitivity") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > sensitivity)
|
||||
{
|
||||
comboBox.SelectedIndex = sensitivity;
|
||||
// 触发 SelectionChanged 事件
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxPalmEraserSensitivity", comboBox.Items[sensitivity]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Canvas != null)
|
||||
{
|
||||
MainWindow.Settings.Canvas.PalmEraserSensitivity = sensitivity;
|
||||
}
|
||||
}, "ComboBoxPalmEraserSensitivity");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"GesturesPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,191 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<!-- 墨迹识别主开关 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用墨迹识别" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="自动将手绘图形识别并转换为标准形状" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableInkToShape" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 形状识别选项 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8" x:Name="InkRecognitionOptionsPanel">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="阻止矫正后的矩形带有模拟压感值" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="矫正后的矩形不包含模拟压感信息" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableInkToShapeNoFakePressureRectangle" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="阻止矫正后的三角形带有模拟压感值" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="矫正后的三角形不包含模拟压感信息" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableInkToShapeNoFakePressureTriangle" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeTriangle" IsChecked="True">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="矫正手绘三角形" VerticalAlignment="Center"/>
|
||||
</CheckBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeRectangle" IsChecked="True">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="矫正手绘矩形" VerticalAlignment="Center"/>
|
||||
</CheckBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<CheckBox x:Name="ToggleCheckboxEnableInkToShapeRounded" IsChecked="True">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="矫正手绘圆形与椭圆" VerticalAlignment="Center"/>
|
||||
</CheckBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 直线识别设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="直线自动拉直" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="当绘制的直线超过设定长度阈值时,将自动调整为完美直线" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoStraightenLine" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid MinHeight="54" x:Name="AutoStraightenLineSettingsPanel">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="18,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="长度阈值" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="设置直线自动拉直的最小长度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="AutoStraightenLineThresholdSlider" Width="150" Minimum="30" Maximum="300" Value="80" TickFrequency="30" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="AutoStraightenLineThresholdText" Text="80" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid MinHeight="54" x:Name="LineStraightenSensitivityPanel">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="18,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="灵敏度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="越小要求越严格,越弯曲的线条越不容易被拉直;值越大越容易识别为直线" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="LineStraightenSensitivitySlider" Width="150" Minimum="0.05" Maximum="2.0" Value="0.20" TickFrequency="0.05" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="LineStraightenSensitivityText" Text="0.20" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54" x:Name="HighPrecisionLineStraightenPanel">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="高精度直线拉直" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="高精度模式下,每隔10像素取一个计数点,获取更准确的平均值用于判断" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchHighPrecisionLineStraighten" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="直线端点吸附" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="当绘制的直线端点靠近其他直线端点时,将自动吸附连接" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchLineEndpointSnapping" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid MinHeight="54" x:Name="LineEndpointSnappingThresholdPanel">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="18,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="吸附距离" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="设置直线端点自动吸附的最大距离" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="LineEndpointSnappingThresholdSlider" Width="150" Minimum="5" Maximum="50" Value="15" TickFrequency="5" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="LineEndpointSnappingThresholdText" Text="15" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -29,6 +29,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"InkRecognitionPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,218 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<!-- 基本设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示修改随机点名名单的按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在随机点名窗口中显示修改名单的按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchDisplayRandWindowNamesInputBtn" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="DisplayRandWindowNamesInputBtn" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用随机抽和单次抽按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在随机点名窗口中显示随机抽和单次抽按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowRandomAndSingleDraw" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowRandomAndSingleDraw" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用快抽悬浮按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用快速抽人的悬浮按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableQuickDraw" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableQuickDraw" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="直接调用外部点名" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用外部点名工具代替内置点名功能" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchExternalCaller" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="ExternalCaller" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="点名类型" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="选择外部点名工具的类型" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Border x:Name="ExternalCallerTypeClassIslandBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="ExternalCallerType_ClassIsland" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="ClassIsland点名"/>
|
||||
</Border>
|
||||
<Border x:Name="ExternalCallerTypeSecRandomBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ExternalCallerType_SecRandom" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="SecRandom点名"/>
|
||||
</Border>
|
||||
<Border x:Name="ExternalCallerTypeNamePickerBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ExternalCallerType_NamePicker" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="NamePicker点名"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 窗口设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="单次抽人窗口关闭延迟" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置单次抽人窗口自动关闭的延迟时间" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="RandWindowOnceCloseLatencySlider" Width="150" Minimum="0.5" Maximum="8" Value="2.5" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="RandWindowOnceCloseLatencySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="RandWindowOnceCloseLatencyText" Text="2.5s" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="单次随机点名人数上限" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置单次随机点名最多抽取的人数" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="RandWindowOnceMaxStudentsSlider" Width="150" Minimum="0" Maximum="20" Value="10" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="RandWindowOnceMaxStudentsSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="RandWindowOnceMaxStudentsText" Text="10" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 新点名UI设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="新点名UI设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用新点名UI" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用新的点名界面设计" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchUseNewRollCallUI" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="UseNewRollCallUI" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用机器学习避免重复" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用机器学习算法避免重复抽取相同的人" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableMLAvoidance" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableMLAvoidance" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="避免重复历史记录数量" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置用于避免重复的历史记录数量" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="MLAvoidanceHistorySlider" Width="150" Minimum="5" Maximum="50" Value="50" TickFrequency="5" IsSnapToTickEnabled="True" ValueChanged="MLAvoidanceHistorySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="MLAvoidanceHistoryText" Text="50" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="避免重复权重" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置机器学习算法避免重复的权重" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="MLAvoidanceWeightSlider" Width="150" Minimum="0.1" Maximum="1.0" Value="1.0" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="MLAvoidanceWeightSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="MLAvoidanceWeightText" Text="100%" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" FontFamily="Consolas"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<TextBlock Text="机器学习算法会分析最近的点名历史,智能避免重复选择相同人员"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 背景设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="点名窗口背景设置(仅老版点名UI有效)" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<StackPanel Margin="18,8,18,8">
|
||||
<StackPanel Orientation="Vertical" Margin="0,0,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="背景选择" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择点名窗口的背景" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<Border x:Name="PickNameBackgroundDefaultBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="PickNameBackground_Default" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="默认背景"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自定义背景" HorizontalAlignment="Left" Margin="0,0,12,0"/>
|
||||
<Button x:Name="ButtonAddCustomBackground" Content="上传" Padding="10,3"/>
|
||||
<Button x:Name="ButtonManageBackgrounds" Content="管理" Padding="10,3" Margin="5,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +15,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class LuckyRandomPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public LuckyRandomPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += LuckyRandomPanel_Loaded;
|
||||
}
|
||||
|
||||
private void LuckyRandomPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"LuckyRandomPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +67,379 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.RandSettings == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
var randSettings = MainWindow.Settings.RandSettings;
|
||||
|
||||
// 显示修改随机点名名单的按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchDisplayRandWindowNamesInputBtn"), randSettings.DisplayRandWindowNamesInputBtn);
|
||||
|
||||
// 启用随机抽和单次抽按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowRandomAndSingleDraw"), randSettings.ShowRandomAndSingleDraw);
|
||||
|
||||
// 启用快抽悬浮按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableQuickDraw"), randSettings.EnableQuickDraw);
|
||||
|
||||
// 直接调用外部点名
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchExternalCaller"), randSettings.DirectCallCiRand);
|
||||
|
||||
// 点名类型
|
||||
SetOptionButtonState("ExternalCallerType", randSettings.ExternalCallerType);
|
||||
|
||||
// 单次抽人窗口关闭延迟
|
||||
if (RandWindowOnceCloseLatencySlider != null)
|
||||
{
|
||||
RandWindowOnceCloseLatencySlider.Value = randSettings.RandWindowOnceCloseLatency;
|
||||
if (RandWindowOnceCloseLatencyText != null)
|
||||
{
|
||||
RandWindowOnceCloseLatencyText.Text = $"{randSettings.RandWindowOnceCloseLatency:F1}s";
|
||||
}
|
||||
}
|
||||
|
||||
// 单次随机点名人数上限
|
||||
if (RandWindowOnceMaxStudentsSlider != null)
|
||||
{
|
||||
RandWindowOnceMaxStudentsSlider.Value = randSettings.RandWindowOnceMaxStudents;
|
||||
if (RandWindowOnceMaxStudentsText != null)
|
||||
{
|
||||
RandWindowOnceMaxStudentsText.Text = randSettings.RandWindowOnceMaxStudents.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 启用新点名UI
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchUseNewRollCallUI"), randSettings.UseNewRollCallUI);
|
||||
|
||||
// 启用机器学习避免重复
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableMLAvoidance"), randSettings.EnableMLAvoidance);
|
||||
|
||||
// 避免重复历史记录数量
|
||||
if (MLAvoidanceHistorySlider != null)
|
||||
{
|
||||
MLAvoidanceHistorySlider.Value = randSettings.MLAvoidanceHistoryCount;
|
||||
if (MLAvoidanceHistoryText != null)
|
||||
{
|
||||
MLAvoidanceHistoryText.Text = randSettings.MLAvoidanceHistoryCount.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 避免重复权重
|
||||
if (MLAvoidanceWeightSlider != null)
|
||||
{
|
||||
MLAvoidanceWeightSlider.Value = randSettings.MLAvoidanceWeight;
|
||||
if (MLAvoidanceWeightText != null)
|
||||
{
|
||||
MLAvoidanceWeightText.Text = $"{(randSettings.MLAvoidanceWeight * 100):F0}%";
|
||||
}
|
||||
}
|
||||
|
||||
// 背景选择
|
||||
SetOptionButtonState("PickNameBackground", randSettings.SelectedBackgroundIndex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载幸运随机设置时出错: {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
{
|
||||
{ "ExternalCallerType", new[] { "ClassIsland", "SecRandom", "NamePicker" } },
|
||||
{ "PickNameBackground", new[] { "Default" } }
|
||||
};
|
||||
|
||||
if (!buttons.ContainsKey(group)) return;
|
||||
|
||||
string[] buttonNames = buttons[group];
|
||||
|
||||
for (int i = 0; i < buttonNames.Length; i++)
|
||||
{
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
var randSettings = MainWindow.Settings.RandSettings;
|
||||
if (randSettings == null) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "DisplayRandWindowNamesInputBtn":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchDisplayRandWindowNamesInputBtn", newState);
|
||||
break;
|
||||
|
||||
case "ShowRandomAndSingleDraw":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowRandomAndSingleDraw", newState);
|
||||
break;
|
||||
|
||||
case "EnableQuickDraw":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableQuickDraw", newState);
|
||||
break;
|
||||
|
||||
case "ExternalCaller":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchExternalCaller", newState);
|
||||
break;
|
||||
|
||||
case "UseNewRollCallUI":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchUseNewRollCallUI", newState);
|
||||
break;
|
||||
|
||||
case "EnableMLAvoidance":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableMLAvoidance", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
string[] parts = tag.Split('_');
|
||||
if (parts.Length < 2) return;
|
||||
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (child is Border childBorder && childBorder != border)
|
||||
{
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
var randSettings = MainWindow.Settings.RandSettings;
|
||||
if (randSettings == null) return;
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "ExternalCallerType":
|
||||
int callerType;
|
||||
switch (value)
|
||||
{
|
||||
case "ClassIsland":
|
||||
callerType = 0;
|
||||
break;
|
||||
case "SecRandom":
|
||||
callerType = 1;
|
||||
break;
|
||||
case "NamePicker":
|
||||
callerType = 2;
|
||||
break;
|
||||
default:
|
||||
callerType = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxExternalCallerType") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > callerType)
|
||||
{
|
||||
comboBox.SelectedIndex = callerType;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxExternalCallerType", comboBox.Items[callerType]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
randSettings.ExternalCallerType = callerType;
|
||||
}, "ComboBoxExternalCallerType");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "PickNameBackground":
|
||||
// 背景选择逻辑 - 这个设置可能没有对应的方法,直接更新
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
randSettings.SelectedBackgroundIndex = 0; // 默认背景
|
||||
}, "PickNameBackground");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void RandWindowOnceCloseLatencySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (RandWindowOnceCloseLatencySlider != null && RandWindowOnceCloseLatencyText != null)
|
||||
{
|
||||
double value = RandWindowOnceCloseLatencySlider.Value;
|
||||
RandWindowOnceCloseLatencyText.Text = $"{value:F1}s";
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("RandWindowOnceCloseLatencySlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void RandWindowOnceMaxStudentsSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (RandWindowOnceMaxStudentsSlider != null && RandWindowOnceMaxStudentsText != null)
|
||||
{
|
||||
double value = RandWindowOnceMaxStudentsSlider.Value;
|
||||
RandWindowOnceMaxStudentsText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("RandWindowOnceMaxStudentsSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void MLAvoidanceHistorySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (MLAvoidanceHistorySlider != null && MLAvoidanceHistoryText != null)
|
||||
{
|
||||
double value = MLAvoidanceHistorySlider.Value;
|
||||
MLAvoidanceHistoryText.Text = ((int)value).ToString();
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("MLAvoidanceHistorySlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void MLAvoidanceWeightSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (MLAvoidanceWeightSlider != null && MLAvoidanceWeightText != null)
|
||||
{
|
||||
double value = MLAvoidanceWeightSlider.Value;
|
||||
MLAvoidanceWeightText.Text = $"{(value * 100):F0}%";
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("MLAvoidanceWeightSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"LuckyRandomPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,716 @@
|
||||
using Ink_Canvas;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Media = System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// 辅助类:用于在新设置面板中调用 MainWindow 中已有的设置处理方法
|
||||
/// </summary>
|
||||
public static class MainWindowSettingsHelper
|
||||
{
|
||||
private static MainWindow GetMainWindow()
|
||||
{
|
||||
return Application.Current.MainWindow as MainWindow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的方法
|
||||
/// </summary>
|
||||
public static void InvokeMainWindowMethod(string methodName, params object[] parameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
var method = mainWindow.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
method.Invoke(mainWindow, parameters);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"调用 MainWindow 方法 {methodName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 ToggleSwitch 事件处理方法
|
||||
/// </summary>
|
||||
public static void InvokeToggleSwitchToggled(string toggleSwitchName, bool isOn)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
// 获取 MainWindow 中的 ToggleSwitch 控件
|
||||
var toggleSwitch = mainWindow.FindName(toggleSwitchName);
|
||||
if (toggleSwitch == null)
|
||||
{
|
||||
// 如果找不到控件,尝试通过反射设置属性
|
||||
var property = mainWindow.GetType().GetProperty(toggleSwitchName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (property != null && property.PropertyType.Name.Contains("ToggleSwitch"))
|
||||
{
|
||||
var isOnProperty = property.PropertyType.GetProperty("IsOn");
|
||||
if (isOnProperty != null)
|
||||
{
|
||||
var toggleSwitchInstance = property.GetValue(mainWindow);
|
||||
if (toggleSwitchInstance != null)
|
||||
{
|
||||
isOnProperty.SetValue(toggleSwitchInstance, isOn);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 即使找不到控件,也尝试触发事件(可能通过反射调用)
|
||||
var toggledMethodName = toggleSwitchName + "_Toggled";
|
||||
InvokeMainWindowMethod(toggledMethodName, null, new RoutedEventArgs());
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(toggleSwitchName);
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置 ToggleSwitch 的 IsOn 属性
|
||||
var toggleSwitchType = toggleSwitch.GetType();
|
||||
var isOnProp = toggleSwitchType.GetProperty("IsOn");
|
||||
if (isOnProp != null)
|
||||
{
|
||||
isOnProp.SetValue(toggleSwitch, isOn);
|
||||
}
|
||||
|
||||
// 触发 Toggled 事件
|
||||
var toggledMethodName2 = toggleSwitchName + "_Toggled";
|
||||
InvokeMainWindowMethod(toggledMethodName2, toggleSwitch, new RoutedEventArgs());
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(toggleSwitchName);
|
||||
|
||||
// 检查是否需要更新主题
|
||||
NotifyThemeUpdateIfNeeded(toggleSwitchName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"调用 ToggleSwitch {toggleSwitchName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 ComboBox 事件处理方法
|
||||
/// </summary>
|
||||
public static void InvokeComboBoxSelectionChanged(string comboBoxName, object selectedItem)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
// 获取 MainWindow 中的 ComboBox 控件
|
||||
var comboBox = mainWindow.FindName(comboBoxName) as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
comboBox.SelectedItem = selectedItem;
|
||||
|
||||
// 触发 SelectionChanged 事件
|
||||
var selectionChangedMethodName = comboBoxName + "_SelectionChanged";
|
||||
InvokeMainWindowMethod(selectionChangedMethodName, comboBox, new System.Windows.Controls.SelectionChangedEventArgs(
|
||||
System.Windows.Controls.Primitives.Selector.SelectionChangedEvent,
|
||||
new System.Collections.IList[0],
|
||||
new System.Collections.IList[0]));
|
||||
}
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(comboBoxName);
|
||||
|
||||
// 检查是否需要更新主题
|
||||
NotifyThemeUpdateIfNeeded(comboBoxName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"调用 ComboBox {comboBoxName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 Slider 事件处理方法
|
||||
/// </summary>
|
||||
public static void InvokeSliderValueChanged(string sliderName, double value)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
// 获取 MainWindow 中的 Slider 控件
|
||||
var slider = mainWindow.FindName(sliderName) as System.Windows.Controls.Slider;
|
||||
if (slider != null)
|
||||
{
|
||||
var oldValue = slider.Value;
|
||||
slider.Value = value;
|
||||
|
||||
// 触发 ValueChanged 事件
|
||||
var valueChangedMethodName = sliderName + "_ValueChanged";
|
||||
InvokeMainWindowMethod(valueChangedMethodName, slider,
|
||||
new System.Windows.RoutedPropertyChangedEventArgs<double>(oldValue, value));
|
||||
}
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(sliderName);
|
||||
|
||||
// 检查是否需要更新主题(某些Slider可能影响UI外观)
|
||||
NotifyThemeUpdateIfNeeded(sliderName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"调用 Slider {sliderName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 CheckBox 事件处理方法
|
||||
/// </summary>
|
||||
public static void InvokeCheckBoxCheckedChanged(string checkBoxName, bool isChecked)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
// 获取 MainWindow 中的 CheckBox 控件
|
||||
var checkBox = mainWindow.FindName(checkBoxName) as System.Windows.Controls.CheckBox;
|
||||
if (checkBox != null)
|
||||
{
|
||||
checkBox.IsChecked = isChecked;
|
||||
|
||||
// 尝试多种可能的方法名
|
||||
var methodNames = new[]
|
||||
{
|
||||
checkBoxName + "_IsCheckChanged",
|
||||
checkBoxName + "_IsCheckChange",
|
||||
checkBoxName + "_Checked",
|
||||
checkBoxName + "_Unchecked"
|
||||
};
|
||||
|
||||
foreach (var methodName in methodNames)
|
||||
{
|
||||
var method = mainWindow.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
InvokeMainWindowMethod(methodName, checkBox, new RoutedEventArgs());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"调用 CheckBox {checkBoxName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 安全地修改设置并保存,优先调用 MainWindow 中的事件处理方法
|
||||
/// 如果找不到对应的事件处理方法,则直接修改设置并保存
|
||||
/// </summary>
|
||||
/// <param name="action">设置修改的 Action,例如:() => MainWindow.Settings.Startup.IsAutoUpdate = true</param>
|
||||
/// <param name="eventHandlerName">可选:要调用的 MainWindow 事件处理方法名(如 "ToggleSwitchIsAutoUpdate_Toggled")</param>
|
||||
/// <param name="controlName">可选:控件名称,用于状态同步(如 "ToggleSwitchIsAutoUpdate")</param>
|
||||
/// <param name="eventHandlerParams">可选:事件处理方法的参数</param>
|
||||
public static void UpdateSettingSafely(Action action, string eventHandlerName = null, string controlName = null, params object[] eventHandlerParams)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 如果提供了事件处理方法名,优先调用
|
||||
if (!string.IsNullOrEmpty(eventHandlerName))
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var method = mainWindow.GetType().GetMethod(eventHandlerName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
// 调用事件处理方法(它会自动保存设置并触发状态同步)
|
||||
method.Invoke(mainWindow, eventHandlerParams);
|
||||
|
||||
// 如果提供了控件名称,确保状态同步
|
||||
if (!string.IsNullOrEmpty(controlName))
|
||||
{
|
||||
NotifySettingsPanelsSyncState(controlName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有事件处理方法或调用失败,直接修改设置并保存
|
||||
action?.Invoke();
|
||||
MainWindow.SaveSettingsToFile();
|
||||
|
||||
// 如果提供了控件名称,通知面板同步状态
|
||||
if (!string.IsNullOrEmpty(controlName))
|
||||
{
|
||||
NotifySettingsPanelsSyncState(controlName);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新设置失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 直接修改设置属性并保存(用于没有对应事件处理方法的设置项)
|
||||
/// </summary>
|
||||
/// <param name="action">设置修改的 Action</param>
|
||||
/// <param name="controlName">可选:控件名称,用于状态同步(如 "ToggleSwitchIsAutoUpdate")</param>
|
||||
public static void UpdateSettingDirectly(Action action, string controlName = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
action?.Invoke();
|
||||
MainWindow.SaveSettingsToFile();
|
||||
|
||||
// 如果提供了控件名称,通知面板同步状态
|
||||
if (!string.IsNullOrEmpty(controlName))
|
||||
{
|
||||
NotifySettingsPanelsSyncState(controlName);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"直接更新设置失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 TextBox 事件处理方法
|
||||
/// </summary>
|
||||
public static void InvokeTextBoxTextChanged(string textBoxName, string text)
|
||||
{
|
||||
try
|
||||
{
|
||||
var mainWindow = GetMainWindow();
|
||||
if (mainWindow == null) return;
|
||||
|
||||
// 获取 MainWindow 中的 TextBox 控件
|
||||
var textBox = mainWindow.FindName(textBoxName) as System.Windows.Controls.TextBox;
|
||||
if (textBox != null)
|
||||
{
|
||||
textBox.Text = text;
|
||||
|
||||
// 触发 TextChanged 事件
|
||||
var textChangedMethodName = textBoxName + "_TextChanged";
|
||||
InvokeMainWindowMethod(textChangedMethodName, textBox, new System.Windows.Controls.TextChangedEventArgs(
|
||||
System.Windows.Controls.Primitives.TextBoxBase.TextChangedEvent,
|
||||
System.Windows.Controls.UndoAction.None));
|
||||
}
|
||||
|
||||
// 通知新设置面板同步状态
|
||||
NotifySettingsPanelsSyncState(textBoxName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"调用 TextBox {textBoxName} 失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通知所有新设置面板同步指定控件的状态
|
||||
/// </summary>
|
||||
public static void NotifySettingsPanelsSyncState(string controlName)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保设置已经保存
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
// 查找所有打开的设置窗口
|
||||
foreach (Window window in Application.Current.Windows)
|
||||
{
|
||||
if (window.GetType().Name == "SettingsWindow")
|
||||
{
|
||||
// 根据控件名称确定需要同步的面板
|
||||
var panelToSync = GetPanelForControl(controlName);
|
||||
|
||||
if (panelToSync != null)
|
||||
{
|
||||
// 获取对应的面板属性
|
||||
var panelProp = window.GetType().GetProperty(panelToSync, BindingFlags.Public | BindingFlags.Instance);
|
||||
if (panelProp != null)
|
||||
{
|
||||
var panel = panelProp.GetValue(window) as System.Windows.Controls.UserControl;
|
||||
if (panel != null)
|
||||
{
|
||||
// 调用 LoadSettings 方法重新加载设置
|
||||
var loadMethod = panel.GetType().GetMethod("LoadSettings",
|
||||
BindingFlags.Public | BindingFlags.Instance);
|
||||
if (loadMethod != null)
|
||||
{
|
||||
loadMethod.Invoke(panel, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果无法确定具体面板,则同步所有面板(保守策略)
|
||||
SyncAllPanels(window);
|
||||
}
|
||||
break; // 通常只有一个设置窗口
|
||||
}
|
||||
}
|
||||
}), System.Windows.Threading.DispatcherPriority.Background);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"通知设置面板同步状态失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据控件名称获取对应的面板名称
|
||||
/// </summary>
|
||||
private static string GetPanelForControl(string controlName)
|
||||
{
|
||||
// 定义控件名称到面板名称的映射
|
||||
var controlToPanel = new Dictionary<string, string>
|
||||
{
|
||||
// StartupPanel
|
||||
{ "ToggleSwitchIsAutoUpdate", "StartupPanel" },
|
||||
{ "ToggleSwitchIsAutoUpdateWithSilence", "StartupPanel" },
|
||||
{ "ToggleSwitchRunAtStartup", "StartupPanel" },
|
||||
{ "ToggleSwitchFoldAtStartup", "StartupPanel" },
|
||||
{ "AutoUpdateWithSilenceStartTimeComboBox", "StartupPanel" },
|
||||
{ "AutoUpdateWithSilenceEndTimeComboBox", "StartupPanel" },
|
||||
|
||||
// ThemePanel
|
||||
{ "ComboBoxTheme", "ThemePanel" },
|
||||
{ "ToggleSwitchEnableSplashScreen", "ThemePanel" },
|
||||
{ "ComboBoxSplashScreenStyle", "ThemePanel" },
|
||||
{ "ToggleSwitchEnableTrayIcon", "ThemePanel" },
|
||||
{ "ComboBoxFloatingBarImg", "ThemePanel" },
|
||||
{ "ComboBoxUnFoldBtnImg", "ThemePanel" },
|
||||
{ "ComboBoxChickenSoupSource", "ThemePanel" },
|
||||
{ "ComboBoxQuickColorPaletteDisplayMode", "ThemePanel" },
|
||||
{ "ComboBoxEraserDisplayOption", "ThemePanel" },
|
||||
{ "ToggleSwitchEnableQuickPanel", "ThemePanel" },
|
||||
{ "ViewboxFloatingBarScaleTransformValueSlider", "ThemePanel" },
|
||||
{ "ViewboxFloatingBarOpacityValueSlider", "ThemePanel" },
|
||||
{ "ViewboxFloatingBarOpacityInPPTValueSlider", "ThemePanel" },
|
||||
|
||||
// PowerPointPanel
|
||||
{ "ToggleSwitchSupportPowerPoint", "PowerPointPanel" },
|
||||
{ "ToggleSwitchShowPPTButton", "PowerPointPanel" },
|
||||
{ "ToggleSwitchEnablePPTButtonPageClickable", "PowerPointPanel" },
|
||||
{ "ToggleSwitchShowCanvasAtNewSlideShow", "PowerPointPanel" },
|
||||
{ "PPTButtonLeftPositionValueSlider", "PowerPointPanel" },
|
||||
{ "PPTButtonRightPositionValueSlider", "PowerPointPanel" },
|
||||
|
||||
// GesturesPanel
|
||||
{ "ToggleSwitchEnableTwoFingerRotationOnSelection", "GesturesPanel" },
|
||||
{ "ToggleSwitchEnablePalmEraser", "GesturesPanel" },
|
||||
{ "ComboBoxPalmEraserSensitivity", "GesturesPanel" },
|
||||
|
||||
// CanvasAndInkPanel
|
||||
{ "ToggleSwitchShowCursor", "CanvasAndInkPanel" },
|
||||
{ "ToggleSwitchDisablePressure", "CanvasAndInkPanel" },
|
||||
{ "ToggleSwitchEnablePressureTouchMode", "CanvasAndInkPanel" },
|
||||
{ "ComboBoxEraserSize", "CanvasAndInkPanel" },
|
||||
{ "ComboBoxHyperbolaAsymptoteOption", "CanvasAndInkPanel" },
|
||||
{ "ComboBoxAutoSaveStrokesInterval", "CanvasAndInkPanel" },
|
||||
|
||||
// SnapshotPanel
|
||||
{ "AutoSavedStrokesLocation", "SnapshotPanel" },
|
||||
{ "ComboBoxAutoDelSavedFilesDaysThreshold", "SnapshotPanel" },
|
||||
{ "ToggleSwitchAutoDelSavedFiles", "SnapshotPanel" },
|
||||
|
||||
// AdvancedPanel
|
||||
{ "ComboBoxAutoBackupInterval", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsQuadIR", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsLogEnabled", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsSaveLogByDate", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsSecondConfimeWhenShutdownApp", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableFullScreenHelper", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableAvoidFullScreenHelper", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableEdgeGestureUtil", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableForceFullScreen", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableDPIChangeDetection", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsEnableResolutionChangeDetection", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsAutoBackupBeforeUpdate", "AdvancedPanel" },
|
||||
{ "ToggleSwitchIsAutoBackupEnabled", "AdvancedPanel" },
|
||||
|
||||
// LuckyRandomPanel
|
||||
{ "ToggleSwitchDisplayRandWindowNamesInputBtn", "LuckyRandomPanel" },
|
||||
{ "ToggleSwitchShowRandomAndSingleDraw", "LuckyRandomPanel" },
|
||||
{ "ToggleSwitchEnableQuickDraw", "LuckyRandomPanel" },
|
||||
{ "ToggleSwitchExternalCaller", "LuckyRandomPanel" },
|
||||
{ "ComboBoxExternalCallerType", "LuckyRandomPanel" },
|
||||
{ "RandWindowOnceCloseLatencySlider", "LuckyRandomPanel" },
|
||||
{ "RandWindowOnceMaxStudentsSlider", "LuckyRandomPanel" },
|
||||
};
|
||||
|
||||
// 查找匹配的面板
|
||||
foreach (var kvp in controlToPanel)
|
||||
{
|
||||
if (controlName.Contains(kvp.Key) || kvp.Key.Contains(controlName))
|
||||
{
|
||||
return kvp.Value;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 同步所有面板的状态(保守策略)
|
||||
/// </summary>
|
||||
private static void SyncAllPanels(Window settingsWindow)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 获取所有面板属性
|
||||
var panelProperties = settingsWindow.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)
|
||||
.Where(p => p.PropertyType.Name.EndsWith("Panel") &&
|
||||
p.PropertyType.IsSubclassOf(typeof(System.Windows.Controls.UserControl)));
|
||||
|
||||
foreach (var panelProp in panelProperties)
|
||||
{
|
||||
try
|
||||
{
|
||||
var panel = panelProp.GetValue(settingsWindow) as System.Windows.Controls.UserControl;
|
||||
if (panel != null)
|
||||
{
|
||||
// 调用 LoadSettings 方法
|
||||
var loadMethod = panel.GetType().GetMethod("LoadSettings",
|
||||
BindingFlags.Public | BindingFlags.Instance);
|
||||
if (loadMethod != null)
|
||||
{
|
||||
loadMethod.Invoke(panel, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"同步面板 {panelProp.Name} 状态失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"同步所有面板状态失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查并通知设置窗口更新主题(如果设置变化可能影响主题)
|
||||
/// </summary>
|
||||
/// <param name="controlName">控件名称,用于判断是否是主题相关的设置</param>
|
||||
public static void NotifyThemeUpdateIfNeeded(string controlName)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(controlName)) return;
|
||||
|
||||
// 定义可能影响主题的控件名称列表(扩展版)
|
||||
var themeRelatedControls = new[]
|
||||
{
|
||||
"ComboBoxTheme", // 主题选择
|
||||
"ToggleSwitchEnableTrayIcon", // 托盘图标(可能影响图标颜色)
|
||||
"ComboBoxFloatingBarImg", // 浮动栏图标
|
||||
"ComboBoxUnFoldBtnImg", // 展开按钮图标
|
||||
"ComboBoxSplashScreenStyle", // 启动画面样式
|
||||
"ToggleSwitchEnableSplashScreen", // 启动画面开关
|
||||
"ViewboxFloatingBarScaleTransformValueSlider", // 浮动栏缩放(可能影响UI)
|
||||
"ViewboxFloatingBarOpacityValueSlider", // 浮动栏透明度
|
||||
"ViewboxFloatingBarOpacityInPPTValueSlider", // PPT中浮动栏透明度
|
||||
"UnFoldBtnImg", // 展开按钮图标(选项按钮)
|
||||
"FloatingBarImg", // 浮动栏图标(选项按钮)
|
||||
"Theme" // 主题(选项按钮)
|
||||
};
|
||||
|
||||
// 检查是否是主题相关的设置(使用更灵活的匹配)
|
||||
bool isThemeRelated = false;
|
||||
string controlNameLower = controlName.ToLower();
|
||||
|
||||
foreach (var themeControl in themeRelatedControls)
|
||||
{
|
||||
string themeControlLower = themeControl.ToLower();
|
||||
// 检查是否包含或匹配
|
||||
if (controlNameLower.Contains(themeControlLower) ||
|
||||
themeControlLower.Contains(controlNameLower) ||
|
||||
controlNameLower == themeControlLower)
|
||||
{
|
||||
isThemeRelated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isThemeRelated)
|
||||
{
|
||||
// 延迟通知,确保设置已保存
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
// 通知设置窗口更新主题
|
||||
NotifySettingsWindowThemeUpdate();
|
||||
}), System.Windows.Threading.DispatcherPriority.Background);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"通知主题更新失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通知设置窗口更新所有面板的主题
|
||||
/// </summary>
|
||||
private static void NotifySettingsWindowThemeUpdate()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 查找所有打开的设置窗口
|
||||
foreach (Window window in Application.Current.Windows)
|
||||
{
|
||||
// 使用类型名称匹配,因为 SettingsWindow 在不同的命名空间中
|
||||
if (window.GetType().Name == "SettingsWindow")
|
||||
{
|
||||
// 使用反射调用 ApplyThemeToAllPanels 方法
|
||||
var method = window.GetType().GetMethod("ApplyThemeToAllPanels",
|
||||
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
method.Invoke(window, null);
|
||||
}
|
||||
|
||||
// 同时调用 ApplyTheme 方法更新窗口本身
|
||||
var applyThemeMethod = window.GetType().GetMethod("ApplyTheme",
|
||||
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
if (applyThemeMethod != null)
|
||||
{
|
||||
applyThemeMethod.Invoke(window, null);
|
||||
}
|
||||
|
||||
break; // 通常只有一个设置窗口
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"通知设置窗口主题更新失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 强制更新所有设置面板的主题(公共方法,可在外部调用)
|
||||
/// </summary>
|
||||
public static void ForceUpdateAllPanelsTheme()
|
||||
{
|
||||
NotifySettingsWindowThemeUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 ComboBox 事件处理方法(增强版,支持主题更新通知)
|
||||
/// </summary>
|
||||
public static void InvokeComboBoxSelectionChangedWithThemeCheck(string comboBoxName, object selectedItem)
|
||||
{
|
||||
InvokeComboBoxSelectionChanged(comboBoxName, selectedItem);
|
||||
NotifyThemeUpdateIfNeeded(comboBoxName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调用 MainWindow 中的 ToggleSwitch 事件处理方法(增强版,支持主题更新通知)
|
||||
/// </summary>
|
||||
public static void InvokeToggleSwitchToggledWithThemeCheck(string toggleSwitchName, bool isOn)
|
||||
{
|
||||
InvokeToggleSwitchToggled(toggleSwitchName, isOn);
|
||||
NotifyThemeUpdateIfNeeded(toggleSwitchName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为控件树中的所有交互控件启用触摸支持(公共方法,可在外部调用)
|
||||
/// </summary>
|
||||
/// <param name="parent">父控件</param>
|
||||
public static void EnableTouchSupportForControls(DependencyObject parent)
|
||||
{
|
||||
if (parent == null) return;
|
||||
|
||||
for (int i = 0; i < Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = Media.VisualTreeHelper.GetChild(parent, i);
|
||||
|
||||
// 为 Border 控件(ToggleSwitch、选项按钮等)启用触摸支持
|
||||
if (child is Border border)
|
||||
{
|
||||
// 检查是否是交互控件(有 Tag 或 Cursor 为 Hand)
|
||||
if (border.Tag != null || border.Cursor == Cursors.Hand)
|
||||
{
|
||||
border.IsManipulationEnabled = true;
|
||||
|
||||
// 添加触摸事件支持,将触摸事件转换为鼠标事件
|
||||
border.TouchDown += (s, e) =>
|
||||
{
|
||||
var touchPoint = e.GetTouchPoint(border);
|
||||
var mouseEvent = new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left)
|
||||
{
|
||||
RoutedEvent = UIElement.MouseLeftButtonDownEvent,
|
||||
Source = border
|
||||
};
|
||||
border.RaiseEvent(mouseEvent);
|
||||
border.CaptureTouch(e.TouchDevice);
|
||||
e.Handled = true;
|
||||
};
|
||||
|
||||
// 添加触摸释放事件
|
||||
border.TouchUp += (s, e) =>
|
||||
{
|
||||
border.ReleaseTouchCapture(e.TouchDevice);
|
||||
e.Handled = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
// 为 Button 控件启用触摸支持
|
||||
else if (child is Button button)
|
||||
{
|
||||
button.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 ComboBox 启用触摸支持
|
||||
else if (child is ComboBox comboBox)
|
||||
{
|
||||
comboBox.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 Slider 启用触摸支持
|
||||
else if (child is Slider slider)
|
||||
{
|
||||
slider.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 TextBox 启用触摸支持
|
||||
else if (child is TextBox textBox)
|
||||
{
|
||||
textBox.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 CheckBox 启用触摸支持
|
||||
else if (child is CheckBox checkBox)
|
||||
{
|
||||
checkBox.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 RadioButton 启用触摸支持
|
||||
else if (child is RadioButton radioButton)
|
||||
{
|
||||
radioButton.IsManipulationEnabled = true;
|
||||
}
|
||||
|
||||
// 递归处理子元素
|
||||
EnableTouchSupportForControls(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,580 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<!-- PPT联动设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="此部分的设置项将会在幻灯片播放时使用,优先级高于其他设置项"
|
||||
Foreground="#9a9996" FontSize="11" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/Powerpoint.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="Microsoft PowerPoint 支持" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSupportPowerPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="SupportPowerPoint" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/Powerpoint.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="PowerPoint 联动增强" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchPowerPointEnhancement" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="PowerPointEnhancement" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-png/WPS.png" Margin="0,0,6,0" Width="28" Height="28" VerticalAlignment="Center"/>
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="WPS 支持" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSupportWPS" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="SupportWPS" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="WPP进程查杀(防止WPP残留进程)" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="关闭后将不会自动查杀WPP残留进程,可能导致WPP关闭卡顿或无法彻底退出" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableWppProcessKill" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableWppProcessKill" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border BorderBrush="#ef4444" BorderThickness="2" Padding="8" CornerRadius="6" Background="#991b1b" Margin="0,12,0,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="20" Height="20">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="White"
|
||||
Geometry="F0 M24,24z M0,0z M10.478,6.91759C10.478,6.07778 11.1588,5.39697 11.9986,5.39697 12.8385,5.39697 13.5193,6.07778 13.5193,6.91759L13.5193,12.0001C13.5193,12.8399 12.8385,13.5207 11.9986,13.5207 11.1588,13.5207 10.478,12.8399 10.478,12.0001L10.478,6.91759z M10.478,17.0826C10.478,16.2427,11.1588,15.5619,11.9986,15.5619L12.0114,15.5619C12.8512,15.5619 13.532,16.2427 13.532,17.0826 13.532,17.9224 12.8512,18.6032 12.0114,18.6032L11.9986,18.6032C11.1588,18.6032,10.478,17.9224,10.478,17.0826z M12,0.75C5.7868,0.75 0.75,5.7868 0.75,12 0.75,18.2132 5.7868,23.25 12,23.25 18.2132,23.25 23.25,18.2132 23.25,12 23.25,5.7868 18.2132,0.75 12,0.75z M3.25,12C3.25,7.16751 7.16751,3.25 12,3.25 16.8325,3.25 20.75,7.16751 20.75,12 20.75,16.8325 16.8325,20.75 12,20.75 7.16751,20.75 3.25,16.8325 3.25,12z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<TextBlock Margin="8,0,0,0" FontSize="13" VerticalAlignment="Center" Foreground="White"
|
||||
Text="开启WPS支持后会导致WPS关闭时卡顿!"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<TextBlock Text="如果您只使用PowerPoint请不要打开WPS联动开关,如果使用WPS建议不要使用PowerPoint!"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
<TextBlock Text="可支持 WPS,但目前无法同时支持 MSOffice 和 WPS。若要启用WPS支持,请确保 WPS 是否在 "配置工具" 中开启了 "WPS Office 兼容第三方系统和软件" 选项,否则将无法识别到WPS!"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,8,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- PPT翻页按钮设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="PPT翻页按钮" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Border ClipToBounds="True" Width="324" Height="182" Margin="0,0,0,12">
|
||||
<Grid>
|
||||
<Image Source="Resources/PresentationExample/page.jpg" Width="324" Height="182" Stretch="Fill"/>
|
||||
<Image x:Name="PPTBtnPreviewToolbar" Source="Resources/PresentationExample/toolbar.png" Height="16"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Center" Stretch="Uniform"/>
|
||||
<Image x:Name="PPTBtnPreviewLS" Source="Resources/PresentationExample/sidebar-white.png" Width="10" Height="30"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewLSTransform"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image x:Name="PPTBtnPreviewRS" Source="Resources/PresentationExample/sidebar-white.png" Width="10" Height="30"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewRSTransform"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image x:Name="PPTBtnPreviewLB" Source="Resources/PresentationExample/bottombar-white.png" Height="10" Width="30"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Left" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewLBTransform"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image x:Name="PPTBtnPreviewRB" Source="Resources/PresentationExample/bottombar-white.png" Height="10" Width="30"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform x:Name="PPTBtnPreviewRBTransform"/>
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在 PPT 模式下显示翻页按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在PPT放映模式下显示翻页控制按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowPPTButton" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowPPTButton" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<StackPanel x:Name="PPTButtonSettingsPanel" Margin="0,12,0,0" Visibility="Visible">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,12">
|
||||
<CheckBox x:Name="CheckboxEnableLBPPTButton" IsChecked="True" Content="左下" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxEnableRBPPTButton" IsChecked="True" Content="右下" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxEnableLSPPTButton" IsChecked="True" Content="左侧" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxEnableRSPPTButton" IsChecked="True" Content="右侧" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</StackPanel>
|
||||
<Grid Height="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="左侧偏移" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调大往上偏移,调小往下偏移,修改为0为不偏移,居中放置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTButtonLeftPositionValueSlider" Grid.Column="0" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonPositionSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTButtonLeftPositionValueText" Grid.Column="1" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="右侧偏移" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调大往右偏移,调小往左偏移,修改为0为不偏移,居中放置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTButtonRightPositionValueSlider" Grid.Column="0" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonPositionSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTButtonRightPositionValueText" Grid.Column="1" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="左下偏移" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整左下按钮的位置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTButtonLBPositionValueSlider" Grid.Column="0" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonPositionSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTButtonLBPositionValueText" Grid.Column="1" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="右下偏移" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整右下按钮的位置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTButtonRBPositionValueSlider" Grid.Column="0" Minimum="-500" Maximum="500" Value="0" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonPositionSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTButtonRBPositionValueText" Grid.Column="1" Text="0" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<TextBlock Text="两侧按钮设置" FontWeight="Bold" Foreground="#2e3436" FontSize="16" Margin="0,0,0,8"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,8">
|
||||
<CheckBox x:Name="CheckboxSPPTDisplayPage" IsChecked="True" Content="显示页码" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxSPPTHalfOpacity" IsChecked="True" Content="半透明" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxSPPTBlackBackground" IsChecked="True" Content="黑色背景" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel x:Name="PPTLSButtonOpacityPanel" Margin="0,8,0,8" Visibility="Visible">
|
||||
<Grid Height="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="左侧按钮透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整左侧翻页按钮的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTLSButtonOpacityValueSlider" Grid.Column="0" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonOpacitySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTLSButtonOpacityValueText" Grid.Column="1" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel x:Name="PPTRSButtonOpacityPanel" Margin="0,8,0,8" Visibility="Visible">
|
||||
<Grid Height="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="右侧按钮透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整右侧翻页按钮的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTRSButtonOpacityValueSlider" Grid.Column="0" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonOpacitySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTRSButtonOpacityValueText" Grid.Column="1" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<TextBlock Text="左下右下按钮设置" FontWeight="Bold" Foreground="#2e3436" FontSize="16" Margin="0,0,0,8"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,8">
|
||||
<CheckBox x:Name="CheckboxBPPTDisplayPage" IsChecked="True" Content="显示页码" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxBPPTHalfOpacity" IsChecked="True" Content="半透明" Margin="0,0,16,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
<CheckBox x:Name="CheckboxBPPTBlackBackground" IsChecked="True" Content="黑色背景" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</StackPanel>
|
||||
<StackPanel x:Name="PPTLBButtonOpacityPanel" Margin="0,8,0,8" Visibility="Visible">
|
||||
<Grid Height="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="左下按钮透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整左下翻页按钮的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTLBButtonOpacityValueSlider" Grid.Column="0" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonOpacitySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTLBButtonOpacityValueText" Grid.Column="1" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel x:Name="PPTRBButtonOpacityPanel" Margin="0,8,0,8" Visibility="Visible">
|
||||
<Grid Height="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="右下按钮透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整右下翻页按钮的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Slider x:Name="PPTRBButtonOpacityValueSlider" Grid.Column="0" Minimum="0.1" Maximum="1.0" Value="0.5" TickFrequency="0.1" IsSnapToTickEnabled="True" ValueChanged="PPTButtonOpacitySlider_ValueChanged"/>
|
||||
<TextBlock x:Name="PPTRBButtonOpacityValueText" Grid.Column="1" Text="0.5" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" TextAlignment="Left"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0" Margin="0,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="PPT 页码按钮可点击" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后,点击页码按钮可以唤起PowerPoint自带的网格缩略图视图。WPS不支持该功能" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnablePPTButtonPageClickable" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,0,0" Tag="EnablePPTButtonPageClickable" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0" Margin="0,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="PPT 翻页按钮长按翻页" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后,长按PPT翻页按钮可以连续翻页,提高翻页效率" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnablePPTButtonLongPressPageTurn" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,0,0" Tag="EnablePPTButtonLongPressPageTurn" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid MinHeight="54">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0" Margin="0,8,0,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="点击翻页时跳过转场动画,直接切到下一张" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后,点击下一页按钮时会跳过幻灯片之间的转场动画,直接跳转到下一张幻灯片。不会影响幻灯片内的元素动画" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSkipAnimationsWhenGoNext" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Grid.Column="1" VerticalAlignment="Top" Margin="0,8,0,0" Tag="SkipAnimationsWhenGoNext" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- PPT放映模式设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="进入 PPT 放映时自动进入批注模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="进入PPT放映时自动切换到批注模式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowCanvasAtNewSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="ShowCanvasAtNewSlideShow" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border BorderBrush="#ef4444" BorderThickness="2" Padding="8" CornerRadius="6" Background="#991b1b" Margin="0,8,0,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="20" Height="20">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="White"
|
||||
Geometry="F0 M24,24z M0,0z M10.478,6.91759C10.478,6.07778 11.1588,5.39697 11.9986,5.39697 12.8385,5.39697 13.5193,6.07778 13.5193,6.91759L13.5193,12.0001C13.5193,12.8399 12.8385,13.5207 11.9986,13.5207 11.1588,13.5207 10.478,12.8399 10.478,12.0001L10.478,6.91759z M10.478,17.0826C10.478,16.2427,11.1588,15.5619,11.9986,15.5619L12.0114,15.5619C12.8512,15.5619 13.532,16.2427 13.532,17.0826 13.532,17.9224 12.8512,18.6032 12.0114,18.6032L11.9986,18.6032C11.1588,18.6032,10.478,17.9224,10.478,17.0826z M12,0.75C5.7868,0.75 0.75,5.7868 0.75,12 0.75,18.2132 5.7868,23.25 12,23.25 18.2132,23.25 23.25,18.2132 23.25,12 23.25,5.7868 18.2132,0.75 12,0.75z M3.25,12C3.25,7.16751 7.16751,3.25 12,3.25 16.8325,3.25 20.75,7.16751 20.75,12 20.75,16.8325 16.8325,20.75 12,20.75 7.16751,20.75 3.25,16.8325 3.25,12z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<TextBlock Margin="8,0,0,0" FontSize="13" VerticalAlignment="Center" Foreground="White"
|
||||
Text="该项与"自动化"中的"播放PPT时自动收纳"选项冲突!"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="允许幻灯片模式下的双指手势" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在幻灯片模式下允许使用双指手势" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTwoFingerGestureInPresentationMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableTwoFingerGestureInPresentationMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="允许使用手指手势进行幻灯片翻页" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="在幻灯片放映模式下,当画板无墨迹时,使用手指左右滑动即可控制幻灯片翻页" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableFingerGestureSlideShowControl" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableFingerGestureSlideShowControl" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="PPT 放映模式显示手势按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后在 PPT 放映模式下也显示手势按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchShowGestureButtonInSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="ShowGestureButtonInSlideShow" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- PPT时间胶囊设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="PPT时间显示胶囊" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="开启后在 PPT 放映模式下显示时间胶囊,可替代最小化计时器窗口" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnablePPTTimeCapsule" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnablePPTTimeCapsule" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="时间胶囊位置" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择时间胶囊在屏幕上的显示位置" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="PPTTimeCapsulePositionTopLeftBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="PPTTimeCapsulePosition_TopLeft" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="左上角"/>
|
||||
</Border>
|
||||
<Border x:Name="PPTTimeCapsulePositionTopRightBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PPTTimeCapsulePosition_TopRight" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="右上角"/>
|
||||
</Border>
|
||||
<Border x:Name="PPTTimeCapsulePositionTopCenterBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="PPTTimeCapsulePosition_TopCenter" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="顶部居中"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- PPT提示设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="记忆并提示上次播放位置" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后会记录上次播放的页数,点击"是"后会自动跳转" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchNotifyPreviousPage" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="NotifyPreviousPage" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="进入放映时回到首页" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="进入PPT放映时自动跳转到第一页" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAlwaysGoToFirstPageOnReenter" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AlwaysGoToFirstPageOnReenter" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="提示隐藏幻灯片" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在播放隐藏幻灯片时显示提示" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchNotifyHiddenPage" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="NotifyHiddenPage" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="提示是否已启用自动播放" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在PPT自动播放时显示提示" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchNotifyAutoPlayPresentation" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="NotifyAutoPlayPresentation" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +14,41 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class PowerPointPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public PowerPointPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += PowerPointPanel_Loaded;
|
||||
}
|
||||
|
||||
private void PowerPointPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"PowerPointPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +66,583 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.PowerPointSettings == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
|
||||
// Microsoft PowerPoint 支持
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSupportPowerPoint"), pptSettings.PowerPointSupport);
|
||||
|
||||
// PowerPoint 联动增强
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchPowerPointEnhancement"), pptSettings.EnablePowerPointEnhancement);
|
||||
|
||||
// WPS 支持
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSupportWPS"), pptSettings.IsSupportWPS);
|
||||
|
||||
// WPP进程查杀
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableWppProcessKill"), pptSettings.EnableWppProcessKill);
|
||||
|
||||
// 在 PPT 模式下显示翻页按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowPPTButton"), pptSettings.ShowPPTButton);
|
||||
if (PPTButtonSettingsPanel != null)
|
||||
{
|
||||
PPTButtonSettingsPanel.Visibility = pptSettings.ShowPPTButton ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// PPT按钮显示选项
|
||||
var dops = pptSettings.PPTButtonsDisplayOption.ToString();
|
||||
var dopsc = dops.ToCharArray();
|
||||
if (dopsc.Length >= 4)
|
||||
{
|
||||
if (CheckboxEnableLBPPTButton != null) CheckboxEnableLBPPTButton.IsChecked = dopsc[0] == '2';
|
||||
if (CheckboxEnableRBPPTButton != null) CheckboxEnableRBPPTButton.IsChecked = dopsc[1] == '2';
|
||||
if (CheckboxEnableLSPPTButton != null) CheckboxEnableLSPPTButton.IsChecked = dopsc[2] == '2';
|
||||
if (CheckboxEnableRSPPTButton != null) CheckboxEnableRSPPTButton.IsChecked = dopsc[3] == '2';
|
||||
}
|
||||
|
||||
// 按钮位置
|
||||
if (PPTButtonLeftPositionValueSlider != null)
|
||||
{
|
||||
PPTButtonLeftPositionValueSlider.Value = pptSettings.PPTLSButtonPosition;
|
||||
if (PPTButtonLeftPositionValueText != null)
|
||||
{
|
||||
PPTButtonLeftPositionValueText.Text = pptSettings.PPTLSButtonPosition.ToString();
|
||||
}
|
||||
}
|
||||
if (PPTButtonRightPositionValueSlider != null)
|
||||
{
|
||||
PPTButtonRightPositionValueSlider.Value = pptSettings.PPTRSButtonPosition;
|
||||
if (PPTButtonRightPositionValueText != null)
|
||||
{
|
||||
PPTButtonRightPositionValueText.Text = pptSettings.PPTRSButtonPosition.ToString();
|
||||
}
|
||||
}
|
||||
if (PPTButtonLBPositionValueSlider != null)
|
||||
{
|
||||
PPTButtonLBPositionValueSlider.Value = pptSettings.PPTLBButtonPosition;
|
||||
if (PPTButtonLBPositionValueText != null)
|
||||
{
|
||||
PPTButtonLBPositionValueText.Text = pptSettings.PPTLBButtonPosition.ToString();
|
||||
}
|
||||
}
|
||||
if (PPTButtonRBPositionValueSlider != null)
|
||||
{
|
||||
PPTButtonRBPositionValueSlider.Value = pptSettings.PPTRBButtonPosition;
|
||||
if (PPTButtonRBPositionValueText != null)
|
||||
{
|
||||
PPTButtonRBPositionValueText.Text = pptSettings.PPTRBButtonPosition.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// 两侧按钮选项
|
||||
var sops = pptSettings.PPTSButtonsOption.ToString();
|
||||
var sopsc = sops.ToCharArray();
|
||||
if (sopsc.Length >= 3)
|
||||
{
|
||||
if (CheckboxSPPTDisplayPage != null) CheckboxSPPTDisplayPage.IsChecked = sopsc[0] == '2';
|
||||
if (CheckboxSPPTHalfOpacity != null) CheckboxSPPTHalfOpacity.IsChecked = sopsc[1] == '2';
|
||||
if (CheckboxSPPTBlackBackground != null) CheckboxSPPTBlackBackground.IsChecked = sopsc[2] == '2';
|
||||
}
|
||||
|
||||
// 左下右下按钮选项
|
||||
var bops = pptSettings.PPTBButtonsOption.ToString();
|
||||
var bopsc = bops.ToCharArray();
|
||||
if (bopsc.Length >= 3)
|
||||
{
|
||||
if (CheckboxBPPTDisplayPage != null) CheckboxBPPTDisplayPage.IsChecked = bopsc[0] == '2';
|
||||
if (CheckboxBPPTHalfOpacity != null) CheckboxBPPTHalfOpacity.IsChecked = bopsc[1] == '2';
|
||||
if (CheckboxBPPTBlackBackground != null) CheckboxBPPTBlackBackground.IsChecked = bopsc[2] == '2';
|
||||
}
|
||||
|
||||
// 按钮透明度
|
||||
if (PPTLSButtonOpacityValueSlider != null)
|
||||
{
|
||||
PPTLSButtonOpacityValueSlider.Value = pptSettings.PPTLSButtonOpacity > 0 ? pptSettings.PPTLSButtonOpacity : 0.5;
|
||||
if (PPTLSButtonOpacityValueText != null)
|
||||
{
|
||||
PPTLSButtonOpacityValueText.Text = PPTLSButtonOpacityValueSlider.Value.ToString("F1");
|
||||
}
|
||||
}
|
||||
if (PPTRSButtonOpacityValueSlider != null)
|
||||
{
|
||||
PPTRSButtonOpacityValueSlider.Value = pptSettings.PPTRSButtonOpacity > 0 ? pptSettings.PPTRSButtonOpacity : 0.5;
|
||||
if (PPTRSButtonOpacityValueText != null)
|
||||
{
|
||||
PPTRSButtonOpacityValueText.Text = PPTRSButtonOpacityValueSlider.Value.ToString("F1");
|
||||
}
|
||||
}
|
||||
if (PPTLBButtonOpacityValueSlider != null)
|
||||
{
|
||||
PPTLBButtonOpacityValueSlider.Value = pptSettings.PPTLBButtonOpacity > 0 ? pptSettings.PPTLBButtonOpacity : 0.5;
|
||||
if (PPTLBButtonOpacityValueText != null)
|
||||
{
|
||||
PPTLBButtonOpacityValueText.Text = PPTLBButtonOpacityValueSlider.Value.ToString("F1");
|
||||
}
|
||||
}
|
||||
if (PPTRBButtonOpacityValueSlider != null)
|
||||
{
|
||||
PPTRBButtonOpacityValueSlider.Value = pptSettings.PPTRBButtonOpacity > 0 ? pptSettings.PPTRBButtonOpacity : 0.5;
|
||||
if (PPTRBButtonOpacityValueText != null)
|
||||
{
|
||||
PPTRBButtonOpacityValueText.Text = PPTRBButtonOpacityValueSlider.Value.ToString("F1");
|
||||
}
|
||||
}
|
||||
|
||||
// PPT 页码按钮可点击
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePPTButtonPageClickable"), pptSettings.EnablePPTButtonPageClickable);
|
||||
|
||||
// PPT 翻页按钮长按翻页
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePPTButtonLongPressPageTurn"), pptSettings.EnablePPTButtonLongPressPageTurn);
|
||||
|
||||
// 点击翻页时跳过转场动画
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSkipAnimationsWhenGoNext"), pptSettings.SkipAnimationsWhenGoNext);
|
||||
|
||||
// 进入 PPT 放映时自动进入批注模式
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowCanvasAtNewSlideShow"), pptSettings.IsShowCanvasAtNewSlideShow);
|
||||
|
||||
// 允许幻灯片模式下的双指手势
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableTwoFingerGestureInPresentationMode"), pptSettings.IsEnableTwoFingerGestureInPresentationMode);
|
||||
|
||||
// 允许使用手指手势进行幻灯片翻页
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableFingerGestureSlideShowControl"), pptSettings.IsEnableFingerGestureSlideShowControl);
|
||||
|
||||
// PPT 放映模式显示手势按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchShowGestureButtonInSlideShow"), pptSettings.ShowGestureButtonInSlideShow);
|
||||
|
||||
// PPT时间显示胶囊
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnablePPTTimeCapsule"), pptSettings.EnablePPTTimeCapsule);
|
||||
|
||||
// 时间胶囊位置
|
||||
SetOptionButtonState("PPTTimeCapsulePosition", pptSettings.PPTTimeCapsulePosition);
|
||||
|
||||
// 记忆并提示上次播放位置
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchNotifyPreviousPage"), pptSettings.IsNotifyPreviousPage);
|
||||
|
||||
// 进入放映时回到首页
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAlwaysGoToFirstPageOnReenter"), pptSettings.IsAlwaysGoToFirstPageOnReenter);
|
||||
|
||||
// 提示隐藏幻灯片
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchNotifyHiddenPage"), pptSettings.IsNotifyHiddenPage);
|
||||
|
||||
// 提示是否已启用自动播放
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchNotifyAutoPlayPresentation"), pptSettings.IsNotifyAutoPlayPresentation);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载PowerPoint设置时出错: {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
{
|
||||
{ "PPTTimeCapsulePosition", new[] { "TopLeft", "TopRight", "TopCenter" } }
|
||||
};
|
||||
|
||||
if (!buttons.ContainsKey(group)) return;
|
||||
|
||||
string[] buttonNames = buttons[group];
|
||||
|
||||
for (int i = 0; i < buttonNames.Length; i++)
|
||||
{
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
if (pptSettings == null) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "SupportPowerPoint":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSupportPowerPoint", newState);
|
||||
break;
|
||||
|
||||
case "PowerPointEnhancement":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchPowerPointEnhancement", newState);
|
||||
break;
|
||||
|
||||
case "SupportWPS":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSupportWPS", newState);
|
||||
break;
|
||||
|
||||
case "EnableWppProcessKill":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableWppProcessKill", newState);
|
||||
break;
|
||||
|
||||
case "ShowPPTButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowPPTButton", newState);
|
||||
// 更新UI状态
|
||||
if (PPTButtonSettingsPanel != null)
|
||||
{
|
||||
PPTButtonSettingsPanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "EnablePPTButtonPageClickable":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePPTButtonPageClickable", newState);
|
||||
break;
|
||||
|
||||
case "EnablePPTButtonLongPressPageTurn":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePPTButtonLongPressPageTurn", newState);
|
||||
break;
|
||||
|
||||
case "SkipAnimationsWhenGoNext":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSkipAnimationsWhenGoNext", newState);
|
||||
break;
|
||||
|
||||
case "ShowCanvasAtNewSlideShow":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowCanvasAtNewSlideShow", newState);
|
||||
break;
|
||||
|
||||
case "EnableTwoFingerGestureInPresentationMode":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableTwoFingerGestureInPresentationMode", newState);
|
||||
break;
|
||||
|
||||
case "EnableFingerGestureSlideShowControl":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableFingerGestureSlideShowControl", newState);
|
||||
break;
|
||||
|
||||
case "ShowGestureButtonInSlideShow":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchShowGestureButtonInSlideShow", newState);
|
||||
break;
|
||||
|
||||
case "EnablePPTTimeCapsule":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnablePPTTimeCapsule", newState);
|
||||
break;
|
||||
|
||||
case "NotifyPreviousPage":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchNotifyPreviousPage", newState);
|
||||
break;
|
||||
|
||||
case "AlwaysGoToFirstPageOnReenter":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAlwaysGoToFirstPageOnReenter", newState);
|
||||
break;
|
||||
|
||||
case "NotifyHiddenPage":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchNotifyHiddenPage", newState);
|
||||
break;
|
||||
|
||||
case "NotifyAutoPlayPresentation":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchNotifyAutoPlayPresentation", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
string[] parts = tag.Split('_');
|
||||
if (parts.Length < 2) return;
|
||||
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (child is Border childBorder && childBorder != border)
|
||||
{
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
if (pptSettings == null) return;
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "PPTTimeCapsulePosition":
|
||||
int position;
|
||||
switch (value)
|
||||
{
|
||||
case "TopLeft":
|
||||
position = 0;
|
||||
break;
|
||||
case "TopRight":
|
||||
position = 1;
|
||||
break;
|
||||
case "TopCenter":
|
||||
position = 2;
|
||||
break;
|
||||
default:
|
||||
position = 1;
|
||||
break;
|
||||
}
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
pptSettings.PPTTimeCapsulePosition = position;
|
||||
}, "PPTTimeCapsulePosition");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CheckBox变化事件处理
|
||||
/// </summary>
|
||||
private void CheckBox_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var checkBox = sender as CheckBox;
|
||||
if (checkBox == null) return;
|
||||
|
||||
string name = checkBox.Name;
|
||||
var pptSettings = MainWindow.Settings.PowerPointSettings;
|
||||
if (pptSettings == null) return;
|
||||
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged(name, checkBox.IsChecked ?? false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void PPTButtonPositionSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var slider = sender as Slider;
|
||||
if (slider == null) return;
|
||||
|
||||
string name = slider.Name;
|
||||
double value = slider.Value;
|
||||
|
||||
// 更新文本显示
|
||||
switch (name)
|
||||
{
|
||||
case "PPTButtonLeftPositionValueSlider":
|
||||
if (PPTButtonLeftPositionValueText != null)
|
||||
{
|
||||
PPTButtonLeftPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonLeftPositionValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTButtonRightPositionValueSlider":
|
||||
if (PPTButtonRightPositionValueText != null)
|
||||
{
|
||||
PPTButtonRightPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonRightPositionValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTButtonLBPositionValueSlider":
|
||||
if (PPTButtonLBPositionValueText != null)
|
||||
{
|
||||
PPTButtonLBPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonLBPositionValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTButtonRBPositionValueSlider":
|
||||
if (PPTButtonRBPositionValueText != null)
|
||||
{
|
||||
PPTButtonRBPositionValueText.Text = ((int)value).ToString();
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTButtonRBPositionValueSlider", value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按钮透明度Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void PPTButtonOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var slider = sender as Slider;
|
||||
if (slider == null) return;
|
||||
|
||||
string name = slider.Name;
|
||||
double value = slider.Value;
|
||||
|
||||
// 更新文本显示
|
||||
switch (name)
|
||||
{
|
||||
case "PPTLSButtonOpacityValueSlider":
|
||||
if (PPTLSButtonOpacityValueText != null)
|
||||
{
|
||||
PPTLSButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTLSButtonOpacityValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTRSButtonOpacityValueSlider":
|
||||
if (PPTRSButtonOpacityValueText != null)
|
||||
{
|
||||
PPTRSButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTRSButtonOpacityValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTLBButtonOpacityValueSlider":
|
||||
if (PPTLBButtonOpacityValueText != null)
|
||||
{
|
||||
PPTLBButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTLBButtonOpacityValueSlider", value);
|
||||
break;
|
||||
|
||||
case "PPTRBButtonOpacityValueSlider":
|
||||
if (PPTRBButtonOpacityValueText != null)
|
||||
{
|
||||
PPTRBButtonOpacityValueText.Text = value.ToString("F1");
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("PPTRBButtonOpacityValueSlider", value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"PowerPointPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="691" d:DesignWidth="910">
|
||||
<Grid Background="#fafafa" Margin="250,0,0,0">
|
||||
<Grid x:Name="SearchPanelMainGrid" Background="#fafafa" Margin="250,0,0,0">
|
||||
<!-- 搜索框区域 -->
|
||||
<Grid Height="48" VerticalAlignment="Top" Margin="0,0,0,0">
|
||||
<Border Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
|
||||
<Border x:Name="SearchPanelTopBarBorder" Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="-90" ShadowDepth="3" BlurRadius="4" Color="#000000" Opacity="0.25"/>
|
||||
</Border.Effect>
|
||||
@@ -20,7 +20,7 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 搜索输入框 -->
|
||||
<Border Grid.Column="0" Margin="60,8,12,8" Background="White" CornerRadius="8" BorderBrush="#e6e6e6" BorderThickness="1">
|
||||
<Border x:Name="SearchInputBorder" Grid.Column="0" Margin="60,8,12,8" Background="White" CornerRadius="8" BorderBrush="#e6e6e6" BorderThickness="1">
|
||||
<Grid>
|
||||
<Image Width="16" Height="16" Margin="12,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Image.Source>
|
||||
@@ -67,7 +67,7 @@
|
||||
<StackPanel Margin="60,12,60,24" Name="SearchResultsPanel">
|
||||
<!-- 精准和拼音匹配结果 -->
|
||||
<StackPanel Name="ExactMatchPanel" Visibility="Collapsed">
|
||||
<TextBlock Text="精准匹配" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<TextBlock x:Name="ExactMatchTitle" Text="精准匹配" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ItemsControl Name="ExactMatchItemsControl">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
<!-- 模糊匹配结果 -->
|
||||
<StackPanel Name="FuzzyMatchPanel" Visibility="Collapsed" Margin="0,16,0,0">
|
||||
<TextBlock Text="模糊匹配" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<TextBlock x:Name="FuzzyMatchTitle" Text="模糊匹配" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ItemsControl Name="FuzzyMatchItemsControl">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@@ -107,7 +107,7 @@
|
||||
|
||||
<!-- 相关项结果 -->
|
||||
<StackPanel Name="RelatedItemsPanel" Visibility="Collapsed" Margin="0,16,0,0">
|
||||
<TextBlock Text="相关项" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<TextBlock x:Name="RelatedItemsTitle" Text="相关项" FontSize="13" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ItemsControl Name="RelatedItemsControl">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
@@ -71,15 +71,12 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
// 随机点名
|
||||
new SettingItem { Title = "随机点名", Category = "随机点名", ItemName = "LuckyRandomItem", Type = SettingItemType.Category },
|
||||
|
||||
// 存储空间
|
||||
new SettingItem { Title = "存储空间", Category = "存储空间", ItemName = "StorageItem", Type = SettingItemType.Category },
|
||||
// 高级选项
|
||||
new SettingItem { Title = "高级选项", Category = "高级选项", ItemName = "AdvancedItem", Type = SettingItemType.Category },
|
||||
|
||||
// 截图和屏幕捕捉
|
||||
new SettingItem { Title = "截图和屏幕捕捉", Category = "截图和屏幕捕捉", ItemName = "SnapshotItem", Type = SettingItemType.Category },
|
||||
|
||||
// 高级选项
|
||||
new SettingItem { Title = "高级选项", Category = "高级选项", ItemName = "AdvancedItem", Type = SettingItemType.Category },
|
||||
|
||||
// 关于
|
||||
new SettingItem { Title = "关于 InkCanvasForClass", Category = "关于", ItemName = "AboutItem", Type = SettingItemType.Category },
|
||||
};
|
||||
@@ -380,6 +377,196 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
SearchTextBox.Text = text;
|
||||
PerformSearch(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isDarkTheme = ThemeHelper.IsDarkTheme;
|
||||
|
||||
// 更新主背景
|
||||
if (SearchPanelMainGrid != null)
|
||||
{
|
||||
SearchPanelMainGrid.Background = ThemeHelper.GetBackgroundPrimaryBrush();
|
||||
}
|
||||
|
||||
// 更新顶部栏背景
|
||||
if (SearchPanelTopBarBorder != null)
|
||||
{
|
||||
SearchPanelTopBarBorder.Background = ThemeHelper.GetBackgroundPrimaryBrush();
|
||||
}
|
||||
|
||||
// 更新搜索输入框
|
||||
if (SearchInputBorder != null)
|
||||
{
|
||||
SearchInputBorder.Background = ThemeHelper.GetTextBoxBackgroundBrush();
|
||||
SearchInputBorder.BorderBrush = ThemeHelper.GetTextBoxBorderBrush();
|
||||
}
|
||||
|
||||
// 更新搜索框文字颜色
|
||||
if (SearchTextBox != null)
|
||||
{
|
||||
SearchTextBox.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
|
||||
// 更新标题文字颜色
|
||||
if (ExactMatchTitle != null)
|
||||
{
|
||||
ExactMatchTitle.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
if (FuzzyMatchTitle != null)
|
||||
{
|
||||
FuzzyMatchTitle.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
if (RelatedItemsTitle != null)
|
||||
{
|
||||
RelatedItemsTitle.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
|
||||
// 更新无结果提示文字颜色
|
||||
if (NoResultsText != null)
|
||||
{
|
||||
NoResultsText.Foreground = ThemeHelper.GetTextSecondaryBrush();
|
||||
}
|
||||
|
||||
// 更新搜索框中的图标颜色
|
||||
UpdateSearchIconColor(isDarkTheme);
|
||||
|
||||
// 使用 ThemeHelper 递归更新其他元素(如搜索结果项)
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SearchPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新搜索框中的图标颜色
|
||||
/// </summary>
|
||||
private void UpdateSearchIconColor(bool isDarkTheme)
|
||||
{
|
||||
try
|
||||
{
|
||||
Color iconColor = isDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
// 查找搜索输入框中的图标
|
||||
if (SearchInputBorder != null)
|
||||
{
|
||||
var image = FindVisualChild<Image>(SearchInputBorder);
|
||||
if (image != null && image.Source is DrawingImage drawingImage)
|
||||
{
|
||||
if (drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
{
|
||||
var clonedDrawing = CloneDrawingGroup(drawingGroup, iconColor);
|
||||
image.Source = new DrawingImage { Drawing = clonedDrawing };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新搜索图标颜色时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 DrawingGroup 并更新颜色
|
||||
/// </summary>
|
||||
private DrawingGroup CloneDrawingGroup(DrawingGroup source, Color newColor)
|
||||
{
|
||||
var cloned = new DrawingGroup();
|
||||
cloned.ClipGeometry = source.ClipGeometry?.Clone();
|
||||
cloned.Opacity = source.Opacity;
|
||||
cloned.Transform = source.Transform?.Clone();
|
||||
|
||||
foreach (var drawing in source.Children)
|
||||
{
|
||||
if (drawing is GeometryDrawing geometryDrawing)
|
||||
{
|
||||
var clonedGeometry = geometryDrawing.Geometry?.Clone();
|
||||
var clonedBrush = CloneBrush(geometryDrawing.Brush, newColor);
|
||||
var clonedPen = geometryDrawing.Pen != null
|
||||
? ClonePen(geometryDrawing.Pen, newColor)
|
||||
: null;
|
||||
|
||||
cloned.Children.Add(new GeometryDrawing(clonedBrush, clonedPen, clonedGeometry));
|
||||
}
|
||||
else if (drawing is DrawingGroup subGroup)
|
||||
{
|
||||
cloned.Children.Add(CloneDrawingGroup(subGroup, newColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
cloned.Children.Add(drawing);
|
||||
}
|
||||
}
|
||||
|
||||
return cloned;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Brush 并更新颜色
|
||||
/// </summary>
|
||||
private Brush CloneBrush(Brush source, Color newColor)
|
||||
{
|
||||
if (source is SolidColorBrush solidBrush)
|
||||
{
|
||||
var originalColor = solidBrush.Color;
|
||||
if (originalColor.R == 34 && originalColor.G == 34 && originalColor.B == 34) // #222222
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
else if (originalColor.A > 0 && originalColor != Colors.Transparent &&
|
||||
originalColor.R < 50 && originalColor.G < 50 && originalColor.B < 50) // 深色
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
return new SolidColorBrush(originalColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
return source?.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Pen 并更新颜色
|
||||
/// </summary>
|
||||
private Pen ClonePen(Pen source, Color newColor)
|
||||
{
|
||||
var clonedBrush = CloneBrush(source.Brush, newColor);
|
||||
return new Pen(clonedBrush, source.Thickness)
|
||||
{
|
||||
StartLineCap = source.StartLineCap,
|
||||
EndLineCap = source.EndLineCap,
|
||||
LineJoin = source.LineJoin,
|
||||
MiterLimit = source.MiterLimit
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在视觉树中查找指定类型的子元素
|
||||
/// </summary>
|
||||
private T FindVisualChild<T>(DependencyObject parent) where T : DependencyObject
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is T result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
var childOfChild = FindVisualChild<T>(child);
|
||||
if (childOfChild != null)
|
||||
{
|
||||
return childOfChild;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class SettingItem
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置面板基类,提供通用的辅助方法
|
||||
/// </summary>
|
||||
public abstract class SettingsPanelBase : UserControl
|
||||
{
|
||||
protected bool _isLoaded = false;
|
||||
|
||||
public SettingsPanelBase()
|
||||
{
|
||||
Loaded += SettingsPanelBase_Loaded;
|
||||
}
|
||||
|
||||
private void SettingsPanelBase_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题(如果面板有 ApplyTheme 方法)
|
||||
try
|
||||
{
|
||||
var applyThemeMethod = this.GetType().GetMethod("ApplyTheme",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (applyThemeMethod != null)
|
||||
{
|
||||
applyThemeMethod.Invoke(this, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SettingsPanelBase 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
protected virtual void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为控件树中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupportForControls(DependencyObject parent)
|
||||
{
|
||||
if (parent == null) return;
|
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(parent, i);
|
||||
|
||||
// 为 Border 控件(ToggleSwitch、选项按钮等)启用触摸支持
|
||||
if (child is Border border)
|
||||
{
|
||||
// 检查是否是交互控件(有 Tag 或 Cursor 为 Hand)
|
||||
if (border.Tag != null || border.Cursor == Cursors.Hand)
|
||||
{
|
||||
border.IsManipulationEnabled = true;
|
||||
|
||||
// 添加触摸事件支持,将触摸事件转换为鼠标事件
|
||||
border.TouchDown += Border_TouchDown;
|
||||
border.PreviewTouchDown += Border_PreviewTouchDown;
|
||||
}
|
||||
}
|
||||
// 为 Button 控件启用触摸支持
|
||||
else if (child is Button button)
|
||||
{
|
||||
button.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 ComboBox 启用触摸支持
|
||||
else if (child is ComboBox comboBox)
|
||||
{
|
||||
comboBox.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 Slider 启用触摸支持
|
||||
else if (child is Slider slider)
|
||||
{
|
||||
slider.IsManipulationEnabled = true;
|
||||
}
|
||||
// 为 TextBox 启用触摸支持
|
||||
else if (child is TextBox textBox)
|
||||
{
|
||||
textBox.IsManipulationEnabled = true;
|
||||
}
|
||||
|
||||
// 递归处理子元素
|
||||
EnableTouchSupportForControls(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Border 触摸按下事件处理
|
||||
/// </summary>
|
||||
private void Border_TouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
// 获取触摸点位置
|
||||
var touchPoint = e.GetTouchPoint(border);
|
||||
|
||||
// 创建模拟的鼠标事件
|
||||
var mouseButtonEventArgs = new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left)
|
||||
{
|
||||
RoutedEvent = UIElement.MouseLeftButtonDownEvent,
|
||||
Source = border
|
||||
};
|
||||
|
||||
// 触发鼠标按下事件
|
||||
border.RaiseEvent(mouseButtonEventArgs);
|
||||
|
||||
// 捕获触摸设备
|
||||
border.CaptureTouch(e.TouchDevice);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Border 预览触摸按下事件处理
|
||||
/// </summary>
|
||||
private void Border_PreviewTouchDown(object sender, TouchEventArgs e)
|
||||
{
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
// 获取触摸点位置
|
||||
var touchPoint = e.GetTouchPoint(border);
|
||||
|
||||
// 创建模拟的鼠标事件
|
||||
var mouseButtonEventArgs = new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left)
|
||||
{
|
||||
RoutedEvent = UIElement.PreviewMouseLeftButtonDownEvent,
|
||||
Source = border
|
||||
};
|
||||
|
||||
// 触发预览鼠标按下事件
|
||||
border.RaiseEvent(mouseButtonEventArgs);
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI - 子类需要实现
|
||||
/// </summary>
|
||||
public abstract void LoadSettings();
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
protected Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
protected void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用的ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
protected virtual void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
HandleToggleSwitchChange(tag, newState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理ToggleSwitch变化 - 子类需要实现
|
||||
/// </summary>
|
||||
protected abstract void HandleToggleSwitchChange(string tag, bool newState);
|
||||
|
||||
/// <summary>
|
||||
/// 处理选项按钮变化 - 子类可以重写
|
||||
/// </summary>
|
||||
protected virtual void HandleOptionButtonChange(object sender, string tag)
|
||||
{
|
||||
// 默认实现:清除同组其他按钮的选中状态
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
string[] parts = tag.Split('_');
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (child is Border childBorder && childBorder != border)
|
||||
{
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
HandleOptionChange(group, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理选项变化 - 子类需要实现
|
||||
/// </summary>
|
||||
protected abstract void HandleOptionChange(string group, string value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"ShortcutsPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,164 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<!-- 截图设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="截图设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="清屏时自动截图" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="清空画布时自动保存当前画布截图" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSaveStrokesAtClear" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoSaveStrokesAtClear" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="截图分日期文件夹保存" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="截图按日期分类保存到不同文件夹" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchSaveScreenshotsInDateFolders" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="SaveScreenshotsInDateFolders" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="截图时自动保存墨迹" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="截图时同时保存当前画布的墨迹数据" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSaveStrokesAtScreenshot" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoSaveStrokesAtScreenshot" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动幻灯片截屏" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,在幻灯片有墨迹时翻页会自动截屏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoSaveScreenShotInPowerPoint" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoSaveScreenShotInPowerPoint" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动截图最小墨迹量" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置自动截图时所需的最小墨迹量" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="SideControlMinimumAutomationSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True" ValueChanged="SideControlMinimumAutomationSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="SideControlMinimumAutomationText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" FontFamily="Consolas"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 截图保存路径设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="截图保存路径" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<StackPanel Orientation="Vertical" Margin="0,8,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="墨迹与截图的保存路径" HorizontalAlignment="Left" Margin="0,0,0,8"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<TextBox x:Name="AutoSavedStrokesLocation" Width="320" Text="D:\Ink Canvas" TextWrapping="Wrap" TextChanged="AutoSavedStrokesLocation_TextChanged"/>
|
||||
<Button x:Name="AutoSavedStrokesLocationButton" Content="浏览" Padding="12,6" Margin="8,0,0,0" Background="#2563eb" Foreground="White" Click="AutoSavedStrokesLocationButton_Click"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Button x:Name="SetAutoSavedStrokesLocationToDiskDButton" Content="设置保存到 D:\Ink Canvas" Padding="12,6" Margin="0,0,8,0" Background="#2563eb" Foreground="White" Click="SetAutoSavedStrokesLocationToDiskDButton_Click"/>
|
||||
<Button x:Name="SetAutoSavedStrokesLocationToDocumentFolderButton" Content="设置保存到 文档" Padding="12,6" Background="#2563eb" Foreground="White" Click="SetAutoSavedStrokesLocationToDocumentFolderButton_Click"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="请注意检查保存文件夹是否有写入权限" TextWrapping="Wrap" Foreground="#9a9996" FontSize="11"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 自动清理设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="自动清理设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="定期自动删除超过保存时间的墨迹、截图文件" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后将会删除自动保存目录下所有后缀名为 .icstk 和 .png 的文件" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoDelSavedFiles" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AutoDelSavedFiles" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<StackPanel Orientation="Vertical" x:Name="AutoDelIntervalPanel" Visibility="Visible">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="保存时长" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="设置自动删除文件的保存时长" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<ComboBox x:Name="ComboBoxAutoDelSavedFilesDaysThreshold"
|
||||
Style="{StaticResource ComboBoxStyle}"
|
||||
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="150"
|
||||
SelectedIndex="4"
|
||||
SelectionChanged="ComboBoxAutoDelSavedFilesDaysThreshold_SelectionChanged">
|
||||
<ComboBoxItem Content="1天" Tag="AutoDelSavedFilesDaysThreshold_1"/>
|
||||
<ComboBoxItem Content="3天" Tag="AutoDelSavedFilesDaysThreshold_3"/>
|
||||
<ComboBoxItem Content="5天" Tag="AutoDelSavedFilesDaysThreshold_5"/>
|
||||
<ComboBoxItem Content="7天" Tag="AutoDelSavedFilesDaysThreshold_7"/>
|
||||
<ComboBoxItem Content="15天" Tag="AutoDelSavedFilesDaysThreshold_15" IsSelected="True"/>
|
||||
<ComboBoxItem Content="30天" Tag="AutoDelSavedFilesDaysThreshold_30"/>
|
||||
<ComboBoxItem Content="60天" Tag="AutoDelSavedFilesDaysThreshold_60"/>
|
||||
<ComboBoxItem Content="100天" Tag="AutoDelSavedFilesDaysThreshold_100"/>
|
||||
<ComboBoxItem Content="365天" Tag="AutoDelSavedFilesDaysThreshold_365"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -1,17 +1,54 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// SnapshotPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SnapshotPanel : UserControl
|
||||
public partial class SnapshotPanel : System.Windows.Controls.UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public SnapshotPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += SnapshotPanel_Loaded;
|
||||
}
|
||||
|
||||
private void SnapshotPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SnapshotPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +66,311 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
// 清屏时自动截图
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveStrokesAtClear"), MainWindow.Settings.Automation.IsAutoSaveStrokesAtClear);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchSaveScreenshotsInDateFolders"), MainWindow.Settings.Automation.IsSaveScreenshotsInDateFolders);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveStrokesAtScreenshot"), MainWindow.Settings.Automation.IsAutoSaveStrokesAtScreenshot);
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoDelSavedFiles"), MainWindow.Settings.Automation.AutoDelSavedFiles);
|
||||
|
||||
// 自动截图最小墨迹量
|
||||
if (SideControlMinimumAutomationSlider != null)
|
||||
{
|
||||
double minValue = MainWindow.Settings.Automation.MinimumAutomationStrokeNumber;
|
||||
if (minValue == 0) minValue = 1.0;
|
||||
SideControlMinimumAutomationSlider.Value = minValue;
|
||||
if (SideControlMinimumAutomationText != null)
|
||||
{
|
||||
SideControlMinimumAutomationText.Text = minValue.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 保存路径
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
AutoSavedStrokesLocation.Text = MainWindow.Settings.Automation.AutoSavedStrokesLocation;
|
||||
}
|
||||
|
||||
// 自动删除保存时长
|
||||
if (ComboBoxAutoDelSavedFilesDaysThreshold != null)
|
||||
{
|
||||
int days = MainWindow.Settings.Automation.AutoDelSavedFilesDaysThreshold;
|
||||
int selectedIndex = 4; // 默认15天
|
||||
switch (days)
|
||||
{
|
||||
case 1: selectedIndex = 0; break;
|
||||
case 3: selectedIndex = 1; break;
|
||||
case 5: selectedIndex = 2; break;
|
||||
case 7: selectedIndex = 3; break;
|
||||
case 15: selectedIndex = 4; break;
|
||||
case 30: selectedIndex = 5; break;
|
||||
case 60: selectedIndex = 6; break;
|
||||
case 100: selectedIndex = 7; break;
|
||||
case 365: selectedIndex = 8; break;
|
||||
}
|
||||
ComboBoxAutoDelSavedFilesDaysThreshold.SelectedIndex = selectedIndex;
|
||||
}
|
||||
|
||||
if (AutoDelIntervalPanel != null)
|
||||
{
|
||||
AutoDelIntervalPanel.Visibility = MainWindow.Settings.Automation.AutoDelSavedFiles ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
// 自动幻灯片截屏
|
||||
if (MainWindow.Settings.PowerPointSettings != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoSaveScreenShotInPowerPoint"), MainWindow.Settings.PowerPointSettings.IsAutoSaveScreenShotInPowerPoint);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载截图设置时出错: {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? System.Windows.HorizontalAlignment.Right : System.Windows.HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "AutoSaveStrokesAtClear":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSaveStrokesAtClear", newState);
|
||||
break;
|
||||
|
||||
case "SaveScreenshotsInDateFolders":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchSaveScreenshotsInDateFolders", newState);
|
||||
break;
|
||||
|
||||
case "AutoSaveStrokesAtScreenshot":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSaveStrokesAtScreenshot", newState);
|
||||
break;
|
||||
|
||||
case "AutoSaveScreenShotInPowerPoint":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoSaveScreenShotInPowerPoint", newState);
|
||||
break;
|
||||
|
||||
case "AutoDelSavedFiles":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoDelSavedFiles", newState);
|
||||
// 更新UI状态
|
||||
if (AutoDelIntervalPanel != null)
|
||||
{
|
||||
AutoDelIntervalPanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void SideControlMinimumAutomationSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (SideControlMinimumAutomationSlider != null && SideControlMinimumAutomationText != null)
|
||||
{
|
||||
double value = SideControlMinimumAutomationSlider.Value;
|
||||
SideControlMinimumAutomationText.Text = value.ToString("F2");
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("SideControlMinimumAutomationSlider", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存路径文本框变化事件处理
|
||||
/// </summary>
|
||||
private void AutoSavedStrokesLocation_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeTextBoxTextChanged("AutoSavedStrokesLocation", AutoSavedStrokesLocation.Text);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 浏览按钮点击事件处理
|
||||
/// </summary>
|
||||
private void AutoSavedStrokesLocationButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("AutoSavedStrokesLocationButton_Click", sender, e);
|
||||
// 同步新面板中的文本框
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var textBox = mainWindow.FindName("AutoSavedStrokesLocation") as System.Windows.Controls.TextBox;
|
||||
if (textBox != null)
|
||||
{
|
||||
AutoSavedStrokesLocation.Text = textBox.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置保存到 D:\Ink Canvas 按钮点击事件处理
|
||||
/// </summary>
|
||||
private void SetAutoSavedStrokesLocationToDiskDButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("SetAutoSavedStrokesLocationToDiskDButton_Click", sender, e);
|
||||
// 同步新面板中的文本框
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var textBox = mainWindow.FindName("AutoSavedStrokesLocation") as System.Windows.Controls.TextBox;
|
||||
if (textBox != null)
|
||||
{
|
||||
AutoSavedStrokesLocation.Text = textBox.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置保存到文档按钮点击事件处理
|
||||
/// </summary>
|
||||
private void SetAutoSavedStrokesLocationToDocumentFolderButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AutoSavedStrokesLocation != null)
|
||||
{
|
||||
string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
AutoSavedStrokesLocation.Text = Path.Combine(documentsPath, "Ink Canvas");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ComboBox选择变化事件处理
|
||||
/// </summary>
|
||||
private void ComboBoxAutoDelSavedFilesDaysThreshold_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (ComboBoxAutoDelSavedFilesDaysThreshold?.SelectedItem is ComboBoxItem selectedItem)
|
||||
{
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxAutoDelSavedFilesDaysThreshold") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
// 找到对应的选项并设置
|
||||
string tag = selectedItem.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(tag) && tag.StartsWith("AutoDelSavedFilesDaysThreshold_"))
|
||||
{
|
||||
string daysStr = tag.Replace("AutoDelSavedFilesDaysThreshold_", "");
|
||||
foreach (ComboBoxItem item in comboBox.Items)
|
||||
{
|
||||
if (item.Tag?.ToString() == tag || item.Content?.ToString() == daysStr + "天")
|
||||
{
|
||||
comboBox.SelectedItem = item;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxAutoDelSavedFilesDaysThreshold", item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
string tag = selectedItem.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(tag) && tag.StartsWith("AutoDelSavedFilesDaysThreshold_"))
|
||||
{
|
||||
string daysStr = tag.Replace("AutoDelSavedFilesDaysThreshold_", "");
|
||||
if (int.TryParse(daysStr, out int days))
|
||||
{
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
MainWindow.Settings.Automation.AutoDelSavedFilesDaysThreshold = days;
|
||||
}
|
||||
}, "ComboBoxAutoDelSavedFilesDaysThreshold");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"SnapshotPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,305 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 窗口设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="窗口无焦点模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="窗口失去焦点时仍可接收输入" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchNoFocusMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="NoFocusMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="窗口无边框模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="隐藏窗口边框,提供更沉浸的体验" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchWindowMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="WindowMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="窗口置顶" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="窗口始终显示在其他窗口之上" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAlwaysOnTop" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="AlwaysOnTop" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54" x:Name="UIAccessTopMostPanel" Visibility="Collapsed">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="UIA置顶" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用UIA方式实现置顶,需要管理员权限" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchUIAccessTopMost" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="UIAccessTopMost" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 更新设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动检查更新" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="定期检查是否有新版本可用" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsAutoUpdate" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsAutoUpdate" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="静默更新" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在软件不使用时自动安装更新,无需手动操作" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchIsAutoUpdateWithSilence" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsAutoUpdateWithSilence" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="更新通道" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择更新通道:稳定版提供可靠更新,测试版提供新功能抢先体验" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="UpdateChannelReleaseBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="UpdateChannel_Release" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="稳定版"/>
|
||||
</Border>
|
||||
<Border x:Name="UpdateChannelBetaBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UpdateChannel_Beta" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="测试版"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="手动更新" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="点击后立即检查并下载最新版本" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="ManualUpdateButton" Content="手动更新" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6" Click="ManualUpdateButton_Click"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="版本修复" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="根据当前选择的通道下载最新版本并执行安装,可用于修复损坏的安装" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="FixVersionButton" Content="版本修复" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6" Click="FixVersionButton_Click"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="历史版本回滚" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="回滚到之前的版本" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Button x:Name="HistoryRollbackButton" Content="历史版本回滚" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6" Click="HistoryRollbackButton_Click"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Margin="18,12,15,12" x:Name="AutoUpdateTimePeriodBlock">
|
||||
<StackPanel>
|
||||
<TextBlock Text="静默更新时间段" FontSize="15" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,12"/>
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Vertical" Margin="0,0,0,12">
|
||||
<TextBlock Text="起始时间" FontSize="14" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ComboBox x:Name="AutoUpdateWithSilenceStartTimeComboBox"
|
||||
Style="{StaticResource ComboBoxStyle}"
|
||||
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="150"
|
||||
SelectedIndex="6"
|
||||
SelectionChanged="AutoUpdateWithSilenceStartTimeComboBox_SelectionChanged">
|
||||
<ComboBoxItem Content="00:00" Tag="00"/>
|
||||
<ComboBoxItem Content="01:00" Tag="01"/>
|
||||
<ComboBoxItem Content="02:00" Tag="02"/>
|
||||
<ComboBoxItem Content="03:00" Tag="03"/>
|
||||
<ComboBoxItem Content="04:00" Tag="04"/>
|
||||
<ComboBoxItem Content="05:00" Tag="05"/>
|
||||
<ComboBoxItem Content="06:00" Tag="06" IsSelected="True"/>
|
||||
<ComboBoxItem Content="07:00" Tag="07"/>
|
||||
<ComboBoxItem Content="08:00" Tag="08"/>
|
||||
<ComboBoxItem Content="09:00" Tag="09"/>
|
||||
<ComboBoxItem Content="10:00" Tag="10"/>
|
||||
<ComboBoxItem Content="11:00" Tag="11"/>
|
||||
<ComboBoxItem Content="12:00" Tag="12"/>
|
||||
<ComboBoxItem Content="13:00" Tag="13"/>
|
||||
<ComboBoxItem Content="14:00" Tag="14"/>
|
||||
<ComboBoxItem Content="15:00" Tag="15"/>
|
||||
<ComboBoxItem Content="16:00" Tag="16"/>
|
||||
<ComboBoxItem Content="17:00" Tag="17"/>
|
||||
<ComboBoxItem Content="18:00" Tag="18"/>
|
||||
<ComboBoxItem Content="19:00" Tag="19"/>
|
||||
<ComboBoxItem Content="20:00" Tag="20"/>
|
||||
<ComboBoxItem Content="21:00" Tag="21"/>
|
||||
<ComboBoxItem Content="22:00" Tag="22"/>
|
||||
<ComboBoxItem Content="23:00" Tag="23"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical" Margin="0,0,0,0">
|
||||
<TextBlock Text="终止时间" FontSize="14" Foreground="#2e3436" Margin="0,0,0,8"/>
|
||||
<ComboBox x:Name="AutoUpdateWithSilenceEndTimeComboBox"
|
||||
Style="{StaticResource ComboBoxStyle}"
|
||||
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="150"
|
||||
SelectedIndex="22"
|
||||
SelectionChanged="AutoUpdateWithSilenceEndTimeComboBox_SelectionChanged">
|
||||
<ComboBoxItem Content="00:00" Tag="00"/>
|
||||
<ComboBoxItem Content="01:00" Tag="01"/>
|
||||
<ComboBoxItem Content="02:00" Tag="02"/>
|
||||
<ComboBoxItem Content="03:00" Tag="03"/>
|
||||
<ComboBoxItem Content="04:00" Tag="04"/>
|
||||
<ComboBoxItem Content="05:00" Tag="05"/>
|
||||
<ComboBoxItem Content="06:00" Tag="06"/>
|
||||
<ComboBoxItem Content="07:00" Tag="07"/>
|
||||
<ComboBoxItem Content="08:00" Tag="08"/>
|
||||
<ComboBoxItem Content="09:00" Tag="09"/>
|
||||
<ComboBoxItem Content="10:00" Tag="10"/>
|
||||
<ComboBoxItem Content="11:00" Tag="11"/>
|
||||
<ComboBoxItem Content="12:00" Tag="12"/>
|
||||
<ComboBoxItem Content="13:00" Tag="13"/>
|
||||
<ComboBoxItem Content="14:00" Tag="14"/>
|
||||
<ComboBoxItem Content="15:00" Tag="15"/>
|
||||
<ComboBoxItem Content="16:00" Tag="16"/>
|
||||
<ComboBoxItem Content="17:00" Tag="17"/>
|
||||
<ComboBoxItem Content="18:00" Tag="18"/>
|
||||
<ComboBoxItem Content="19:00" Tag="19"/>
|
||||
<ComboBoxItem Content="20:00" Tag="20"/>
|
||||
<ComboBoxItem Content="21:00" Tag="21"/>
|
||||
<ComboBoxItem Content="22:00" Tag="22" IsSelected="True"/>
|
||||
<ComboBoxItem Content="23:00" Tag="23"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<TextBlock Margin="0,8,0,0" Text="若终止时间小于起始时间,即将终止时间视为第二天的时间。若起始时间与终止时间相同,即视为全天候时间。"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 启动设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="开机时运行" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="系统启动时自动运行软件" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchRunAtStartup" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="RunAtStartup" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="开机运行后收纳到侧边栏" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开机启动后自动收纳到侧边栏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchFoldAtStartup" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="FoldAtStartup" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 模式设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="选择软件运行模式。仅PPT模式下,软件将完全隐藏,仅在PPT放映时出现。(实验性功能,可能不稳定。)"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="仅PPT模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用后,软件将完全隐藏,仅在PPT放映时出现" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="Mode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 插件管理 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="通过插件扩展InkCanvas的功能。您可以启用或禁用插件,或加载自定义插件。"
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,0,0,12"/>
|
||||
<Button x:Name="BtnOpenPluginManager" Content="打开插件管理器"
|
||||
HorizontalAlignment="Left" Padding="15,5"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,9 +13,50 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class StartupPanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public StartupPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += StartupPanel_Loaded;
|
||||
}
|
||||
|
||||
private void StartupPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"StartupPanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为控件树中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupportForControls(System.Windows.DependencyObject parent)
|
||||
{
|
||||
// 使用 MainWindowSettingsHelper 的通用方法
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(parent);
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -29,6 +74,447 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
// 自动更新设置
|
||||
var toggleSwitchIsAutoUpdate = FindToggleSwitch("ToggleSwitchIsAutoUpdate");
|
||||
if (toggleSwitchIsAutoUpdate != null)
|
||||
{
|
||||
bool isAutoUpdate = MainWindow.Settings.Startup.IsAutoUpdate;
|
||||
SetToggleSwitchState(toggleSwitchIsAutoUpdate, isAutoUpdate);
|
||||
}
|
||||
|
||||
// 静默更新设置
|
||||
var toggleSwitchIsAutoUpdateWithSilence = FindToggleSwitch("ToggleSwitchIsAutoUpdateWithSilence");
|
||||
if (toggleSwitchIsAutoUpdateWithSilence != null)
|
||||
{
|
||||
bool isAutoUpdateWithSilence = MainWindow.Settings.Startup.IsAutoUpdateWithSilence;
|
||||
SetToggleSwitchState(toggleSwitchIsAutoUpdateWithSilence, isAutoUpdateWithSilence);
|
||||
toggleSwitchIsAutoUpdateWithSilence.Visibility = MainWindow.Settings.Startup.IsAutoUpdate ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 静默更新时间段
|
||||
if (AutoUpdateTimePeriodBlock != null)
|
||||
{
|
||||
AutoUpdateTimePeriodBlock.Visibility =
|
||||
(MainWindow.Settings.Startup.IsAutoUpdateWithSilence && MainWindow.Settings.Startup.IsAutoUpdate) ?
|
||||
Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 设置时间选择器
|
||||
if (AutoUpdateWithSilenceStartTimeComboBox != null)
|
||||
{
|
||||
var startTime = MainWindow.Settings.Startup.AutoUpdateWithSilenceStartTime ?? "06:00";
|
||||
var startItem = AutoUpdateWithSilenceStartTimeComboBox.Items.Cast<ComboBoxItem>()
|
||||
.FirstOrDefault(item => item.Tag?.ToString() == startTime.Replace(":", ""));
|
||||
if (startItem != null)
|
||||
{
|
||||
AutoUpdateWithSilenceStartTimeComboBox.SelectedItem = startItem;
|
||||
}
|
||||
}
|
||||
|
||||
if (AutoUpdateWithSilenceEndTimeComboBox != null)
|
||||
{
|
||||
var endTime = MainWindow.Settings.Startup.AutoUpdateWithSilenceEndTime ?? "22:00";
|
||||
var endItem = AutoUpdateWithSilenceEndTimeComboBox.Items.Cast<ComboBoxItem>()
|
||||
.FirstOrDefault(item => item.Tag?.ToString() == endTime.Replace(":", ""));
|
||||
if (endItem != null)
|
||||
{
|
||||
AutoUpdateWithSilenceEndTimeComboBox.SelectedItem = endItem;
|
||||
}
|
||||
}
|
||||
|
||||
// 开机时运行
|
||||
var toggleSwitchRunAtStartup = FindToggleSwitch("ToggleSwitchRunAtStartup");
|
||||
if (toggleSwitchRunAtStartup != null)
|
||||
{
|
||||
// 检查启动项是否存在
|
||||
bool runAtStartup = System.IO.File.Exists(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\Ink Canvas Annotation.lnk");
|
||||
SetToggleSwitchState(toggleSwitchRunAtStartup, runAtStartup);
|
||||
}
|
||||
|
||||
// 启动时折叠
|
||||
var toggleSwitchFoldAtStartup = FindToggleSwitch("ToggleSwitchFoldAtStartup");
|
||||
if (toggleSwitchFoldAtStartup != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchFoldAtStartup, MainWindow.Settings.Startup.IsFoldAtStartup);
|
||||
}
|
||||
|
||||
// 窗口无焦点模式
|
||||
var toggleSwitchNoFocusMode = FindToggleSwitch("ToggleSwitchNoFocusMode");
|
||||
if (toggleSwitchNoFocusMode != null && MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchNoFocusMode, MainWindow.Settings.Advanced.IsNoFocusMode);
|
||||
}
|
||||
|
||||
// 窗口无边框模式
|
||||
var toggleSwitchWindowMode = FindToggleSwitch("ToggleSwitchWindowMode");
|
||||
if (toggleSwitchWindowMode != null && MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchWindowMode, MainWindow.Settings.Advanced.WindowMode);
|
||||
}
|
||||
|
||||
// 窗口置顶
|
||||
var toggleSwitchAlwaysOnTop = FindToggleSwitch("ToggleSwitchAlwaysOnTop");
|
||||
if (toggleSwitchAlwaysOnTop != null && MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchAlwaysOnTop, MainWindow.Settings.Advanced.IsAlwaysOnTop);
|
||||
}
|
||||
|
||||
// UIA置顶
|
||||
var toggleSwitchUIAccessTopMost = FindToggleSwitch("ToggleSwitchUIAccessTopMost");
|
||||
if (toggleSwitchUIAccessTopMost != null && MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchUIAccessTopMost, MainWindow.Settings.Advanced.EnableUIAccessTopMost);
|
||||
}
|
||||
|
||||
// 更新通道
|
||||
if (MainWindow.Settings.Startup.UpdateChannel == UpdateChannel.Release)
|
||||
{
|
||||
UpdateUpdateChannelButtons(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateUpdateChannelButtons(false);
|
||||
}
|
||||
|
||||
// 仅PPT模式
|
||||
var toggleSwitchMode = FindToggleSwitch("ToggleSwitchMode");
|
||||
if (toggleSwitchMode != null && MainWindow.Settings.ModeSettings != null)
|
||||
{
|
||||
SetToggleSwitchState(toggleSwitchMode, MainWindow.Settings.ModeSettings.IsPPTOnlyMode);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载启动设置时出错: {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn ? new SolidColorBrush(Color.FromRgb(53, 132, 228)) : new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "IsAutoUpdate":
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsAutoUpdate", newState);
|
||||
// 更新UI状态
|
||||
var toggleSwitchIsAutoUpdateWithSilence = FindToggleSwitch("ToggleSwitchIsAutoUpdateWithSilence");
|
||||
if (toggleSwitchIsAutoUpdateWithSilence != null)
|
||||
{
|
||||
toggleSwitchIsAutoUpdateWithSilence.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
if (AutoUpdateTimePeriodBlock != null)
|
||||
{
|
||||
AutoUpdateTimePeriodBlock.Visibility =
|
||||
(MainWindow.Settings.Startup.IsAutoUpdateWithSilence && MainWindow.Settings.Startup.IsAutoUpdate) ?
|
||||
Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "IsAutoUpdateWithSilence":
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchIsAutoUpdateWithSilence", newState);
|
||||
// 更新UI状态
|
||||
if (AutoUpdateTimePeriodBlock != null)
|
||||
{
|
||||
AutoUpdateTimePeriodBlock.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "RunAtStartup":
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchRunAtStartup", newState);
|
||||
break;
|
||||
|
||||
case "FoldAtStartup":
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchFoldAtStartup", newState);
|
||||
break;
|
||||
|
||||
case "NoFocusMode":
|
||||
// 窗口无焦点模式
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
MainWindow.Settings.Advanced.IsNoFocusMode = newState;
|
||||
}
|
||||
}, "ToggleSwitchNoFocusMode");
|
||||
// 调用 ApplyNoFocusMode 方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("ApplyNoFocusMode");
|
||||
break;
|
||||
|
||||
case "WindowMode":
|
||||
// 窗口无边框模式
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchWindowMode", newState);
|
||||
break;
|
||||
|
||||
case "AlwaysOnTop":
|
||||
// 窗口置顶
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
MainWindow.Settings.Advanced.IsAlwaysOnTop = newState;
|
||||
}
|
||||
}, "ToggleSwitchAlwaysOnTop");
|
||||
// 调用 SetAlwaysOnTop 方法(如果存在)
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("SetAlwaysOnTop", newState);
|
||||
break;
|
||||
|
||||
case "UIAccessTopMost":
|
||||
// UIA置顶
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
if (MainWindow.Settings.Advanced != null)
|
||||
{
|
||||
MainWindow.Settings.Advanced.EnableUIAccessTopMost = newState;
|
||||
}
|
||||
}, "ToggleSwitchUIAccessTopMost");
|
||||
break;
|
||||
|
||||
case "Mode":
|
||||
// 仅PPT模式
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchMode", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "UpdateChannel_Release":
|
||||
// 选择稳定版
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
MainWindow.Settings.Startup.UpdateChannel = UpdateChannel.Release;
|
||||
}, "UpdateChannelSelector");
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("UpdateChannelSelector_Checked",
|
||||
new System.Windows.Controls.RadioButton { Tag = "Release" }, e);
|
||||
// 更新UI状态
|
||||
UpdateUpdateChannelButtons(true);
|
||||
break;
|
||||
|
||||
case "UpdateChannel_Beta":
|
||||
// 选择测试版
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
MainWindow.Settings.Startup.UpdateChannel = UpdateChannel.Beta;
|
||||
}, "UpdateChannelSelector");
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("UpdateChannelSelector_Checked",
|
||||
new System.Windows.Controls.RadioButton { Tag = "Beta" }, e);
|
||||
// 更新UI状态
|
||||
UpdateUpdateChannelButtons(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新更新通道按钮状态
|
||||
/// </summary>
|
||||
private void UpdateUpdateChannelButtons(bool isReleaseSelected)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isDarkTheme = ThemeHelper.IsDarkTheme;
|
||||
|
||||
if (UpdateChannelReleaseBorder != null)
|
||||
{
|
||||
UpdateChannelReleaseBorder.Background = isReleaseSelected
|
||||
? (isDarkTheme ? ThemeHelper.GetButtonBackgroundBrush() : new SolidColorBrush(Color.FromRgb(225, 225, 225)))
|
||||
: (isDarkTheme ? new SolidColorBrush(Color.FromRgb(35, 35, 35)) : new SolidColorBrush(Colors.Transparent));
|
||||
var textBlock = UpdateChannelReleaseBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = isReleaseSelected ? FontWeights.Bold : FontWeights.Normal;
|
||||
textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
|
||||
if (UpdateChannelBetaBorder != null)
|
||||
{
|
||||
UpdateChannelBetaBorder.Background = !isReleaseSelected
|
||||
? (isDarkTheme ? ThemeHelper.GetButtonBackgroundBrush() : new SolidColorBrush(Color.FromRgb(225, 225, 225)))
|
||||
: (isDarkTheme ? new SolidColorBrush(Color.FromRgb(35, 35, 35)) : new SolidColorBrush(Colors.Transparent));
|
||||
var textBlock = UpdateChannelBetaBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = !isReleaseSelected ? FontWeights.Bold : FontWeights.Normal;
|
||||
textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新更新通道按钮状态时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手动更新按钮点击事件
|
||||
/// </summary>
|
||||
private async void ManualUpdateButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("ManualUpdateButton_Click", sender, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 版本修复按钮点击事件
|
||||
/// </summary>
|
||||
private async void FixVersionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("FixVersionButton_Click", sender, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 历史版本回滚按钮点击事件
|
||||
/// </summary>
|
||||
private void HistoryRollbackButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 查找 MainWindow 中的历史版本回滚方法
|
||||
MainWindowSettingsHelper.InvokeMainWindowMethod("HistoryRollbackButton_Click", sender, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ComboBox选择变化事件处理
|
||||
/// </summary>
|
||||
private void AutoUpdateWithSilenceStartTimeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("AutoUpdateWithSilenceStartTimeComboBox", AutoUpdateWithSilenceStartTimeComboBox?.SelectedItem);
|
||||
}
|
||||
|
||||
private void AutoUpdateWithSilenceEndTimeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
// 直接调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("AutoUpdateWithSilenceEndTimeComboBox", AutoUpdateWithSilenceEndTimeComboBox?.SelectedItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isDarkTheme = ThemeHelper.IsDarkTheme;
|
||||
|
||||
// 更新更新通道按钮
|
||||
if (UpdateChannelReleaseBorder != null)
|
||||
{
|
||||
UpdateChannelReleaseBorder.Background = isDarkTheme
|
||||
? ThemeHelper.GetButtonBackgroundBrush()
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = UpdateChannelReleaseBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
if (UpdateChannelBetaBorder != null)
|
||||
{
|
||||
UpdateChannelBetaBorder.Background = isDarkTheme
|
||||
? new SolidColorBrush(Color.FromRgb(35, 35, 35))
|
||||
: new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = UpdateChannelBetaBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
|
||||
// 更新按钮
|
||||
if (ManualUpdateButton != null)
|
||||
{
|
||||
ManualUpdateButton.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
ManualUpdateButton.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
if (FixVersionButton != null)
|
||||
{
|
||||
FixVersionButton.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
FixVersionButton.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
if (HistoryRollbackButton != null)
|
||||
{
|
||||
HistoryRollbackButton.Background = ThemeHelper.GetButtonBackgroundBrush();
|
||||
HistoryRollbackButton.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
}
|
||||
|
||||
// 使用 ThemeHelper 递归更新其他元素
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"StartupPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,21 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"StoragePanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,470 @@
|
||||
using System.Windows.Media;
|
||||
using Ink_Canvas;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// 主题辅助类:提供统一的主题颜色资源
|
||||
/// </summary>
|
||||
public static class ThemeHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 检查当前是否为深色主题
|
||||
/// </summary>
|
||||
public static bool IsDarkTheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MainWindow.Settings?.Appearance == null) return false;
|
||||
return MainWindow.Settings.Appearance.Theme == 1 ||
|
||||
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查系统主题是否为浅色
|
||||
/// </summary>
|
||||
private static bool IsSystemThemeLight()
|
||||
{
|
||||
try
|
||||
{
|
||||
var registryKey = Microsoft.Win32.Registry.CurrentUser;
|
||||
var themeKey = registryKey.OpenSubKey("software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
|
||||
var keyValue = 0;
|
||||
if (themeKey != null) keyValue = (int)themeKey.GetValue("SystemUsesLightTheme");
|
||||
return keyValue == 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true; // 默认返回浅色主题
|
||||
}
|
||||
}
|
||||
|
||||
// 文字颜色 - 参考 Windows 系统设置
|
||||
public static Color TextPrimary => IsDarkTheme ? Color.FromRgb(243, 243, 243) : Color.FromRgb(0, 0, 0); // Windows 系统主文字颜色
|
||||
public static Color TextSecondary => IsDarkTheme ? Color.FromRgb(200, 200, 200) : Color.FromRgb(96, 96, 96); // Windows 系统次要文字颜色
|
||||
public static Color TextTertiary => IsDarkTheme ? Color.FromRgb(161, 161, 161) : Color.FromRgb(120, 120, 120); // Windows 系统三级文字颜色
|
||||
|
||||
// 背景颜色 - 参考 Windows 系统设置
|
||||
public static Color BackgroundPrimary => IsDarkTheme ? Color.FromRgb(32, 32, 32) : Color.FromRgb(255, 255, 255); // Windows 系统主背景
|
||||
public static Color BackgroundSecondary => IsDarkTheme ? Color.FromRgb(25, 25, 25) : Color.FromRgb(243, 243, 243); // Windows 系统次要背景(侧边栏等)
|
||||
public static Color BackgroundTertiary => IsDarkTheme ? Color.FromRgb(43, 43, 43) : Color.FromRgb(237, 237, 237); // Windows 系统三级背景(按钮等)
|
||||
|
||||
// 边框颜色 - 参考 Windows 系统设置
|
||||
public static Color BorderPrimary => IsDarkTheme ? Color.FromRgb(62, 62, 62) : Color.FromRgb(229, 229, 229); // Windows 系统主边框
|
||||
public static Color BorderSecondary => IsDarkTheme ? Color.FromRgb(55, 55, 55) : Color.FromRgb(220, 220, 220); // Windows 系统次要边框
|
||||
public static Color BorderTertiary => IsDarkTheme ? Color.FromRgb(70, 70, 70) : Color.FromRgb(211, 211, 211); // Windows 系统三级边框
|
||||
|
||||
// 分隔线颜色 - 参考 Windows 系统设置
|
||||
public static Color Separator => IsDarkTheme ? Color.FromRgb(62, 62, 62) : Color.FromRgb(237, 237, 237); // Windows 系统分隔线
|
||||
|
||||
// 选中/高亮颜色 - 参考 Windows 系统设置
|
||||
public static Color SelectedBackground => IsDarkTheme ? Color.FromRgb(62, 62, 62) : Color.FromRgb(237, 237, 237); // Windows 系统选中背景
|
||||
public static Color HoverBackground => IsDarkTheme ? Color.FromRgb(43, 43, 43) : Color.FromRgb(243, 243, 243); // Windows 系统悬停背景
|
||||
|
||||
// 按钮颜色 - 参考 Windows 系统设置
|
||||
public static Color ButtonBackground => IsDarkTheme ? Color.FromRgb(43, 43, 43) : Color.FromRgb(237, 237, 237); // Windows 系统按钮背景
|
||||
public static Color ButtonHoverBackground => IsDarkTheme ? Color.FromRgb(55, 55, 55) : Color.FromRgb(220, 220, 220); // Windows 系统按钮悬停背景
|
||||
|
||||
// 文本框颜色 - 参考 Windows 系统设置
|
||||
public static Color TextBoxBackground => IsDarkTheme ? Color.FromRgb(43, 43, 43) : Color.FromRgb(255, 255, 255); // Windows 系统文本框背景
|
||||
public static Color TextBoxBorder => IsDarkTheme ? Color.FromRgb(62, 62, 62) : Color.FromRgb(229, 229, 229); // Windows 系统文本框边框
|
||||
|
||||
// 滚动条颜色 - 参考 Windows 系统设置
|
||||
public static Color ScrollBarTrack => IsDarkTheme ? Color.FromRgb(25, 25, 25) : Color.FromRgb(243, 243, 243); // Windows 系统滚动条轨道
|
||||
public static Color ScrollBarThumb => IsDarkTheme ? Color.FromRgb(122, 122, 122) : Color.FromRgb(191, 191, 191); // Windows 系统滚动条滑块
|
||||
public static Color ScrollBarThumbHover => IsDarkTheme ? Color.FromRgb(150, 150, 150) : Color.FromRgb(138, 138, 138); // Windows 系统滚动条滑块悬停
|
||||
|
||||
// 转换为 SolidColorBrush
|
||||
public static SolidColorBrush GetTextPrimaryBrush() => new SolidColorBrush(TextPrimary);
|
||||
public static SolidColorBrush GetTextSecondaryBrush() => new SolidColorBrush(TextSecondary);
|
||||
public static SolidColorBrush GetTextTertiaryBrush() => new SolidColorBrush(TextTertiary);
|
||||
public static SolidColorBrush GetBackgroundPrimaryBrush() => new SolidColorBrush(BackgroundPrimary);
|
||||
public static SolidColorBrush GetBackgroundSecondaryBrush() => new SolidColorBrush(BackgroundSecondary);
|
||||
public static SolidColorBrush GetBackgroundTertiaryBrush() => new SolidColorBrush(BackgroundTertiary);
|
||||
public static SolidColorBrush GetBorderPrimaryBrush() => new SolidColorBrush(BorderPrimary);
|
||||
public static SolidColorBrush GetBorderSecondaryBrush() => new SolidColorBrush(BorderSecondary);
|
||||
public static SolidColorBrush GetBorderTertiaryBrush() => new SolidColorBrush(BorderTertiary);
|
||||
public static SolidColorBrush GetSeparatorBrush() => new SolidColorBrush(Separator);
|
||||
public static SolidColorBrush GetSelectedBackgroundBrush() => new SolidColorBrush(SelectedBackground);
|
||||
public static SolidColorBrush GetHoverBackgroundBrush() => new SolidColorBrush(HoverBackground);
|
||||
public static SolidColorBrush GetButtonBackgroundBrush() => new SolidColorBrush(ButtonBackground);
|
||||
public static SolidColorBrush GetButtonHoverBackgroundBrush() => new SolidColorBrush(ButtonHoverBackground);
|
||||
public static SolidColorBrush GetTextBoxBackgroundBrush() => new SolidColorBrush(TextBoxBackground);
|
||||
public static SolidColorBrush GetTextBoxBorderBrush() => new SolidColorBrush(TextBoxBorder);
|
||||
public static SolidColorBrush GetScrollBarTrackBrush() => new SolidColorBrush(ScrollBarTrack);
|
||||
public static SolidColorBrush GetScrollBarThumbBrush() => new SolidColorBrush(ScrollBarThumb);
|
||||
public static SolidColorBrush GetScrollBarThumbHoverBrush() => new SolidColorBrush(ScrollBarThumbHover);
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件的文字颜色
|
||||
/// </summary>
|
||||
public static void UpdateTextBlockColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Controls.TextBlock textBlock)
|
||||
{
|
||||
var foreground = textBlock.Foreground as SolidColorBrush;
|
||||
if (foreground != null)
|
||||
{
|
||||
var color = foreground.Color;
|
||||
// 检查是否是硬编码的浅色主题颜色
|
||||
if (color.R == 46 && color.G == 52 && color.B == 54) // #2e3436 - 主文字
|
||||
{
|
||||
textBlock.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
else if (color.R == 154 && color.G == 153 && color.B == 150) // #9a9996 - 次要文字
|
||||
{
|
||||
textBlock.Foreground = GetTextSecondaryBrush();
|
||||
}
|
||||
else if (color.R == 34 && color.G == 34 && color.B == 34) // #222222 - 深色文字
|
||||
{
|
||||
textBlock.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateTextBlockColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件的边框和背景颜色
|
||||
/// </summary>
|
||||
public static void UpdateBorderColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Controls.Border border)
|
||||
{
|
||||
var background = border.Background as SolidColorBrush;
|
||||
if (background != null)
|
||||
{
|
||||
var color = background.Color;
|
||||
// 检查是否是硬编码的浅色主题颜色
|
||||
if (color.R == 235 && color.G == 235 && color.B == 235) // #ebebeb - 分隔线
|
||||
{
|
||||
border.Background = GetSeparatorBrush();
|
||||
}
|
||||
else if (color.R == 217 && color.G == 217 && color.B == 217) // #d9d9d9 - 按钮背景
|
||||
{
|
||||
border.Background = GetButtonBackgroundBrush();
|
||||
}
|
||||
else if (color.R == 225 && color.G == 225 && color.B == 225) // #e1e1e1 - 按钮背景/分隔线
|
||||
{
|
||||
// 检查是否是按钮(有内边距或特定尺寸)
|
||||
if (border.Padding.Left > 0 || border.Padding.Top > 0 ||
|
||||
(border.Width > 0 && border.Height > 0 && border.Width < 200 && border.Height < 100))
|
||||
{
|
||||
border.Background = GetButtonBackgroundBrush();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 可能是分隔线
|
||||
border.Background = GetSeparatorBrush();
|
||||
}
|
||||
}
|
||||
else if (color.R == 255 && color.G == 255 && color.B == 255) // White - 白色背景
|
||||
{
|
||||
// 检查是否是搜索结果项(有圆角和内边距)
|
||||
if (border.CornerRadius.TopLeft == 6 && border.CornerRadius.TopRight == 6 &&
|
||||
border.CornerRadius.BottomLeft == 6 && border.CornerRadius.BottomRight == 6 &&
|
||||
border.Padding.Left > 0 && border.Padding.Top > 0)
|
||||
{
|
||||
// 搜索结果项背景
|
||||
border.Background = IsDarkTheme
|
||||
? new SolidColorBrush(Color.FromRgb(43, 43, 43)) // 深色主题搜索结果项背景
|
||||
: new SolidColorBrush(Colors.White);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 其他白色背景(如搜索框)
|
||||
border.Background = GetTextBoxBackgroundBrush();
|
||||
}
|
||||
}
|
||||
else if (color.R == 250 && color.G == 250 && color.B == 250) // #fafafa - 主背景
|
||||
{
|
||||
border.Background = GetBackgroundPrimaryBrush();
|
||||
}
|
||||
}
|
||||
|
||||
var borderBrush = border.BorderBrush as SolidColorBrush;
|
||||
if (borderBrush != null)
|
||||
{
|
||||
var color = borderBrush.Color;
|
||||
if (color.R == 230 && color.G == 230 && color.B == 230) // #e6e6e6 - 边框
|
||||
{
|
||||
border.BorderBrush = GetBorderPrimaryBrush();
|
||||
}
|
||||
else if (color.R == 225 && color.G == 225 && color.B == 225) // #e1e1e1 - 边框
|
||||
{
|
||||
border.BorderBrush = GetBorderPrimaryBrush();
|
||||
}
|
||||
else if (color.R == 211 && color.G == 211 && color.B == 211) // #d3d3d3 - 边框
|
||||
{
|
||||
border.BorderBrush = GetBorderTertiaryBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateBorderColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件的线条颜色
|
||||
/// </summary>
|
||||
public static void UpdateLineColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Shapes.Line line)
|
||||
{
|
||||
var stroke = line.Stroke as SolidColorBrush;
|
||||
if (stroke != null)
|
||||
{
|
||||
var color = stroke.Color;
|
||||
if (color.R == 211 && color.G == 211 && color.B == 211) // #d3d3d3 - 分隔线
|
||||
{
|
||||
line.Stroke = GetSeparatorBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateLineColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件的文本框和组合框颜色
|
||||
/// </summary>
|
||||
public static void UpdateInputControlsColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Controls.TextBox textBox)
|
||||
{
|
||||
var foreground = textBox.Foreground as SolidColorBrush;
|
||||
if (foreground != null)
|
||||
{
|
||||
var color = foreground.Color;
|
||||
if (color.R == 46 && color.G == 52 && color.B == 54) // #2e3436
|
||||
{
|
||||
textBox.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
var background = textBox.Background as SolidColorBrush;
|
||||
if (background != null)
|
||||
{
|
||||
var color = background.Color;
|
||||
if (color.R == 255 && color.G == 255 && color.B == 255) // 白色背景
|
||||
{
|
||||
textBox.Background = IsDarkTheme ? GetBackgroundSecondaryBrush() : new SolidColorBrush(System.Windows.Media.Colors.White);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (child is System.Windows.Controls.ComboBox comboBox)
|
||||
{
|
||||
var foreground = comboBox.Foreground as SolidColorBrush;
|
||||
if (foreground != null)
|
||||
{
|
||||
var color = foreground.Color;
|
||||
if (color.R == 46 && color.G == 52 && color.B == 54) // #2e3436
|
||||
{
|
||||
comboBox.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateInputControlsColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件的按钮颜色
|
||||
/// </summary>
|
||||
public static void UpdateButtonColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Controls.Button button)
|
||||
{
|
||||
var background = button.Background as SolidColorBrush;
|
||||
if (background != null)
|
||||
{
|
||||
var color = background.Color;
|
||||
// 检查是否是默认按钮(没有特定背景色)或特定颜色的按钮
|
||||
if (color.R == 37 && color.G == 99 && color.B == 235) // #2563eb - 蓝色按钮(保持原色)
|
||||
{
|
||||
// 蓝色按钮保持原色,但更新文字颜色
|
||||
if (button.Foreground is SolidColorBrush fgBrush &&
|
||||
fgBrush.Color.R == 255 && fgBrush.Color.G == 255 && fgBrush.Color.B == 255)
|
||||
{
|
||||
button.Foreground = new SolidColorBrush(Colors.White); // 保持白色文字
|
||||
}
|
||||
}
|
||||
else if (color.R == 255 && color.G == 255 && color.B == 255) // 白色背景按钮
|
||||
{
|
||||
button.Background = GetButtonBackgroundBrush();
|
||||
button.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
else if (color.A == 0 || color == System.Windows.Media.Colors.Transparent) // 透明背景
|
||||
{
|
||||
// 透明背景按钮,只更新文字颜色
|
||||
button.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 没有背景色的按钮,更新文字颜色
|
||||
button.Foreground = GetTextPrimaryBrush();
|
||||
}
|
||||
}
|
||||
UpdateButtonColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新控件中的图标颜色
|
||||
/// </summary>
|
||||
public static void UpdateImageIconColors(System.Windows.DependencyObject parent)
|
||||
{
|
||||
for (int i = 0; i < System.Windows.Media.VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = System.Windows.Media.VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is System.Windows.Controls.Image image && image.Source is DrawingImage drawingImage)
|
||||
{
|
||||
if (drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
{
|
||||
Color iconColor = IsDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
// 检查图标是否使用了深色(需要更新的颜色)
|
||||
bool needsUpdate = false;
|
||||
foreach (var drawing in drawingGroup.Children)
|
||||
{
|
||||
if (drawing is GeometryDrawing geometryDrawing)
|
||||
{
|
||||
if (geometryDrawing.Brush is SolidColorBrush brush)
|
||||
{
|
||||
var color = brush.Color;
|
||||
if (color.R == 34 && color.G == 34 && color.B == 34) // #222222
|
||||
{
|
||||
needsUpdate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (geometryDrawing.Pen?.Brush is SolidColorBrush penBrush)
|
||||
{
|
||||
var color = penBrush.Color;
|
||||
if (color.R == 34 && color.G == 34 && color.B == 34) // #222222
|
||||
{
|
||||
needsUpdate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needsUpdate)
|
||||
{
|
||||
// 克隆并更新图标颜色
|
||||
var clonedDrawing = CloneDrawingGroupForTheme(drawingGroup, iconColor);
|
||||
image.Source = new DrawingImage { Drawing = clonedDrawing };
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateImageIconColors(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 DrawingGroup 并更新颜色(用于主题适配)
|
||||
/// </summary>
|
||||
private static DrawingGroup CloneDrawingGroupForTheme(DrawingGroup source, Color newColor)
|
||||
{
|
||||
var cloned = new DrawingGroup();
|
||||
cloned.ClipGeometry = source.ClipGeometry?.Clone();
|
||||
cloned.Opacity = source.Opacity;
|
||||
cloned.Transform = source.Transform?.Clone();
|
||||
|
||||
foreach (var drawing in source.Children)
|
||||
{
|
||||
if (drawing is GeometryDrawing geometryDrawing)
|
||||
{
|
||||
var clonedGeometry = geometryDrawing.Geometry?.Clone();
|
||||
var clonedBrush = CloneBrushForTheme(geometryDrawing.Brush, newColor);
|
||||
var clonedPen = geometryDrawing.Pen != null
|
||||
? ClonePenForTheme(geometryDrawing.Pen, newColor)
|
||||
: null;
|
||||
|
||||
cloned.Children.Add(new GeometryDrawing(clonedBrush, clonedPen, clonedGeometry));
|
||||
}
|
||||
else if (drawing is DrawingGroup subGroup)
|
||||
{
|
||||
cloned.Children.Add(CloneDrawingGroupForTheme(subGroup, newColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
cloned.Children.Add(drawing);
|
||||
}
|
||||
}
|
||||
|
||||
return cloned;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Brush 并更新颜色(用于主题适配)
|
||||
/// </summary>
|
||||
private static Brush CloneBrushForTheme(Brush source, Color newColor)
|
||||
{
|
||||
if (source is SolidColorBrush solidBrush)
|
||||
{
|
||||
var originalColor = solidBrush.Color;
|
||||
if (originalColor.R == 34 && originalColor.G == 34 && originalColor.B == 34) // #222222
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
else if (originalColor.A > 0 && originalColor != Colors.Transparent &&
|
||||
originalColor.R < 50 && originalColor.G < 50 && originalColor.B < 50) // 深色
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
return new SolidColorBrush(originalColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
return source?.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Pen 并更新颜色(用于主题适配)
|
||||
/// </summary>
|
||||
private static Pen ClonePenForTheme(Pen source, Color newColor)
|
||||
{
|
||||
var clonedBrush = CloneBrushForTheme(source.Brush, newColor);
|
||||
return new Pen(clonedBrush, source.Thickness)
|
||||
{
|
||||
StartLineCap = source.StartLineCap,
|
||||
EndLineCap = source.EndLineCap,
|
||||
LineJoin = source.LineJoin,
|
||||
MiterLimit = source.MiterLimit
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题到整个控件树
|
||||
/// </summary>
|
||||
public static void ApplyThemeToControl(System.Windows.DependencyObject control)
|
||||
{
|
||||
UpdateTextBlockColors(control);
|
||||
UpdateBorderColors(control);
|
||||
UpdateLineColors(control);
|
||||
UpdateInputControlsColors(control);
|
||||
UpdateButtonColors(control);
|
||||
UpdateImageIconColors(control);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,466 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 设置项已清空,仅保留页面框架 -->
|
||||
<!-- 主题设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="主题" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择应用程序的主题样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="ThemeLightBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_Light" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="浅色主题"/>
|
||||
</Border>
|
||||
<Border x:Name="ThemeDarkBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_Dark" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="深色主题"/>
|
||||
</Border>
|
||||
<Border x:Name="ThemeSystemBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="Theme_System" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="跟随系统"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 启动动画设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用启动动画" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启动时显示动画效果" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableSplashScreen" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableSplashScreen" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<StackPanel Margin="18,8,18,8" x:Name="SplashScreenStylePanel">
|
||||
<StackPanel Orientation="Vertical" Margin="0,0,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启动动画样式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择启动动画的样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<ComboBox x:Name="ComboBoxSplashScreenStyle"
|
||||
Style="{StaticResource ComboBoxStyle}"
|
||||
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="200"
|
||||
SelectionChanged="ComboBoxSplashScreenStyle_SelectionChanged">
|
||||
<ComboBoxItem Content="随机" Tag="SplashScreenStyle_Random"/>
|
||||
<ComboBoxItem Content="跟随四季" Tag="SplashScreenStyle_Season"/>
|
||||
<ComboBoxItem Content="春季" Tag="SplashScreenStyle_Spring"/>
|
||||
<ComboBoxItem Content="夏季" Tag="SplashScreenStyle_Summer"/>
|
||||
<ComboBoxItem Content="秋季" Tag="SplashScreenStyle_Autumn"/>
|
||||
<ComboBoxItem Content="冬季" Tag="SplashScreenStyle_Winter"/>
|
||||
<ComboBoxItem Content="马年限定" Tag="SplashScreenStyle_Horse"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 浮动工具栏设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Margin="18,8,18,8">
|
||||
<StackPanel Orientation="Vertical" Margin="0,0,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="浮动工具栏图标" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择浮动工具栏的图标样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<ComboBox x:Name="ComboBoxFloatingBarImg"
|
||||
Style="{StaticResource ComboBoxStyle}"
|
||||
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
|
||||
HorizontalAlignment="Left"
|
||||
Width="250"
|
||||
SelectedIndex="0"
|
||||
SelectionChanged="ComboBoxFloatingBarImg_SelectionChanged">
|
||||
<ComboBoxItem Content=""ICC-CE"默认" Tag="FloatingBarImg_Default" IsSelected="True"/>
|
||||
<ComboBoxItem Content=""ICC-CE"无阴影" Tag="FloatingBarImg_NoShadow"/>
|
||||
<ComboBoxItem Content=""ICC-CE"深色" Tag="FloatingBarImg_Dark"/>
|
||||
<ComboBoxItem Content=""ICC-CE"深色呼吸版" Tag="FloatingBarImg_DarkBreathing"/>
|
||||
<ComboBoxItem Content=""ICC-CE"白色透明版" Tag="FloatingBarImg_WhiteTransparent"/>
|
||||
<ComboBoxItem Content=""ICC-CE"黑色透明版" Tag="FloatingBarImg_BlackTransparent"/>
|
||||
<ComboBoxItem Content="酷安斗鸡眼滑稽" Tag="FloatingBarImg_Kuan1"/>
|
||||
<ComboBoxItem Content="酷安受虐滑稽" Tag="FloatingBarImg_Kuan2"/>
|
||||
<ComboBoxItem Content="酷安呲牙笑" Tag="FloatingBarImg_Kuan3"/>
|
||||
<ComboBoxItem Content="酷安头戴内裤滑稽" Tag="FloatingBarImg_Kuan4"/>
|
||||
<ComboBoxItem Content="酷安绿帽Doge" Tag="FloatingBarImg_Kuan5"/>
|
||||
<ComboBoxItem Content="贴吧滑稽" Tag="FloatingBarImg_Tieba"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Horizontal" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自定义浮动栏图标" HorizontalAlignment="Left" Margin="0,0,12,0"/>
|
||||
<Button x:Name="ButtonAddCustomIcon" Content="上传" Padding="10,3"/>
|
||||
<Button x:Name="ButtonManageCustomIcons" Content="管理" Padding="10,3" Margin="5,0,0,0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="浮动工具栏缩放" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整浮动工具栏的大小" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="ViewboxFloatingBarScaleTransformValueSlider" Width="150" Minimum="0.5" Maximum="1.25" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True" ValueChanged="ViewboxFloatingBarScaleTransformValueSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="ViewboxFloatingBarScaleTransformValueText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="浮动工具栏透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="调整浮动工具栏的透明度" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="ViewboxFloatingBarOpacityValueSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True" ValueChanged="ViewboxFloatingBarOpacityValueSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="ViewboxFloatingBarOpacityValueText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="浮栏在PPT下透明度" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在PPT模式下浮动工具栏的透明度(重新进入PPT放映后生效)" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="ViewboxFloatingBarOpacityInPPTValueSlider" Width="150" Minimum="0.3" Maximum="1" Value="1" TickFrequency="0.05" IsSnapToTickEnabled="True" ValueChanged="ViewboxFloatingBarOpacityInPPTValueSlider_ValueChanged"/>
|
||||
<TextBlock x:Name="ViewboxFloatingBarOpacityInPPTValueText" Text="1.00" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在调色盘窗口中显示 笔尖模式 按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在调色盘窗口中显示笔尖模式切换按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableDisPlayNibModeToggle" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="EnableDisPlayNibModeToggle" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="使用老版浮动栏按钮UI" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用旧版浮动栏按钮的界面样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxUseLegacyFloatingBarUI" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 浮动栏按钮显示设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="浮动栏按钮显示" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示形状按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示形状按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowShapeButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示撤销按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示撤销按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowUndoButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示重做按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示重做按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowRedoButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示清空按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示清空按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowClearButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示白板按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示白板按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowWhiteboardButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示隐藏按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示隐藏按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowHideButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示套索选择按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示套索选择按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowLassoSelectButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示清并鼠按钮" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示清并鼠按钮" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowClearAndMouseButton" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" IsChecked="True" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="显示快捷调色盘" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在浮动栏中显示快捷调色盘" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<CheckBox x:Name="CheckBoxShowQuickColorPalette" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Checked="CheckBox_CheckedChanged" Unchecked="CheckBox_CheckedChanged"/>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="快捷调色盘显示模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择快捷调色盘的显示模式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="QuickColorPaletteDisplayModeSingleBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Single" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="单行显示(6色)"/>
|
||||
</Border>
|
||||
<Border x:Name="QuickColorPaletteDisplayModeDoubleBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Double" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="双行显示(8色)"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="橡皮按钮显示" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="选择橡皮按钮的显示方式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Border x:Name="EraserDisplayOptionBothBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="EraserDisplayOption_Both" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="两个都显示"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserDisplayOptionAreaBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Area" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="仅显示面积擦"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserDisplayOptionLineBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Line" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="仅显示线擦"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserDisplayOptionNoneBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_None" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="都不显示"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 任务栏托盘图标设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="任务栏托盘图标" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用托盘图标" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在任务栏系统托盘显示图标" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTrayIcon" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableTrayIcon" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 白板设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="白板设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="白板 UI 80% 缩放" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="将白板界面缩放至80%" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableViewboxBlackBoardScaleTransform" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableViewboxBlackBoardScaleTransform" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在白板中显示当前时间和日期" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在白板界面显示当前时间和日期" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableTimeDisplayInWhiteboardMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableTimeDisplayInWhiteboardMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在白板中显示信仰の源1(好喝的/毒的鸡汤)" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在白板界面显示励志语句" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableChickenSoupInWhiteboardMode" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableChickenSoupInWhiteboardMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,8,0,12">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="信仰の源出自Where?" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="选择励志语句的来源" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Border x:Name="ChickenSoupSourceOsuBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Osu" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="osu!玩家语录"/>
|
||||
</Border>
|
||||
<Border x:Name="ChickenSoupSourceMotivationalBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Motivational" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="励志立志的名言警句"/>
|
||||
</Border>
|
||||
<Border x:Name="ChickenSoupSourceGaokaoBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Gaokao" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="高考祝福语"/>
|
||||
</Border>
|
||||
<Border x:Name="ChickenSoupSourceHitokotoBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="ChickenSoupSource_Hitokoto" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="一言(Hitokoto API)"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 收纳模式设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="收纳模式设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="在收纳模式下启用快速面板" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在收纳模式下显示快速操作面板" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableQuickPanel" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="EnableQuickPanel" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="取消收纳按钮图标" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择取消收纳按钮的图标样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="UnFoldBtnImgArrowBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="UnFoldBtnImg_Arrow" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="箭头"/>
|
||||
</Border>
|
||||
<Border x:Name="UnFoldBtnImgPenBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UnFoldBtnImg_Pen" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="笔"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出收纳模式时自动切换至批注模式" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出收纳模式时将自动切换至批注模式,便于快速批注" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoEnterAnnotationModeWhenExitFoldMode" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AutoEnterAnnotationModeWhenExitFoldMode" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出PPT放映后自动收纳浮动栏" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出PPT放映后会自动收纳浮动栏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldAfterPPTSlideShow" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AutoFoldAfterPPTSlideShow" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="退出白板时自动收纳" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="开启后,退出白板模式时会自动收纳到侧边栏" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchAutoFoldWhenExitWhiteboard" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1" Tag="AutoFoldWhenExitWhiteboard" MouseLeftButtonDown="ToggleSwitch_Click">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
using Ink_Canvas;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,13 +16,46 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
/// </summary>
|
||||
public partial class ThemePanel : UserControl
|
||||
{
|
||||
private bool _isLoaded = false;
|
||||
|
||||
public ThemePanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += ThemePanel_Loaded;
|
||||
}
|
||||
|
||||
private void ThemePanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
// 添加触摸支持
|
||||
EnableTouchSupport();
|
||||
// 应用主题
|
||||
ApplyTheme();
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为面板中的所有交互控件启用触摸支持
|
||||
/// </summary>
|
||||
private void EnableTouchSupport()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 延迟执行,确保所有控件都已加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(this);
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"ThemePanel 启用触摸支持时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedNoShadowEffect;
|
||||
public event EventHandler<RoutedEventArgs> ThemeChanged;
|
||||
|
||||
private void ScrollViewerEx_ScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||
{
|
||||
@@ -29,6 +69,740 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载设置到UI
|
||||
/// </summary>
|
||||
public void LoadSettings()
|
||||
{
|
||||
if (MainWindow.Settings == null || MainWindow.Settings.Appearance == null) return;
|
||||
|
||||
_isLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
|
||||
// 主题设置
|
||||
SetOptionButtonState("Theme", appearance.Theme);
|
||||
|
||||
// 启用启动动画
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableSplashScreen"), appearance.EnableSplashScreen);
|
||||
if (SplashScreenStylePanel != null)
|
||||
{
|
||||
SplashScreenStylePanel.Visibility = appearance.EnableSplashScreen ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
// 启动动画样式
|
||||
if (ComboBoxSplashScreenStyle != null)
|
||||
{
|
||||
ComboBoxSplashScreenStyle.SelectedIndex = Math.Min(appearance.SplashScreenStyle, ComboBoxSplashScreenStyle.Items.Count - 1);
|
||||
}
|
||||
|
||||
// 浮动工具栏图标
|
||||
if (ComboBoxFloatingBarImg != null)
|
||||
{
|
||||
// 更新自定义图标列表(如果需要)
|
||||
// UpdateCustomIconsInComboBox();
|
||||
|
||||
int selectedIndex = Math.Min(appearance.FloatingBarImg, ComboBoxFloatingBarImg.Items.Count - 1);
|
||||
ComboBoxFloatingBarImg.SelectedIndex = selectedIndex;
|
||||
}
|
||||
|
||||
// 浮动工具栏缩放
|
||||
if (ViewboxFloatingBarScaleTransformValueSlider != null)
|
||||
{
|
||||
double val = appearance.ViewboxFloatingBarScaleTransformValue;
|
||||
if (val == 0) val = 1.0;
|
||||
ViewboxFloatingBarScaleTransformValueSlider.Value = val;
|
||||
if (ViewboxFloatingBarScaleTransformValueText != null)
|
||||
{
|
||||
ViewboxFloatingBarScaleTransformValueText.Text = val.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 浮动工具栏透明度
|
||||
if (ViewboxFloatingBarOpacityValueSlider != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityValueSlider.Value = appearance.ViewboxFloatingBarOpacityValue;
|
||||
if (ViewboxFloatingBarOpacityValueText != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityValueText.Text = appearance.ViewboxFloatingBarOpacityValue.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 浮栏在PPT下透明度
|
||||
if (ViewboxFloatingBarOpacityInPPTValueSlider != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityInPPTValueSlider.Value = appearance.ViewboxFloatingBarOpacityInPPTValue;
|
||||
if (ViewboxFloatingBarOpacityInPPTValueText != null)
|
||||
{
|
||||
ViewboxFloatingBarOpacityInPPTValueText.Text = appearance.ViewboxFloatingBarOpacityInPPTValue.ToString("F2");
|
||||
}
|
||||
}
|
||||
|
||||
// 在调色盘窗口中显示笔尖模式按钮
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableDisPlayNibModeToggle"), appearance.IsEnableDisPlayNibModeToggler);
|
||||
|
||||
// 使用老版浮动栏按钮UI
|
||||
if (CheckBoxUseLegacyFloatingBarUI != null)
|
||||
{
|
||||
CheckBoxUseLegacyFloatingBarUI.IsChecked = appearance.UseLegacyFloatingBarUI;
|
||||
}
|
||||
|
||||
// 浮动栏按钮显示控制
|
||||
if (CheckBoxShowShapeButton != null) CheckBoxShowShapeButton.IsChecked = appearance.IsShowShapeButton;
|
||||
if (CheckBoxShowUndoButton != null) CheckBoxShowUndoButton.IsChecked = appearance.IsShowUndoButton;
|
||||
if (CheckBoxShowRedoButton != null) CheckBoxShowRedoButton.IsChecked = appearance.IsShowRedoButton;
|
||||
if (CheckBoxShowClearButton != null) CheckBoxShowClearButton.IsChecked = appearance.IsShowClearButton;
|
||||
if (CheckBoxShowWhiteboardButton != null) CheckBoxShowWhiteboardButton.IsChecked = appearance.IsShowWhiteboardButton;
|
||||
if (CheckBoxShowHideButton != null) CheckBoxShowHideButton.IsChecked = appearance.IsShowHideButton;
|
||||
if (CheckBoxShowQuickColorPalette != null) CheckBoxShowQuickColorPalette.IsChecked = appearance.IsShowQuickColorPalette;
|
||||
if (CheckBoxShowLassoSelectButton != null) CheckBoxShowLassoSelectButton.IsChecked = appearance.IsShowLassoSelectButton;
|
||||
if (CheckBoxShowClearAndMouseButton != null) CheckBoxShowClearAndMouseButton.IsChecked = appearance.IsShowClearAndMouseButton;
|
||||
|
||||
// 启用系统托盘图标
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableTrayIcon"), appearance.EnableTrayIcon);
|
||||
|
||||
// 画板UI缩放
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableViewboxBlackBoardScaleTransform"), appearance.EnableViewboxBlackBoardScaleTransform);
|
||||
|
||||
// 白板模式时间显示
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableTimeDisplayInWhiteboardMode"), appearance.EnableTimeDisplayInWhiteboardMode);
|
||||
|
||||
// 白板模式鸡汤文
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableChickenSoupInWhiteboardMode"), appearance.EnableChickenSoupInWhiteboardMode);
|
||||
|
||||
// 启用快捷面板
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchEnableQuickPanel"), appearance.IsShowQuickPanel);
|
||||
|
||||
// 退出折叠模式后自动进入批注模式
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoEnterAnnotationModeWhenExitFoldMode"), MainWindow.Settings.Automation.IsAutoEnterAnnotationModeWhenExitFoldMode);
|
||||
}
|
||||
|
||||
// PPT放映结束后自动折叠
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoFoldAfterPPTSlideShow"), MainWindow.Settings.Automation.IsAutoFoldAfterPPTSlideShow);
|
||||
}
|
||||
|
||||
// 退出白板模式后自动折叠
|
||||
if (MainWindow.Settings.Automation != null)
|
||||
{
|
||||
SetToggleSwitchState(FindToggleSwitch("ToggleSwitchAutoFoldWhenExitWhiteboard"), MainWindow.Settings.Automation.IsAutoFoldWhenExitWhiteboard);
|
||||
}
|
||||
|
||||
// 信仰の源出自Where?
|
||||
SetOptionButtonState("ChickenSoupSource", appearance.ChickenSoupSource);
|
||||
|
||||
// 取消收纳按钮图标
|
||||
SetOptionButtonState("UnFoldBtnImg", appearance.UnFoldButtonImageType);
|
||||
|
||||
// 快捷调色盘显示模式
|
||||
SetOptionButtonState("QuickColorPaletteDisplayMode", appearance.QuickColorPaletteDisplayMode);
|
||||
|
||||
// 橡皮按钮显示
|
||||
SetOptionButtonState("EraserDisplayOption", appearance.EraserDisplayOption);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载个性化设置时出错: {ex.Message}");
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找ToggleSwitch控件
|
||||
/// </summary>
|
||||
private Border FindToggleSwitch(string name)
|
||||
{
|
||||
return this.FindDescendantByName(name) as Border;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置ToggleSwitch状态
|
||||
/// </summary>
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
innerBorder.HorizontalAlignment = isOn ? HorizontalAlignment.Right : HorizontalAlignment.Left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch点击事件处理
|
||||
/// </summary>
|
||||
private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
bool isOn = border.Background.ToString() == "#FF3584E4";
|
||||
bool newState = !isOn;
|
||||
SetToggleSwitchState(border, newState);
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
if (appearance == null) return;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case "EnableSplashScreen":
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggledWithThemeCheck("ToggleSwitchEnableSplashScreen", newState);
|
||||
// 更新UI状态
|
||||
if (SplashScreenStylePanel != null)
|
||||
{
|
||||
SplashScreenStylePanel.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "EnableDisPlayNibModeToggle":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableDisPlayNibModeToggle", newState);
|
||||
break;
|
||||
|
||||
case "EnableTrayIcon":
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggledWithThemeCheck("ToggleSwitchEnableTrayIcon", newState);
|
||||
// 更新系统托盘图标可见性
|
||||
var taskbar = Application.Current.Resources["TaskbarTrayIcon"] as TaskbarIcon;
|
||||
if (taskbar != null)
|
||||
{
|
||||
taskbar.Visibility = newState ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
|
||||
case "EnableViewboxBlackBoardScaleTransform":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableViewboxBlackBoardScaleTransform", newState);
|
||||
break;
|
||||
|
||||
case "EnableTimeDisplayInWhiteboardMode":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableTimeDisplayInWhiteboardMode", newState);
|
||||
break;
|
||||
|
||||
case "EnableChickenSoupInWhiteboardMode":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableChickenSoupInWhiteboardMode", newState);
|
||||
break;
|
||||
|
||||
case "EnableQuickPanel":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchEnableQuickPanel", newState);
|
||||
break;
|
||||
|
||||
case "AutoEnterAnnotationModeWhenExitFoldMode":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoEnterAnnotationModeWhenExitFoldMode", newState);
|
||||
break;
|
||||
|
||||
case "AutoFoldAfterPPTSlideShow":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoFoldAfterPPTSlideShow", newState);
|
||||
break;
|
||||
|
||||
case "AutoFoldWhenExitWhiteboard":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeToggleSwitchToggled("ToggleSwitchAutoFoldWhenExitWhiteboard", newState);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ComboBox选择变化事件处理
|
||||
/// </summary>
|
||||
private void ComboBoxSplashScreenStyle_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (ComboBoxSplashScreenStyle?.SelectedIndex >= 0)
|
||||
{
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChangedWithThemeCheck("ComboBoxSplashScreenStyle", ComboBoxSplashScreenStyle.SelectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void ComboBoxFloatingBarImg_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (ComboBoxFloatingBarImg?.SelectedIndex >= 0)
|
||||
{
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChangedWithThemeCheck("ComboBoxFloatingBarImg", ComboBoxFloatingBarImg.SelectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Slider值变化事件处理
|
||||
/// </summary>
|
||||
private void ViewboxFloatingBarScaleTransformValueSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (ViewboxFloatingBarScaleTransformValueSlider != null && ViewboxFloatingBarScaleTransformValueText != null)
|
||||
{
|
||||
double val = ViewboxFloatingBarScaleTransformValueSlider.Value;
|
||||
ViewboxFloatingBarScaleTransformValueText.Text = val.ToString("F2");
|
||||
// 调用 MainWindow 中的方法(会自动检查主题更新)
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("ViewboxFloatingBarScaleTransformValueSlider", val);
|
||||
}
|
||||
}
|
||||
|
||||
private void ViewboxFloatingBarOpacityValueSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (ViewboxFloatingBarOpacityValueSlider != null && ViewboxFloatingBarOpacityValueText != null)
|
||||
{
|
||||
double val = ViewboxFloatingBarOpacityValueSlider.Value;
|
||||
ViewboxFloatingBarOpacityValueText.Text = val.ToString("F2");
|
||||
// 调用 MainWindow 中的方法(会自动检查主题更新)
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("ViewboxFloatingBarOpacityValueSlider", val);
|
||||
}
|
||||
}
|
||||
|
||||
private void ViewboxFloatingBarOpacityInPPTValueSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
if (ViewboxFloatingBarOpacityInPPTValueSlider != null && ViewboxFloatingBarOpacityInPPTValueText != null)
|
||||
{
|
||||
double val = ViewboxFloatingBarOpacityInPPTValueSlider.Value;
|
||||
ViewboxFloatingBarOpacityInPPTValueText.Text = val.ToString("F2");
|
||||
// 调用 MainWindow 中的方法(会自动检查主题更新)
|
||||
MainWindowSettingsHelper.InvokeSliderValueChanged("ViewboxFloatingBarOpacityInPPTValueSlider", val);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CheckBox变化事件处理
|
||||
/// </summary>
|
||||
private void CheckBox_CheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var checkBox = sender as CheckBox;
|
||||
if (checkBox == null) return;
|
||||
|
||||
string name = checkBox.Name;
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
if (appearance == null) return;
|
||||
|
||||
switch (name)
|
||||
{
|
||||
case "CheckBoxUseLegacyFloatingBarUI":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxUseLegacyFloatingBarUI", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowShapeButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowShapeButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowUndoButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowUndoButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowRedoButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowRedoButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowClearButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowClearButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowWhiteboardButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowWhiteboardButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowHideButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowHideButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowQuickColorPalette":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowQuickColorPalette", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowLassoSelectButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowLassoSelectButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
|
||||
case "CheckBoxShowClearAndMouseButton":
|
||||
// 调用 MainWindow 中的方法
|
||||
MainWindowSettingsHelper.InvokeCheckBoxCheckedChanged("CheckBoxShowClearAndMouseButton", checkBox.IsChecked ?? false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
{
|
||||
{ "Theme", new[] { "Light", "Dark", "System" } },
|
||||
{ "ChickenSoupSource", new[] { "Osu", "Motivational", "Gaokao", "Hitokoto" } },
|
||||
{ "UnFoldBtnImg", new[] { "Arrow", "Pen" } },
|
||||
{ "QuickColorPaletteDisplayMode", new[] { "Single", "Double" } },
|
||||
{ "EraserDisplayOption", new[] { "Both", "Area", "Line", "None" } }
|
||||
};
|
||||
|
||||
if (!buttons.ContainsKey(group)) return;
|
||||
|
||||
string[] buttonNames = buttons[group];
|
||||
|
||||
for (int i = 0; i < buttonNames.Length; i++)
|
||||
{
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选项按钮点击事件处理
|
||||
/// </summary>
|
||||
private void OptionButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isLoaded) return;
|
||||
|
||||
var border = sender as Border;
|
||||
if (border == null) return;
|
||||
|
||||
string tag = border.Tag?.ToString();
|
||||
if (string.IsNullOrEmpty(tag)) return;
|
||||
|
||||
string[] parts = tag.Split('_');
|
||||
if (parts.Length < 2) return;
|
||||
|
||||
string group = parts[0];
|
||||
string value = parts[1];
|
||||
|
||||
// 清除同组其他按钮的选中状态
|
||||
var parent = border.Parent as Panel;
|
||||
if (parent != null)
|
||||
{
|
||||
foreach (var child in parent.Children)
|
||||
{
|
||||
if (child is Border childBorder && childBorder != border)
|
||||
{
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
currentTextBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
|
||||
var appearance = MainWindow.Settings.Appearance;
|
||||
if (appearance == null) return;
|
||||
|
||||
switch (group)
|
||||
{
|
||||
case "Theme":
|
||||
// 通过 MainWindowSettingsHelper 调用 ComboBoxTheme 的 SelectionChanged 事件处理器
|
||||
try
|
||||
{
|
||||
var mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow != null)
|
||||
{
|
||||
var comboBox = mainWindow.FindName("ComboBoxTheme") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null)
|
||||
{
|
||||
// 根据 value 找到对应的 ComboBoxItem
|
||||
int themeIndex;
|
||||
switch (value)
|
||||
{
|
||||
case "Light":
|
||||
themeIndex = 0;
|
||||
break;
|
||||
case "Dark":
|
||||
themeIndex = 1;
|
||||
break;
|
||||
case "System":
|
||||
themeIndex = 2;
|
||||
break;
|
||||
default:
|
||||
themeIndex = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
if (comboBox.Items.Count > themeIndex)
|
||||
{
|
||||
var selectedItem = comboBox.Items[themeIndex];
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChangedWithThemeCheck("ComboBoxTheme", selectedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置并通知主题更新
|
||||
MainWindowSettingsHelper.UpdateSettingSafely(() =>
|
||||
{
|
||||
appearance.Theme = themeIndex;
|
||||
}, "ComboBoxTheme_SelectionChanged", "ComboBoxTheme");
|
||||
MainWindowSettingsHelper.NotifyThemeUpdateIfNeeded("ComboBoxTheme");
|
||||
|
||||
// 触发主题变化事件,通知设置窗口更新主题
|
||||
ThemeChanged?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置并通知主题更新
|
||||
int themeIndex;
|
||||
switch (value)
|
||||
{
|
||||
case "Light":
|
||||
themeIndex = 0;
|
||||
break;
|
||||
case "Dark":
|
||||
themeIndex = 1;
|
||||
break;
|
||||
case "System":
|
||||
themeIndex = 2;
|
||||
break;
|
||||
default:
|
||||
themeIndex = 2;
|
||||
break;
|
||||
}
|
||||
MainWindowSettingsHelper.UpdateSettingSafely(() =>
|
||||
{
|
||||
appearance.Theme = themeIndex;
|
||||
}, "ComboBoxTheme_SelectionChanged", "ComboBoxTheme");
|
||||
MainWindowSettingsHelper.NotifyThemeUpdateIfNeeded("ComboBoxTheme");
|
||||
|
||||
// 触发主题变化事件,通知设置窗口更新主题
|
||||
ThemeChanged?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"切换主题时出错: {ex.Message}");
|
||||
}
|
||||
break;
|
||||
|
||||
case "ChickenSoupSource":
|
||||
int sourceIndex;
|
||||
switch (value)
|
||||
{
|
||||
case "Osu":
|
||||
sourceIndex = 0;
|
||||
break;
|
||||
case "Motivational":
|
||||
sourceIndex = 1;
|
||||
break;
|
||||
case "Gaokao":
|
||||
sourceIndex = 2;
|
||||
break;
|
||||
case "Hitokoto":
|
||||
sourceIndex = 3;
|
||||
break;
|
||||
default:
|
||||
sourceIndex = 3;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow6 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow6 != null)
|
||||
{
|
||||
var comboBox = mainWindow6.FindName("ComboBoxChickenSoupSource") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > sourceIndex)
|
||||
{
|
||||
comboBox.SelectedIndex = sourceIndex;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxChickenSoupSource", comboBox.Items[sourceIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
appearance.ChickenSoupSource = sourceIndex;
|
||||
}, "ComboBoxChickenSoupSource");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "UnFoldBtnImg":
|
||||
int imgType;
|
||||
switch (value)
|
||||
{
|
||||
case "Arrow":
|
||||
imgType = 0;
|
||||
break;
|
||||
case "Pen":
|
||||
imgType = 1;
|
||||
break;
|
||||
default:
|
||||
imgType = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法(带主题检查)
|
||||
var mainWindow3 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow3 != null)
|
||||
{
|
||||
var comboBox = mainWindow3.FindName("ComboBoxUnFoldBtnImg") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > imgType)
|
||||
{
|
||||
comboBox.SelectedIndex = imgType;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChangedWithThemeCheck("ComboBoxUnFoldBtnImg", comboBox.Items[imgType]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置并通知主题更新
|
||||
MainWindowSettingsHelper.UpdateSettingSafely(() =>
|
||||
{
|
||||
appearance.UnFoldButtonImageType = imgType;
|
||||
}, "ComboBoxUnFoldBtnImg_SelectionChanged", "ComboBoxUnFoldBtnImg");
|
||||
MainWindowSettingsHelper.NotifyThemeUpdateIfNeeded("ComboBoxUnFoldBtnImg");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "QuickColorPaletteDisplayMode":
|
||||
int displayMode;
|
||||
switch (value)
|
||||
{
|
||||
case "Single":
|
||||
displayMode = 0;
|
||||
break;
|
||||
case "Double":
|
||||
displayMode = 1;
|
||||
break;
|
||||
default:
|
||||
displayMode = 1;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow4 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow4 != null)
|
||||
{
|
||||
var comboBox = mainWindow4.FindName("ComboBoxQuickColorPaletteDisplayMode") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > displayMode)
|
||||
{
|
||||
comboBox.SelectedIndex = displayMode;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxQuickColorPaletteDisplayMode", comboBox.Items[displayMode]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
appearance.QuickColorPaletteDisplayMode = displayMode;
|
||||
}, "ComboBoxQuickColorPaletteDisplayMode");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "EraserDisplayOption":
|
||||
int eraserOption;
|
||||
switch (value)
|
||||
{
|
||||
case "Both":
|
||||
eraserOption = 0;
|
||||
break;
|
||||
case "Area":
|
||||
eraserOption = 1;
|
||||
break;
|
||||
case "Line":
|
||||
eraserOption = 2;
|
||||
break;
|
||||
case "None":
|
||||
eraserOption = 3;
|
||||
break;
|
||||
default:
|
||||
eraserOption = 0;
|
||||
break;
|
||||
}
|
||||
// 调用 MainWindow 中的方法
|
||||
var mainWindow5 = Application.Current.MainWindow as MainWindow;
|
||||
if (mainWindow5 != null)
|
||||
{
|
||||
var comboBox = mainWindow5.FindName("ComboBoxEraserDisplayOption") as System.Windows.Controls.ComboBox;
|
||||
if (comboBox != null && comboBox.Items.Count > eraserOption)
|
||||
{
|
||||
comboBox.SelectedIndex = eraserOption;
|
||||
MainWindowSettingsHelper.InvokeComboBoxSelectionChanged("ComboBoxEraserDisplayOption", comboBox.Items[eraserOption]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到控件,直接更新设置
|
||||
MainWindowSettingsHelper.UpdateSettingDirectly(() =>
|
||||
{
|
||||
appearance.EraserDisplayOption = eraserOption;
|
||||
}, "ComboBoxEraserDisplayOption");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"ThemePanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
<UserControl x:Class="Ink_Canvas.Windows.SettingsViews.TimerPanel"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="950" d:DesignWidth="640">
|
||||
<UserControl.Resources>
|
||||
<!-- 开关样式模板 -->
|
||||
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
|
||||
<Setter Property="Width" Value="48"/>
|
||||
<Setter Property="Height" Value="25"/>
|
||||
<Setter Property="CornerRadius" Value="12"/>
|
||||
<Setter Property="Padding" Value="3,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="Margin" Value="0,0,15,0"/>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="ScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<!-- 计时器UI设置 -->
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="计时器UI设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="使用老版计时器按钮UI" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用旧版本的计时器按钮界面" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchUseLegacyTimerUI" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="新计时器UI" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="使用新样式的计时器界面" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchUseNewStyleUI" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="启用正计时" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="计时器超时后继续正向计时" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableOvertimeCountUp" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="超时醒目数字" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="计时器超时后数字显示为红色" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableOvertimeRedText" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 提醒设置 -->
|
||||
<Border Margin="0,25,0,0" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical" Margin="18,18,18,18">
|
||||
<TextBlock Text="提醒设置" FontWeight="Bold" Foreground="#2e3436" FontSize="18" Margin="0,0,0,12"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="计时器提醒音量" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置计时器提醒音的音量" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="TimerVolumeSlider" Width="150" Minimum="0" Maximum="1" Value="1" TickFrequency="0.1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="TimerVolumeText" Text="100%" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" FontFamily="Consolas"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自定义提醒铃声" VerticalAlignment="Center" Margin="0,0,12,0"/>
|
||||
<Button x:Name="ButtonSelectCustomTimerSound" Content="选择文件" Padding="10,3" Margin="0,0,8,0" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="ButtonResetTimerSound" Content="重置" Padding="10,3" Background="#2563eb" Foreground="White"/>
|
||||
</StackPanel>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="渐进提醒" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="启用渐进式提醒功能" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<Border x:Name="ToggleSwitchEnableProgressiveReminder" Style="{StaticResource ToggleSwitchStyle}" Background="#e1e1e1">
|
||||
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<Grid Height="54" x:Name="ProgressiveReminderVolumePanel" Visibility="Collapsed">
|
||||
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="渐进提醒音量" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="设置渐进提醒音的音量" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Slider x:Name="ProgressiveReminderVolumeSlider" Width="150" Minimum="0" Maximum="1" Value="1" TickFrequency="0.1" IsSnapToTickEnabled="True"/>
|
||||
<TextBlock x:Name="ProgressiveReminderVolumeText" Text="100%" VerticalAlignment="Center" FontSize="14" Margin="12,0,0,0" Foreground="#2e3436" FontFamily="Consolas"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Border Height="1" Background="#ebebeb" Margin="0,8,0,8"/>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,8,0,0" x:Name="ProgressiveReminderSoundPanel" Visibility="Collapsed">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自定义渐进提醒音频" VerticalAlignment="Center" Margin="0,0,12,0"/>
|
||||
<Button x:Name="ButtonSelectCustomProgressiveReminderSound" Content="选择文件" Padding="10,3" Margin="0,0,8,0" Background="#2563eb" Foreground="White"/>
|
||||
<Button x:Name="ButtonResetProgressiveReminderSound" Content="重置" Padding="10,3" Background="#2563eb" Foreground="White"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
/// <summary>
|
||||
/// TimerPanel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TimerPanel : UserControl
|
||||
{
|
||||
public TimerPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedNoShadowEffect;
|
||||
|
||||
private void ScrollViewerEx_ScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||
{
|
||||
var scrollViewer = (ScrollViewer)sender;
|
||||
if (scrollViewer.VerticalOffset >= 10)
|
||||
{
|
||||
IsTopBarNeedShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
else
|
||||
{
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"TimerPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:settingsViews="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
WindowStartupLocation="CenterScreen" d:DesignHeight="19198"
|
||||
mc:Ignorable="d" WindowStyle="None" ResizeMode="CanMinimize" Background="Transparent"
|
||||
@@ -91,11 +92,39 @@
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="AppearanceIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V16 H17 V0 H0 Z">
|
||||
<DrawingGroup.Transform>
|
||||
<TranslateTransform X="0" Y="0.0078125" />
|
||||
</DrawingGroup.Transform>
|
||||
<GeometryDrawing Brush="#FF222222" Geometry="F1 M17,16z M0,0z M14.3604,-0.0078125L10.8916,3.44922C11.5752,3.80469,12.126,4.35937,12.4814,5.03906L12.6533,4.86719 12.6611,4.87518 16.9619,0.574219 16.9619,-0.0078125 14.3604,-0.0078125z M3.96191,0.992188C2.31738,0.992188,0.961914,2.34766,0.961914,3.99219L0.961914,9.99219C0.961914,11.6367,2.31738,12.9922,3.96191,12.9922L13.9619,12.9922C15.6064,12.9922,16.9619,11.6367,16.9619,9.99219L16.9619,3.99219C16.9619,3.42188,16.7939,2.89062,16.5127,2.43359L14.9619,3.98828 14.9619,9.99219C14.9619,10.5625,14.5322,10.9922,13.9619,10.9922L3.96191,10.9922C3.3916,10.9922,2.96191,10.5625,2.96191,9.99219L2.96191,3.99219C2.96191,3.42188,3.3916,2.99219,3.96191,2.99219L9.93066,2.99219 11.9385,0.992188 3.96191,0.992188z M8.96191,3.99219C7.30566,3.99219,5.96191,5.33203,5.96191,6.99219L5.96191,9.99219 8.96191,9.99219C10.6221,10.0002 11.9619,8.64844 11.9619,6.99219 11.9619,5.33203 10.6221,3.99219 8.96191,3.99219z M5.96191,13.9922C4.85644,13.9922,3.96191,14.8867,3.96191,15.9922L13.9619,15.9922C13.9619,14.8867,13.0674,13.9922,11.9619,13.9922L5.96191,13.9922z" />
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M12 21C9.61305 21 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12C3 9.61305 3.94821 7.32387 5.63604 5.63604C7.32387 3.94821 9.61305 3 12 3C16.97 3 21 6.582 21 11C21 12.06 20.526 13.078 19.682 13.828C18.838 14.578 17.693 15 16.5 15H14C13.5539 14.9928 13.1181 15.135 12.7621 15.404C12.4061 15.673 12.1503 16.0533 12.0353 16.4844C11.9203 16.9155 11.9528 17.3727 12.1276 17.7833C12.3025 18.1938 12.6095 18.5341 13 18.75C13.1997 18.9342 13.3366 19.1764 13.3915 19.4425C13.4465 19.7085 13.4167 19.9851 13.3064 20.2334C13.196 20.4816 13.0107 20.6891 12.7764 20.8266C12.5421 20.9641 12.2705 21.0247 12 21Z" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M7.5 10.5C7.5 10.7652 7.60536 11.0196 7.79289 11.2071C7.98043 11.3946 8.23478 11.5 8.5 11.5C8.76522 11.5 9.01957 11.3946 9.20711 11.2071C9.39464 11.0196 9.5 10.7652 9.5 10.5C9.5 10.2348 9.39464 9.98043 9.20711 9.79289C9.01957 9.60536 8.76522 9.5 8.5 9.5C8.23478 9.5 7.98043 9.60536 7.79289 9.79289C7.60536 9.98043 7.5 10.2348 7.5 10.5Z" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M11.5 7.5C11.5 7.76522 11.6054 8.01957 11.7929 8.20711C11.9804 8.39464 12.2348 8.5 12.5 8.5C12.7652 8.5 13.0196 8.39464 13.2071 8.20711C13.3946 8.01957 13.5 7.76522 13.5 7.5C13.5 7.23478 13.3946 6.98043 13.2071 6.79289C13.0196 6.60536 12.7652 6.5 12.5 6.5C12.2348 6.5 11.9804 6.60536 11.7929 6.79289C11.6054 6.98043 11.5 7.23478 11.5 7.5Z" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M15.5 10.5C15.5 10.7652 15.6054 11.0196 15.7929 11.2071C15.9804 11.3946 16.2348 11.5 16.5 11.5C16.7652 11.5 17.0196 11.3946 17.2071 11.2071C17.3946 11.0196 17.5 10.7652 17.5 10.5C17.5 10.2348 17.3946 9.98043 17.2071 9.79289C17.0196 9.60536 16.7652 9.5 16.5 9.5C16.2348 9.5 15.9804 9.60536 15.7929 9.79289C15.6054 9.98043 15.5 10.2348 15.5 10.5Z" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
@@ -174,6 +203,102 @@
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="ShortcutsIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<!-- 键盘外框 -->
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M2,8 C2,7.46957 2.21071,6.96086 2.58579,6.58579 C2.96086,6.21071 3.46957,6 4,6 L20,6 C20.5304,6 21.0391,6.21071 21.4142,6.58579 C21.7893,6.96086 22,7.46957 22,8 L22,16 C22,16.5304 21.7893,17.0391 21.4142,17.4142 C21.0391,17.7893 20.5304,18 20,18 L4,18 C3.46957,18 2.96086,17.7893 2.58579,17.4142 C2.21071,17.0391 2,16.5304 2,16 L2,8 Z" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<!-- 第一行按键点 -->
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M6,10 L6,10.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M10,10 L10,10.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M14,10 L14,10.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M18,10 L18,10.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<!-- 第二行按键 -->
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M6,14 L6,14.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M18,14 L18,14.01" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<!-- 中间长按键 -->
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M10,14 L14,14" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="CrashActionIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="Transparent">
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M17.6698,17.667 C16.1271,19.2844 14.1634,20.4387 11.9998,21 C10.443,20.5962 8.98331,19.8836 7.70738,18.9045 C6.43144,17.9254 5.36534,16.6998 4.57243,15.3005 C3.77952,13.9013 3.27597,12.3569 3.09171,10.7592 C2.90745,9.16147 3.04624,7.54302 3.49983,6 C4.29383,6.036 5.08283,5.994 5.85683,5.876 M8.98483,4.95 C10.082,4.45493 11.0983,3.79757 11.9998,3 C14.3357,5.06658 17.3843,6.14257 20.4998,6 C20.9575,7.55707 21.0946,9.19081 20.9028,10.8024 C20.7109,12.4139 20.1942,13.9699 19.3838,15.376" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing>
|
||||
<GeometryDrawing.Geometry>
|
||||
<PathGeometry Figures="M3,3 L21,21" />
|
||||
</GeometryDrawing.Geometry>
|
||||
<GeometryDrawing.Pen>
|
||||
<Pen Brush="#FF222222" Thickness="2" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
|
||||
</GeometryDrawing.Pen>
|
||||
</GeometryDrawing>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="TwoFingerMoveImage">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V256 H256 V0 H0 Z">
|
||||
@@ -493,13 +618,13 @@
|
||||
<WindowChrome GlassFrameThickness="-1" ResizeBorderThickness="0" CaptionHeight="0" CornerRadius="0" />
|
||||
</WindowChrome.WindowChrome>
|
||||
<Grid>
|
||||
<Border Background="#fafafa" CornerRadius="7" BorderBrush="#3584e4" BorderThickness="2" Margin="8">
|
||||
<Border x:Name="MainBorder" Background="#fafafa" CornerRadius="7" BorderBrush="#3584e4" BorderThickness="2" Margin="8">
|
||||
<Grid>
|
||||
<!--Sidebar-->
|
||||
<Border Width="250" Background="#ebebeb" BorderBrush="#e1e1e1" CornerRadius="7,0,0,7" BorderThickness="0,0,2,0" HorizontalAlignment="Left">
|
||||
<Border x:Name="SidebarBorder" Width="250" Background="#ebebeb" BorderBrush="#e1e1e1" CornerRadius="7,0,0,7" BorderThickness="0,0,2,0" HorizontalAlignment="Left">
|
||||
<Grid>
|
||||
<Grid Height="48" VerticalAlignment="Top">
|
||||
<Border CornerRadius="8" Background="#d9d9d9" Width="34" Height="34" Margin="8,0,0,0" HorizontalAlignment="Left" MouseLeftButtonDown="SearchButton_Click" Cursor="Hand">
|
||||
<Border x:Name="SearchButtonBorder" CornerRadius="8" Background="#d9d9d9" Width="34" Height="34" Margin="8,0,0,0" HorizontalAlignment="Left" MouseLeftButtonDown="SearchButton_Click" Cursor="Hand">
|
||||
<Image Width="16" Height="16">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
@@ -512,8 +637,8 @@
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</Border>
|
||||
<TextBlock FontSize="15" Text="软件设置" Foreground="#2e3436" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<Border CornerRadius="8" Background="#d9d9d9" Width="34" Height="34" Margin="0,0,8,0" HorizontalAlignment="Right" MouseLeftButtonDown="MenuButton_Click" Cursor="Hand">
|
||||
<TextBlock x:Name="TitleTextBlock" FontSize="15" Text="软件设置" Foreground="#2e3436" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<Border CornerRadius="8" Background="#d9d9d9" Width="34" Height="34" Margin="0,0,8,0" HorizontalAlignment="Right" PreviewMouseLeftButtonDown="MenuButton_Click" Cursor="Hand" x:Name="MenuButtonBorder">
|
||||
<Image Width="16" Height="16">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
@@ -525,6 +650,70 @@
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<Border.ContextMenu>
|
||||
<ContextMenu x:Name="MenuButtonContextMenu" ui:ThemeManager.RequestedTheme="Light" Padding="6">
|
||||
<MenuItem Header="退出软件" Click="MenuItemExit_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M13,2C13,1.44772 12.5523,1 12,1 11.4477,1 11,1.44772 11,2L11,12C11,12.5523 11.4477,13 12,13 12.5523,13 13,12.5523 13,12L13,2z" />
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M19.1073,5.89303C18.7168,5.50243 18.0837,5.50232 17.6931,5.89277 17.3025,6.28322 17.3024,6.91639 17.6928,7.30698 18.8098,8.42441 19.571,9.84758 19.8802,11.397 20.1894,12.9464 20.0329,14.5528 19.4305,16.0134 18.828,17.474 17.8065,18.7235 16.4948,19.6043 15.1831,20.4851 13.64,20.9578 12.06,20.9628 10.48,20.9677 8.93392,20.5047 7.61674,19.6321 6.29956,18.7595 5.27025,17.5164 4.65863,16.0596 4.04701,14.6028 3.88046,12.9975 4.17999,11.4462 4.47952,9.89485 5.23171,8.46694 6.3417,7.34254 6.7297,6.9495 6.72562,6.31635 6.33258,5.92835 5.93955,5.54036 5.3064,5.54444 4.9184,5.93747 3.5309,7.34298 2.59067,9.12786 2.21626,11.067 1.84185,13.0062 2.05003,15.0128 2.81456,16.8338 3.57909,18.6549 4.86572,20.2087 6.5122,21.2994 8.15867,22.3902 10.0913,22.9689 12.0662,22.9627 14.0412,22.9566 15.9701,22.3657 17.6098,21.2647 19.2494,20.1637 20.5262,18.6018 21.2793,16.776 22.0324,14.9502 22.2281,12.9424 21.8415,11.0056 21.455,9.06878 20.5036,7.28981 19.1073,5.89303z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="重启软件" Click="MenuItemRestart_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M6.34315,6.34315C7.84299,4.8433 9.87707,4.0005 11.9981,4 14.2527,4.00897 16.4167,4.88785 18.039,6.45324L18.5858,7 16,7C15.4477,7 15,7.44772 15,8 15,8.55228 15.4477,9 16,9L21,9C21.1356,9 21.2649,8.97301 21.3828,8.92412 21.5007,8.87532 21.6112,8.80298 21.7071,8.70711 21.8902,8.52405 21.9874,8.28768 21.9989,8.04797 21.9996,8.03199 22,8.016 22,8L22,3C22,2.44772 21.5523,2 21,2 20.4477,2 20,2.44772 20,3L20,5.58579 19.4471,5.03289 19.435,5.02103C17.4405,3.09289,14.7779,2.01044,12.0038,2L12,2C9.34784,2 6.8043,3.05357 4.92893,4.92893 3.05357,6.8043 2,9.34784 2,12 2,12.5523 2.44772,13 3,13 3.55228,13 4,12.5523 4,12 4,9.87827 4.84285,7.84344 6.34315,6.34315z" />
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M22,12C22,14.6522 20.9464,17.1957 19.0711,19.0711 17.1957,20.9464 14.6522,22 12,22L11.9962,22C9.22213,21.9896,6.55946,20.9071,4.56496,18.979L4.55289,18.9671 4,18.4142 4,21C4,21.5523 3.55228,22 3,22 2.44772,22 2,21.5523 2,21L2,16.0002C2,15.8646 2.02699,15.7351 2.07588,15.6172 2.12432,15.5001 2.19595,15.3904 2.29078,15.295 2.29219,15.2936 2.2936,15.2922 2.29502,15.2908 2.48924,15.0977 2.74301,15.0008 2.997,15 2.998,15 2.999,15 3,15L8,15C8.55228,15 9,15.4477 9,16 9,16.5523 8.55228,17 8,17L5.41421,17 5.96095,17.5467C7.5833,19.1122 9.74736,19.9911 12.002,20 14.123,19.9995 16.157,19.1567 17.6569,17.6569 19.1571,16.1566 20,14.1217 20,12 20,11.4477 20.4477,11 21,11 21.5523,11 22,11.4477 22,12z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="重置配置" Click="MenuItemReset_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M2,6C2,5.44772,2.44772,5,3,5L21,5C21.5523,5 22,5.44772 22,6 22,6.55228 21.5523,7 21,7L3,7C2.44772,7,2,6.55228,2,6z" />
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M2,12C2,11.4477,2.44772,11,3,11L7,11C7.55228,11 8,11.4477 8,12 8,12.5523 7.55228,13 7,13L3,13C2.44772,13,2,12.5523,2,12z" />
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M3,17C2.44772,17 2,17.4477 2,18 2,18.5523 2.44772,19 3,19L7,19C7.55228,19 8,18.5523 8,18 8,17.4477 7.55228,17 7,17L3,17z" />
|
||||
<GeometryDrawing Brush="#FF222222"
|
||||
Geometry="F1 M24,24z M0,0z M12.3829,11.2029C13.4335,10.1522 14.8952,9.5 16.5,9.5 17.9587,9.5 19.3576,10.0795 20.3891,11.1109 21.4205,12.1424 22,13.5413 22,15 22,16.2593 21.6038,17.4867 20.8675,18.5083 20.1311,19.5299 19.092,20.2939 17.8974,20.6921 16.7027,21.0903 15.413,21.1026 14.211,20.7271 13.009,20.3516 11.9556,19.6074 11.2,18.6 10.8686,18.1582 10.9582,17.5314 11.4,17.2 11.8418,16.8686 12.4686,16.9582 12.8,17.4 13.3037,18.0716 14.006,18.5677 14.8073,18.8181 15.6087,19.0684 16.4685,19.0602 17.2649,18.7947 18.0614,18.5292 18.7541,18.0199 19.245,17.3388 19.7359,16.6578 20,15.8395 20,15 20,14.0717 19.6313,13.1815 18.9749,12.5251 18.3185,11.8687 17.4283,11.5 16.5,11.5 15.4448,11.5 14.4865,11.9278 13.7971,12.6171L13.4142,13 15,13C15.5523,13 16,13.4477 16,14 16,14.5523 15.5523,15 15,15L11.0007,15C10.9997,15 10.998,15 10.997,15 10.8625,14.9996 10.7343,14.9727 10.6172,14.9241 10.5001,14.8757 10.3904,14.804 10.295,14.7092 10.2936,14.7078 10.2922,14.7064 10.2908,14.705 10.196,14.6096 10.1243,14.4999 10.0759,14.3828 10.027,14.2649 10,14.1356 10,14L10,10C10,9.44772 10.4477,9 11,9 11.5523,9 12,9.44772 12,10L12,11.5858 12.3829,11.2029z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Header="切换到老设置" Click="MenuItemSwitchToOldSettings_Click"/>
|
||||
</ContextMenu>
|
||||
</Border.ContextMenu>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ItemsControl Name="SidebarItemsControl">
|
||||
@@ -536,14 +725,14 @@
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Line Visibility="{Binding _spVisibility}" Margin="0,6" HorizontalAlignment="Center" X1="0" X2="234" Y1="0" Y2="0" Stroke="#d3d3d3" StrokeThickness="1" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
|
||||
<Line Visibility="{Binding _spVisibility}" Margin="0,6" HorizontalAlignment="Center" X1="0" X2="234" Y1="0" Y2="0" Stroke="{Binding _spStroke}" StrokeThickness="1" StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
|
||||
<Border MouseDown="SidebarItem_MouseDown" MouseUp="SidebarItem_MouseUp" MouseLeave="SidebarItem_MouseLeave"
|
||||
Tag="{Binding}" Visibility="{Binding _siVisibility}" Background="{Binding _siBackground}" Height="40" Margin="6,0,6,0" CornerRadius="7">
|
||||
<Grid>
|
||||
<Border Height="40" CornerRadius="7" Background="#09090b" IsHitTestVisible="false" Opacity="0" Name="MouseFeedbackBorder"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Width="18" Height="18" Margin="14,0,9,0" VerticalAlignment="Center" Source="{Binding IconSource}"/>
|
||||
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding Title}" Foreground="#FF222222"/>
|
||||
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding Title}" Foreground="{Binding _siForeground}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
@@ -607,9 +796,9 @@
|
||||
<settingsViews:LuckyRandomPanel x:Name="LuckyRandomPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--存储面板-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="StoragePane">
|
||||
<settingsViews:StoragePanel x:Name="StoragePanel"/>
|
||||
<!--高级面板-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AdvancedPane">
|
||||
<settingsViews:AdvancedPanel x:Name="AdvancedPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--截图面板-->
|
||||
@@ -617,11 +806,6 @@
|
||||
<settingsViews:SnapshotPanel x:Name="SnapshotPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--高级面板-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AdvancedPane">
|
||||
<settingsViews:AdvancedPanel x:Name="AdvancedPanel"/>
|
||||
</Grid>
|
||||
|
||||
<!--SearchPanel-->
|
||||
<Grid Margin="0,0,0,0" Visibility="Collapsed" Name="SearchPane" ZIndex="1000">
|
||||
<settingsViews:SearchPanel x:Name="SearchPanelControl"/>
|
||||
@@ -629,11 +813,11 @@
|
||||
|
||||
<!--Topbar-->
|
||||
<Grid Height="48" VerticalAlignment="Top" Margin="250,0,0,0">
|
||||
<Border Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
|
||||
<Border x:Name="TopBarBorder" Height="48" CornerRadius="0,6,0,0" Background="#fafafa">
|
||||
<Border.Clip>
|
||||
<RectangleGeometry Rect="0,0,640,56"/>
|
||||
</Border.Clip>
|
||||
<Border Height="48" CornerRadius="0,6,0,0" Background="#fafafa" >
|
||||
<Border x:Name="TopBarBackgroundBorder" Height="48" CornerRadius="0,6,0,0" Background="#fafafa" >
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="-90" ShadowDepth="3" BlurRadius="4" Color="#000000" Opacity="0.25" x:Name="DropShadowEffectTopBar"/>
|
||||
</Border.Effect>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using Ink_Canvas.Windows.SettingsViews;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -14,14 +15,27 @@ namespace Ink_Canvas.Windows
|
||||
{
|
||||
public partial class SettingsWindow : Window
|
||||
{
|
||||
private MainWindow _mainWindow;
|
||||
|
||||
public SettingsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 获取 MainWindow 实例
|
||||
_mainWindow = Application.Current.MainWindow as MainWindow;
|
||||
|
||||
// 初始化搜索面板事件
|
||||
SearchPanelControl.NavigateToItem += SearchPanel_NavigateToItem;
|
||||
SearchPanelControl.CloseSearch += SearchPanel_CloseSearch;
|
||||
|
||||
// 订阅菜单关闭事件,确保状态同步
|
||||
if (MenuButtonContextMenu != null)
|
||||
{
|
||||
MenuButtonContextMenu.Closed += (s, e) =>
|
||||
{
|
||||
// 菜单关闭时的处理
|
||||
};
|
||||
}
|
||||
|
||||
// 初始化侧边栏项目
|
||||
SidebarItemsControl.ItemsSource = SidebarItems;
|
||||
@@ -74,7 +88,7 @@ namespace Ink_Canvas.Windows
|
||||
Type = SidebarItemType.Item,
|
||||
Title = "快捷键设置",
|
||||
Name = "ShortcutsItem",
|
||||
IconSource = FindResource("AppearanceIcon") as DrawingImage,
|
||||
IconSource = FindResource("ShortcutsIcon") as DrawingImage,
|
||||
Selected = false,
|
||||
});
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
@@ -82,7 +96,7 @@ namespace Ink_Canvas.Windows
|
||||
Type = SidebarItemType.Item,
|
||||
Title = "崩溃处理",
|
||||
Name = "CrashActionItem",
|
||||
IconSource = FindResource("AppearanceIcon") as DrawingImage,
|
||||
IconSource = FindResource("CrashActionIcon") as DrawingImage,
|
||||
Selected = false,
|
||||
});
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
@@ -121,9 +135,9 @@ namespace Ink_Canvas.Windows
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
{
|
||||
Type = SidebarItemType.Item,
|
||||
Title = "存储空间",
|
||||
Name = "StorageItem",
|
||||
IconSource = FindResource("StorageIcon") as DrawingImage,
|
||||
Title = "高级选项",
|
||||
Name = "AdvancedItem",
|
||||
IconSource = FindResource("AdvancedIcon") as DrawingImage,
|
||||
Selected = false,
|
||||
});
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
@@ -139,14 +153,6 @@ namespace Ink_Canvas.Windows
|
||||
Type = SidebarItemType.Separator
|
||||
});
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
{
|
||||
Type = SidebarItemType.Item,
|
||||
Title = "高级选项",
|
||||
Name = "AdvancedItem",
|
||||
IconSource = FindResource("AdvancedIcon") as DrawingImage,
|
||||
Selected = false,
|
||||
});
|
||||
SidebarItems.Add(new SidebarItem()
|
||||
{
|
||||
Type = SidebarItemType.Item,
|
||||
Title = "关于 InkCanvasForClass",
|
||||
@@ -166,9 +172,8 @@ namespace Ink_Canvas.Windows
|
||||
AutomationPane,
|
||||
PowerPointPane,
|
||||
LuckyRandomPane,
|
||||
StoragePane,
|
||||
SnapshotPane,
|
||||
AdvancedPane
|
||||
AdvancedPane,
|
||||
SnapshotPane
|
||||
};
|
||||
|
||||
SettingsPaneScrollViewers = new ScrollViewer[] {
|
||||
@@ -183,9 +188,8 @@ namespace Ink_Canvas.Windows
|
||||
AutomationPanel.ScrollViewerEx,
|
||||
PowerPointPanel.ScrollViewerEx,
|
||||
LuckyRandomPanel.ScrollViewerEx,
|
||||
StoragePanel.ScrollViewerEx,
|
||||
SnapshotPanel.ScrollViewerEx,
|
||||
AdvancedPanel.ScrollViewerEx
|
||||
AdvancedPanel.ScrollViewerEx,
|
||||
SnapshotPanel.ScrollViewerEx
|
||||
};
|
||||
|
||||
SettingsPaneTitles = new string[] {
|
||||
@@ -200,9 +204,8 @@ namespace Ink_Canvas.Windows
|
||||
"自动化",
|
||||
"PowerPoint",
|
||||
"幸运随机",
|
||||
"存储",
|
||||
"截图",
|
||||
"高级"
|
||||
"高级",
|
||||
"截图"
|
||||
};
|
||||
|
||||
SettingsPaneNames = new string[] {
|
||||
@@ -217,9 +220,8 @@ namespace Ink_Canvas.Windows
|
||||
"AutomationItem",
|
||||
"PowerPointItem",
|
||||
"LuckyRandomItem",
|
||||
"StorageItem",
|
||||
"SnapshotItem",
|
||||
"AdvancedItem"
|
||||
"AdvancedItem",
|
||||
"SnapshotItem"
|
||||
};
|
||||
|
||||
SettingsAboutPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
@@ -240,24 +242,581 @@ namespace Ink_Canvas.Windows
|
||||
PowerPointPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
ThemePanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
ThemePanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
|
||||
// 监听主题变化
|
||||
ThemePanel.ThemeChanged += (o, s) =>
|
||||
{
|
||||
ApplyTheme();
|
||||
ApplyThemeToAllPanels();
|
||||
};
|
||||
ShortcutsPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
ShortcutsPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
CrashActionPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
CrashActionPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
LuckyRandomPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
LuckyRandomPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
StoragePanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
StoragePanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
SnapshotPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
SnapshotPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
AdvancedPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
AdvancedPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
SnapshotPanel.IsTopBarNeedShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0.25;
|
||||
SnapshotPanel.IsTopBarNeedNoShadowEffect += (o, s) => DropShadowEffectTopBar.Opacity = 0;
|
||||
|
||||
_selectedSidebarItemName = "CanvasAndInkItem";
|
||||
_selectedSidebarItemName = "StartupItem";
|
||||
|
||||
// 初始化侧边栏项目的主题状态
|
||||
bool isDarkTheme = MainWindow.Settings?.Appearance != null &&
|
||||
(MainWindow.Settings.Appearance.Theme == 1 ||
|
||||
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight()));
|
||||
foreach (var item in SidebarItems)
|
||||
{
|
||||
item.IsDarkTheme = isDarkTheme;
|
||||
}
|
||||
|
||||
UpdateSidebarItemsSelection();
|
||||
|
||||
// 为自定义滑块控件添加触摸支持
|
||||
AddTouchSupportToCustomSliders();
|
||||
|
||||
// 先应用主题,确保标题栏等元素正确显示
|
||||
ApplyTheme();
|
||||
|
||||
// 加载所有面板的设置
|
||||
LoadAllPanelsSettings();
|
||||
|
||||
// 通知所有面板应用主题
|
||||
ApplyThemeToAllPanels();
|
||||
|
||||
// 延迟再次应用主题,确保所有元素都正确应用主题(特别是标题栏)
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ApplyTheme();
|
||||
ApplyThemeToAllPanels();
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通知所有面板应用主题
|
||||
/// </summary>
|
||||
private void ApplyThemeToAllPanels()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool isDarkTheme = MainWindow.Settings?.Appearance != null &&
|
||||
(MainWindow.Settings.Appearance.Theme == 1 ||
|
||||
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight()));
|
||||
|
||||
// 使用反射调用所有面板的 ApplyTheme 方法(如果存在)
|
||||
var panels = new UserControl[]
|
||||
{
|
||||
StartupPanel, CanvasAndInkPanel, GesturesPanel, InkRecognitionPanel,
|
||||
ThemePanel, ShortcutsPanel, CrashActionPanel, PowerPointPanel,
|
||||
AutomationPanel, LuckyRandomPanel, AdvancedPanel, SnapshotPanel,
|
||||
SettingsAboutPanel, AppearancePanel, SearchPanelControl
|
||||
};
|
||||
|
||||
foreach (var panel in panels)
|
||||
{
|
||||
if (panel != null)
|
||||
{
|
||||
var method = panel.GetType().GetMethod("ApplyTheme",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (method != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
method.Invoke(panel, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"应用主题到 {panel.GetType().Name} 时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"通知面板应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用主题
|
||||
/// </summary>
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (MainWindow.Settings?.Appearance == null) return;
|
||||
|
||||
bool isDarkTheme = MainWindow.Settings.Appearance.Theme == 1 ||
|
||||
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight());
|
||||
|
||||
if (isDarkTheme)
|
||||
{
|
||||
// 深色主题 - 参考 Windows 系统设置
|
||||
if (MainBorder != null)
|
||||
{
|
||||
MainBorder.Background = ThemeHelper.GetBackgroundPrimaryBrush(); // Windows 系统主背景 #202020
|
||||
MainBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(0, 120, 215)); // Windows 系统强调色(蓝色)
|
||||
}
|
||||
if (SidebarBorder != null)
|
||||
{
|
||||
SidebarBorder.Background = ThemeHelper.GetBackgroundSecondaryBrush(); // Windows 系统次要背景 #191919
|
||||
SidebarBorder.BorderBrush = ThemeHelper.GetBorderPrimaryBrush(); // Windows 系统边框
|
||||
}
|
||||
if (SearchButtonBorder != null)
|
||||
{
|
||||
SearchButtonBorder.Background = ThemeHelper.GetButtonBackgroundBrush(); // Windows 系统按钮背景
|
||||
// 更新搜索按钮图标颜色
|
||||
UpdateButtonIconColor(SearchButtonBorder, true);
|
||||
}
|
||||
if (MenuButtonBorder != null)
|
||||
{
|
||||
MenuButtonBorder.Background = ThemeHelper.GetButtonBackgroundBrush(); // Windows 系统按钮背景
|
||||
// 更新菜单按钮图标颜色
|
||||
UpdateButtonIconColor(MenuButtonBorder, true);
|
||||
}
|
||||
if (TitleTextBlock != null)
|
||||
{
|
||||
TitleTextBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); // Windows 系统主文字颜色
|
||||
}
|
||||
if (MenuButtonContextMenu != null)
|
||||
{
|
||||
MenuButtonContextMenu.Background = ThemeHelper.GetBackgroundSecondaryBrush(); // Windows 系统菜单背景
|
||||
MenuButtonContextMenu.BorderBrush = ThemeHelper.GetBorderPrimaryBrush(); // Windows 系统边框
|
||||
// 更新上下文菜单中的图标和文字颜色
|
||||
UpdateContextMenuTheme(MenuButtonContextMenu, true);
|
||||
}
|
||||
if (SettingsWindowTitle != null)
|
||||
{
|
||||
SettingsWindowTitle.Foreground = ThemeHelper.GetTextPrimaryBrush(); // Windows 系统主文字颜色
|
||||
}
|
||||
if (TopBarBorder != null)
|
||||
{
|
||||
TopBarBorder.Background = ThemeHelper.GetBackgroundPrimaryBrush(); // Windows 系统主背景
|
||||
}
|
||||
// 更新内部标题栏背景 - 使用直接访问而不是 FindDescendantByName
|
||||
// TopBarBackgroundBorder 是 TopBarBorder 的直接子元素
|
||||
if (TopBarBorder != null && TopBarBorder.Child is Border topBarBackgroundBorder)
|
||||
{
|
||||
topBarBackgroundBorder.Background = ThemeHelper.GetBackgroundPrimaryBrush(); // Windows 系统主背景
|
||||
}
|
||||
// 如果上面的方法找不到,尝试使用 FindDescendantByName 作为备用
|
||||
var topBarBackgroundBorderFallback = this.FindDescendantByName("TopBarBackgroundBorder") as Border;
|
||||
if (topBarBackgroundBorderFallback != null)
|
||||
{
|
||||
topBarBackgroundBorderFallback.Background = ThemeHelper.GetBackgroundPrimaryBrush(); // Windows 系统主背景
|
||||
}
|
||||
|
||||
// 更新侧边栏项目文本颜色
|
||||
foreach (var item in SidebarItems)
|
||||
{
|
||||
// 通过反射或直接访问来更新文本颜色
|
||||
// 这里需要在 XAML 中绑定或通过其他方式更新
|
||||
}
|
||||
|
||||
// 更新滚动条样式 - 参考 Windows 系统设置
|
||||
var scrollBarTrack = this.FindDescendantByName("ScrollBarBorderTrackBackground") as Border;
|
||||
if (scrollBarTrack != null)
|
||||
{
|
||||
scrollBarTrack.Background = ThemeHelper.GetScrollBarTrackBrush(); // Windows 系统滚动条轨道
|
||||
scrollBarTrack.Opacity = 0.3;
|
||||
}
|
||||
|
||||
// 更新侧边栏项目主题
|
||||
foreach (var item in SidebarItems)
|
||||
{
|
||||
item.IsDarkTheme = true;
|
||||
}
|
||||
CollectionViewSource.GetDefaultView(SidebarItems).Refresh();
|
||||
|
||||
// 更新图标颜色
|
||||
UpdateIconColors(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 浅色主题(默认)
|
||||
if (MainBorder != null)
|
||||
{
|
||||
MainBorder.Background = new SolidColorBrush(Color.FromRgb(250, 250, 250));
|
||||
MainBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(53, 132, 228));
|
||||
}
|
||||
if (SidebarBorder != null)
|
||||
{
|
||||
SidebarBorder.Background = new SolidColorBrush(Color.FromRgb(235, 235, 235));
|
||||
SidebarBorder.BorderBrush = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
}
|
||||
if (SearchButtonBorder != null)
|
||||
{
|
||||
SearchButtonBorder.Background = new SolidColorBrush(Color.FromRgb(217, 217, 217));
|
||||
// 更新搜索按钮图标颜色
|
||||
UpdateButtonIconColor(SearchButtonBorder, false);
|
||||
}
|
||||
if (MenuButtonBorder != null)
|
||||
{
|
||||
MenuButtonBorder.Background = new SolidColorBrush(Color.FromRgb(217, 217, 217));
|
||||
// 更新菜单按钮图标颜色
|
||||
UpdateButtonIconColor(MenuButtonBorder, false);
|
||||
}
|
||||
if (TitleTextBlock != null)
|
||||
{
|
||||
TitleTextBlock.Foreground = new SolidColorBrush(Color.FromRgb(46, 52, 54));
|
||||
}
|
||||
if (MenuButtonContextMenu != null)
|
||||
{
|
||||
MenuButtonContextMenu.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
|
||||
MenuButtonContextMenu.BorderBrush = new SolidColorBrush(Color.FromRgb(211, 211, 211));
|
||||
// 更新上下文菜单中的图标和文字颜色
|
||||
UpdateContextMenuTheme(MenuButtonContextMenu, false);
|
||||
}
|
||||
if (SettingsWindowTitle != null)
|
||||
{
|
||||
SettingsWindowTitle.Foreground = new SolidColorBrush(Color.FromRgb(46, 52, 54));
|
||||
}
|
||||
if (TopBarBorder != null)
|
||||
{
|
||||
TopBarBorder.Background = new SolidColorBrush(Color.FromRgb(250, 250, 250));
|
||||
}
|
||||
// 更新内部标题栏背景 - 使用直接访问而不是 FindDescendantByName
|
||||
// TopBarBackgroundBorder 是 TopBarBorder 的直接子元素
|
||||
if (TopBarBorder != null && TopBarBorder.Child is Border topBarBackgroundBorder)
|
||||
{
|
||||
topBarBackgroundBorder.Background = new SolidColorBrush(Color.FromRgb(250, 250, 250));
|
||||
}
|
||||
// 如果上面的方法找不到,尝试使用 FindDescendantByName 作为备用
|
||||
var topBarBackgroundBorderFallback = this.FindDescendantByName("TopBarBackgroundBorder") as Border;
|
||||
if (topBarBackgroundBorderFallback != null)
|
||||
{
|
||||
topBarBackgroundBorderFallback.Background = new SolidColorBrush(Color.FromRgb(250, 250, 250));
|
||||
}
|
||||
|
||||
// 更新滚动条样式
|
||||
var scrollBarTrack = this.FindDescendantByName("ScrollBarBorderTrackBackground") as Border;
|
||||
if (scrollBarTrack != null)
|
||||
{
|
||||
scrollBarTrack.Background = ThemeHelper.GetScrollBarTrackBrush(); // Windows 系统滚动条轨道
|
||||
scrollBarTrack.Opacity = 0;
|
||||
}
|
||||
|
||||
// 更新侧边栏项目主题
|
||||
foreach (var item in SidebarItems)
|
||||
{
|
||||
item.IsDarkTheme = false;
|
||||
}
|
||||
CollectionViewSource.GetDefaultView(SidebarItems).Refresh();
|
||||
|
||||
// 更新图标颜色
|
||||
UpdateIconColors(false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新所有图标颜色以适配主题
|
||||
/// </summary>
|
||||
private void UpdateIconColors(bool isDarkTheme)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 根据主题选择颜色
|
||||
Color iconColor = isDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
// 更新每个侧边栏项目的图标
|
||||
foreach (var item in SidebarItems)
|
||||
{
|
||||
if (item.IconSource is DrawingImage drawingImage &&
|
||||
drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
{
|
||||
// 克隆并更新图标
|
||||
var clonedDrawing = CloneDrawingGroup(drawingGroup, iconColor);
|
||||
item.IconSource = new DrawingImage { Drawing = clonedDrawing };
|
||||
}
|
||||
}
|
||||
|
||||
CollectionViewSource.GetDefaultView(SidebarItems).Refresh();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新图标颜色时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 DrawingGroup 并更新颜色
|
||||
/// </summary>
|
||||
private DrawingGroup CloneDrawingGroup(DrawingGroup source, Color newColor)
|
||||
{
|
||||
var cloned = new DrawingGroup();
|
||||
cloned.ClipGeometry = source.ClipGeometry?.Clone();
|
||||
cloned.Opacity = source.Opacity;
|
||||
cloned.Transform = source.Transform?.Clone();
|
||||
|
||||
foreach (var drawing in source.Children)
|
||||
{
|
||||
if (drawing is GeometryDrawing geometryDrawing)
|
||||
{
|
||||
var clonedGeometry = geometryDrawing.Geometry?.Clone();
|
||||
var clonedBrush = CloneBrush(geometryDrawing.Brush, newColor);
|
||||
var clonedPen = geometryDrawing.Pen != null
|
||||
? ClonePen(geometryDrawing.Pen, newColor)
|
||||
: null;
|
||||
|
||||
cloned.Children.Add(new GeometryDrawing(clonedBrush, clonedPen, clonedGeometry));
|
||||
}
|
||||
else if (drawing is DrawingGroup subGroup)
|
||||
{
|
||||
cloned.Children.Add(CloneDrawingGroup(subGroup, newColor));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 对于其他类型的 Drawing,尝试克隆
|
||||
cloned.Children.Add(drawing);
|
||||
}
|
||||
}
|
||||
|
||||
return cloned;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Brush 并更新颜色
|
||||
/// </summary>
|
||||
private Brush CloneBrush(Brush source, Color newColor)
|
||||
{
|
||||
if (source is SolidColorBrush solidBrush)
|
||||
{
|
||||
// 检查是否是深色(需要更新的颜色)
|
||||
var originalColor = solidBrush.Color;
|
||||
if (originalColor.R == 34 && originalColor.G == 34 && originalColor.B == 34) // #222222
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
else if (originalColor.A > 0 && originalColor != Colors.Transparent &&
|
||||
originalColor.R < 50 && originalColor.G < 50 && originalColor.B < 50) // 深色
|
||||
{
|
||||
return new SolidColorBrush(newColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
// 保持其他颜色不变(如透明色)
|
||||
return new SolidColorBrush(originalColor) { Opacity = solidBrush.Opacity };
|
||||
}
|
||||
return source?.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 克隆 Pen 并更新颜色
|
||||
/// </summary>
|
||||
private Pen ClonePen(Pen source, Color newColor)
|
||||
{
|
||||
var clonedBrush = CloneBrush(source.Brush, newColor);
|
||||
return new Pen(clonedBrush, source.Thickness)
|
||||
{
|
||||
StartLineCap = source.StartLineCap,
|
||||
EndLineCap = source.EndLineCap,
|
||||
LineJoin = source.LineJoin,
|
||||
MiterLimit = source.MiterLimit
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新上下文菜单的主题(图标和文字颜色)
|
||||
/// </summary>
|
||||
private void UpdateContextMenuTheme(ContextMenu contextMenu, bool isDarkTheme)
|
||||
{
|
||||
try
|
||||
{
|
||||
Color iconColor = isDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
foreach (var item in contextMenu.Items)
|
||||
{
|
||||
if (item is MenuItem menuItem)
|
||||
{
|
||||
// 更新文字颜色
|
||||
menuItem.Foreground = ThemeHelper.GetTextPrimaryBrush();
|
||||
|
||||
// 更新图标颜色
|
||||
if (menuItem.Icon is Image iconImage && iconImage.Source is DrawingImage drawingImage)
|
||||
{
|
||||
if (drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
{
|
||||
var clonedDrawing = CloneDrawingGroup(drawingGroup, iconColor);
|
||||
iconImage.Source = new DrawingImage { Drawing = clonedDrawing };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新上下文菜单主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新按钮中的图标颜色
|
||||
/// </summary>
|
||||
private void UpdateButtonIconColor(Border buttonBorder, bool isDarkTheme)
|
||||
{
|
||||
try
|
||||
{
|
||||
Color iconColor = isDarkTheme
|
||||
? Color.FromRgb(243, 243, 243) // 深色主题使用浅色图标 #F3F3F3
|
||||
: Color.FromRgb(34, 34, 34); // 浅色主题使用深色图标 #222222
|
||||
|
||||
// 查找按钮中的 Image 控件
|
||||
var image = FindVisualChild<Image>(buttonBorder);
|
||||
if (image != null && image.Source is DrawingImage drawingImage)
|
||||
{
|
||||
if (drawingImage.Drawing is DrawingGroup drawingGroup)
|
||||
{
|
||||
var clonedDrawing = CloneDrawingGroup(drawingGroup, iconColor);
|
||||
image.Source = new DrawingImage { Drawing = clonedDrawing };
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"更新按钮图标颜色时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在视觉树中查找指定类型的子元素
|
||||
/// </summary>
|
||||
private T FindVisualChild<T>(DependencyObject parent) where T : DependencyObject
|
||||
{
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is T result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
var childOfChild = FindVisualChild<T>(child);
|
||||
if (childOfChild != null)
|
||||
{
|
||||
return childOfChild;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查系统主题是否为浅色
|
||||
/// </summary>
|
||||
private bool IsSystemThemeLight()
|
||||
{
|
||||
try
|
||||
{
|
||||
var registryKey = Microsoft.Win32.Registry.CurrentUser;
|
||||
var themeKey = registryKey.OpenSubKey("software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
|
||||
var keyValue = 0;
|
||||
if (themeKey != null) keyValue = (int)themeKey.GetValue("SystemUsesLightTheme");
|
||||
return keyValue == 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true; // 默认返回浅色主题
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载所有设置面板的设置
|
||||
/// </summary>
|
||||
private void LoadAllPanelsSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 预加载所有面板,确保它们在显示前都已初始化
|
||||
// 使用 Dispatcher.BeginInvoke 延迟执行,确保所有面板都已创建
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// 所有设置面板列表
|
||||
var allPanels = new UserControl[]
|
||||
{
|
||||
StartupPanel,
|
||||
CanvasAndInkPanel,
|
||||
GesturesPanel,
|
||||
InkRecognitionPanel,
|
||||
ThemePanel,
|
||||
ShortcutsPanel,
|
||||
CrashActionPanel,
|
||||
PowerPointPanel,
|
||||
AutomationPanel,
|
||||
LuckyRandomPanel,
|
||||
AdvancedPanel,
|
||||
SnapshotPanel,
|
||||
SettingsAboutPanel,
|
||||
AppearancePanel
|
||||
};
|
||||
|
||||
// 预加载所有面板:调用 LoadSettings、EnableTouchSupport 和 ApplyTheme
|
||||
foreach (var panel in allPanels)
|
||||
{
|
||||
if (panel != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 直接调用 LoadSettings 确保设置被加载
|
||||
var loadSettingsMethod = panel.GetType().GetMethod("LoadSettings",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (loadSettingsMethod != null)
|
||||
{
|
||||
loadSettingsMethod.Invoke(panel, null);
|
||||
}
|
||||
|
||||
// 调用 EnableTouchSupport 确保触摸支持已启用
|
||||
var enableTouchSupportMethod = panel.GetType().GetMethod("EnableTouchSupport",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (enableTouchSupportMethod != null)
|
||||
{
|
||||
enableTouchSupportMethod.Invoke(panel, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果面板没有 EnableTouchSupport 方法,直接使用 MainWindowSettingsHelper
|
||||
MainWindowSettingsHelper.EnableTouchSupportForControls(panel);
|
||||
}
|
||||
|
||||
// 调用 ApplyTheme 确保主题已应用
|
||||
var applyThemeMethod = panel.GetType().GetMethod("ApplyTheme",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (applyThemeMethod != null)
|
||||
{
|
||||
applyThemeMethod.Invoke(panel, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"预加载面板 {panel?.GetType().Name} 时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 再次应用主题到所有面板,确保主题完全加载
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
ApplyThemeToAllPanels();
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"预加载所有面板时出错: {ex.Message}");
|
||||
}
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"加载设置面板设置时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -268,13 +827,37 @@ namespace Ink_Canvas.Windows
|
||||
Separator
|
||||
}
|
||||
|
||||
public class SidebarItem
|
||||
public class SidebarItem : System.ComponentModel.INotifyPropertyChanged
|
||||
{
|
||||
public SidebarItemType Type { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Name { get; set; }
|
||||
public ImageSource IconSource { get; set; }
|
||||
public bool Selected { get; set; }
|
||||
private bool _selected = false;
|
||||
private bool _isDarkTheme = false;
|
||||
|
||||
public bool Selected
|
||||
{
|
||||
get => _selected;
|
||||
set
|
||||
{
|
||||
_selected = value;
|
||||
OnPropertyChanged(nameof(_siBackground));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDarkTheme
|
||||
{
|
||||
get => _isDarkTheme;
|
||||
set
|
||||
{
|
||||
_isDarkTheme = value;
|
||||
OnPropertyChanged(nameof(_siForeground));
|
||||
OnPropertyChanged(nameof(_siBackground));
|
||||
OnPropertyChanged(nameof(_spStroke));
|
||||
}
|
||||
}
|
||||
|
||||
public Visibility _spVisibility
|
||||
{
|
||||
get => Type == SidebarItemType.Separator ? Visibility.Visible : Visibility.Collapsed;
|
||||
@@ -286,9 +869,36 @@ namespace Ink_Canvas.Windows
|
||||
|
||||
public SolidColorBrush _siBackground
|
||||
{
|
||||
get => Selected
|
||||
? new SolidColorBrush(Color.FromRgb(217, 217, 217))
|
||||
: new SolidColorBrush(Colors.Transparent);
|
||||
get
|
||||
{
|
||||
if (Selected)
|
||||
{
|
||||
return _isDarkTheme
|
||||
? ThemeHelper.GetSelectedBackgroundBrush() // Windows 系统选中背景 #3E3E3E
|
||||
: new SolidColorBrush(Color.FromRgb(237, 237, 237));
|
||||
}
|
||||
return new SolidColorBrush(Colors.Transparent);
|
||||
}
|
||||
}
|
||||
|
||||
public SolidColorBrush _siForeground
|
||||
{
|
||||
get => _isDarkTheme
|
||||
? ThemeHelper.GetTextPrimaryBrush() // Windows 系统主文字颜色 #F3F3F3
|
||||
: new SolidColorBrush(Color.FromRgb(0, 0, 0));
|
||||
}
|
||||
|
||||
public SolidColorBrush _spStroke
|
||||
{
|
||||
get => _isDarkTheme
|
||||
? ThemeHelper.GetSeparatorBrush() // Windows 系统分隔线 #3E3E3E
|
||||
: new SolidColorBrush(Color.FromRgb(237, 237, 237));
|
||||
}
|
||||
|
||||
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +921,36 @@ namespace Ink_Canvas.Windows
|
||||
}
|
||||
}
|
||||
CollectionViewSource.GetDefaultView(SidebarItems).Refresh();
|
||||
|
||||
// 确保主题状态同步
|
||||
bool isDarkTheme = MainWindow.Settings?.Appearance != null &&
|
||||
(MainWindow.Settings.Appearance.Theme == 1 ||
|
||||
(MainWindow.Settings.Appearance.Theme == 2 && !IsSystemThemeLight()));
|
||||
foreach (var si in SidebarItems)
|
||||
{
|
||||
si.IsDarkTheme = isDarkTheme;
|
||||
}
|
||||
|
||||
// 定义面板映射
|
||||
var panelMappings = new Dictionary<string, UserControl>
|
||||
{
|
||||
{ "AboutItem", SettingsAboutPanel },
|
||||
{ "CanvasAndInkItem", CanvasAndInkPanel },
|
||||
{ "GesturesItem", GesturesPanel },
|
||||
{ "StartupItem", StartupPanel },
|
||||
{ "ThemeItem", ThemePanel },
|
||||
{ "ShortcutsItem", ShortcutsPanel },
|
||||
{ "CrashActionItem", CrashActionPanel },
|
||||
{ "InkRecognitionItem", InkRecognitionPanel },
|
||||
{ "AutomationItem", AutomationPanel },
|
||||
{ "PowerPointItem", PowerPointPanel },
|
||||
{ "LuckyRandomItem", LuckyRandomPanel },
|
||||
{ "AdvancedItem", AdvancedPanel },
|
||||
{ "SnapshotItem", SnapshotPanel },
|
||||
{ "AppearanceItem", AppearancePanel }
|
||||
};
|
||||
|
||||
// 设置面板可见性并应用主题
|
||||
if (AboutPane != null) AboutPane.Visibility = _selectedSidebarItemName == "AboutItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (CanvasAndInkPane != null) CanvasAndInkPane.Visibility = _selectedSidebarItemName == "CanvasAndInkItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (GesturesPane != null) GesturesPane.Visibility = _selectedSidebarItemName == "GesturesItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
@@ -323,9 +962,33 @@ namespace Ink_Canvas.Windows
|
||||
if (AutomationPane != null) AutomationPane.Visibility = _selectedSidebarItemName == "AutomationItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (PowerPointPane != null) PowerPointPane.Visibility = _selectedSidebarItemName == "PowerPointItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (LuckyRandomPane != null) LuckyRandomPane.Visibility = _selectedSidebarItemName == "LuckyRandomItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (StoragePane != null) StoragePane.Visibility = _selectedSidebarItemName == "StorageItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (SnapshotPane != null) SnapshotPane.Visibility = _selectedSidebarItemName == "SnapshotItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (AdvancedPane != null) AdvancedPane.Visibility = _selectedSidebarItemName == "AdvancedItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
if (SnapshotPane != null) SnapshotPane.Visibility = _selectedSidebarItemName == "SnapshotItem" ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
// 为新显示的面板应用主题(延迟执行,确保面板已完全显示)
|
||||
if (panelMappings.ContainsKey(_selectedSidebarItemName))
|
||||
{
|
||||
var selectedPanel = panelMappings[_selectedSidebarItemName];
|
||||
if (selectedPanel != null)
|
||||
{
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var applyThemeMethod = selectedPanel.GetType().GetMethod("ApplyTheme",
|
||||
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
||||
if (applyThemeMethod != null)
|
||||
{
|
||||
applyThemeMethod.Invoke(selectedPanel, null);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"切换面板时应用主题到 {selectedPanel.GetType().Name} 时出错: {ex.Message}");
|
||||
}
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
}
|
||||
if (SettingsPaneScrollViewers != null)
|
||||
{
|
||||
foreach (var sv in SettingsPaneScrollViewers)
|
||||
@@ -490,7 +1153,68 @@ namespace Ink_Canvas.Windows
|
||||
|
||||
private void MenuButton_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
// 菜单功能 - 可以显示上下文菜单或选项菜单
|
||||
// 切换上下文菜单的显示状态
|
||||
if (MenuButtonContextMenu != null)
|
||||
{
|
||||
MenuButtonContextMenu.PlacementTarget = MenuButtonBorder;
|
||||
MenuButtonContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
|
||||
|
||||
// 如果菜单已打开,则关闭;如果已关闭,则打开
|
||||
bool isCurrentlyOpen = MenuButtonContextMenu.IsOpen;
|
||||
|
||||
if (isCurrentlyOpen)
|
||||
{
|
||||
// 如果菜单已打开,直接关闭
|
||||
MenuButtonContextMenu.IsOpen = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果菜单未打开,打开菜单
|
||||
MenuButtonContextMenu.IsOpen = true;
|
||||
}
|
||||
|
||||
// 标记事件已处理,防止菜单拦截点击
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItemExit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 关闭设置窗口
|
||||
Close();
|
||||
|
||||
// 调用主窗口的退出方法
|
||||
if (_mainWindow != null)
|
||||
{
|
||||
_mainWindow.BtnExit_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItemRestart_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 关闭设置窗口
|
||||
Close();
|
||||
|
||||
// 调用主窗口的重启方法
|
||||
if (_mainWindow != null)
|
||||
{
|
||||
_mainWindow.BtnRestart_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItemReset_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 调用主窗口的重置配置方法
|
||||
if (_mainWindow != null)
|
||||
{
|
||||
_mainWindow.BtnResetToSuggestion_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void MenuItemSwitchToOldSettings_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 关闭新设置窗口
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ToggleSwitch_Click(object sender, MouseButtonEventArgs e)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||

|
||||

|
||||
[](#贡献者)
|
||||
[](https://deepwiki.com/InkCanvasForClass/community)
|
||||
|
||||
[](https://discord.gg/ahj7eJWhEG)
|
||||
[](https://qm.qq.com/q/qo32AclNh6)
|
||||
@@ -77,7 +78,7 @@
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/CJKmkp"><img src="https://avatars.githubusercontent.com/u/113243675?v=4?s=100" width="100px;" alt="CJK_mkp"/><br /><sub><b>CJK_mkp</b></sub></a><br /><a href="#maintenance-CJKmkp" title="Maintenance">🚧</a> <a href="#doc-CJKmkp" title="Documentation">📖</a> <a href="#code-CJKmkp" title="Code">💻</a> <a href="#design-CJKmkp" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/CreeperAWA"><img src="https://avatars.githubusercontent.com/u/134939494?v=4?s=100" width="100px;" alt="CreeperAWA"/><br /><sub><b>CreeperAWA</b></sub></a><br /><a href="#code-CreeperAWA" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/2-2-3-trimethylpentane"><img src="https://avatars.githubusercontent.com/u/141403762?v=4?s=100" width="100px;" alt="2,2,3-三甲基戊烷"/><br /><sub><b>2,2,3-三甲基戊烷</b></sub></a><br /><a href="#blog-2-2-3-trimethylpentane" title="Blogposts">📝</a> <a href="#doc-2-2-3-trimethylpentane" title="Documentation">📖</a> <a href="#design-2-2-3-trimethylpentane" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/2-2-3-trimethylpentane"><img src="https://avatars.githubusercontent.com/u/141403762?v=4?s=100" width="100px;" alt="2,2,3-三甲基戊烷"/><br /><sub><b>2,2,3-三甲基戊烷</b></sub></a><br /><a href="#blog-2-2-3-trimethylpentane" title="Blogposts">📝</a> <a href="#doc-2-2-3-trimethylpentane" title="Documentation">📖</a> <a href="#design-2-2-3-trimethylpentane" title="Design">🎨</a> <a href="#test-2-2-3-trimethylpentane" title="Tests">⚠️</a> <a href="#tutorial-2-2-3-trimethylpentane" title="Tutorials">✅</a> <a href="#video-2-2-3-trimethylpentane" title="Videos">📹</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Alan-CRL"><img src="https://avatars.githubusercontent.com/u/92425617?v=4?s=100" width="100px;" alt="Alan-CRL"/><br /><sub><b>Alan-CRL</b></sub></a><br /><a href="#code-Alan-CRL" title="Code">💻</a> <a href="#infra-Alan-CRL" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#doc-Alan-CRL" title="Documentation">📖</a> <a href="#financial-Alan-CRL" title="Financial">💵</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/MKStoler1024"><img src="https://avatars.githubusercontent.com/u/158786854?v=4?s=100" width="100px;" alt="MKStoler1024"/><br /><sub><b>MKStoler1024</b></sub></a><br /><a href="#doc-MKStoler1024" title="Documentation">📖</a> <a href="#code-MKStoler1024" title="Code">💻</a> <a href="#design-MKStoler1024" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/awesome-iwb"><img src="https://avatars.githubusercontent.com/u/184760810?v=4?s=100" width="100px;" alt="Awesome Iwb"/><br /><sub><b>Awesome Iwb</b></sub></a><br /><a href="#doc-awesome-iwb" title="Documentation">📖</a></td>
|
||||
@@ -106,3 +107,4 @@ GPLv3
|
||||
|
||||
## 项目引用
|
||||
[Alan-CRL/DesktopDrawpadBlocker](https://github.com/Alan-CRL/DesktopDrawpadBlocker)
|
||||
[Alan-CRL/Inkeys](https://github.com/Alan-CRL/Inkeys)
|
||||
Reference in New Issue
Block a user