From 7635b3f8a24903eaaf829e54bf73bc7a50fbc69e Mon Sep 17 00:00:00 2001 From: WMJ Date: Thu, 23 Jun 2022 14:47:55 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BC=81=E4=BF=AE=E5=A4=8D=E9=AB=98=E5=88=86?= =?UTF-8?q?=E8=BE=A8=E7=8E=87=E6=98=BE=E7=A4=BA=E5=99=A8=E4=B8=8B=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E4=BE=A7=E8=BE=B9=E6=A0=8F=E7=9A=84=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Functions/FrontPage.html | 6 ++--- App/Functions/FrontPageControl.cs | 44 ++++++++++++++++--------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/App/Functions/FrontPage.html b/App/Functions/FrontPage.html index 93f6b40..57cf16f 100644 --- a/App/Functions/FrontPage.html +++ b/App/Functions/FrontPage.html @@ -34,11 +34,11 @@ td {

$appName

-
+

处理 PDF 文档

Editor;Editor;修改 PDF 文件;创建或修改 PDF 文档的书签,修改 PDF 文档的设置
DocumentProcessor;Patcher;批量修改 PDF 文件;根据配置批量处理 PDF 文档,生成新的文档
-
Merger;Merger;合并 PDF 和图片文件;将多个图片和 PDF 文档合并为新的 PDF 文档
+
Merger;Merger;合并文件;将多个图片和 PDF 文档合并为新的 PDF 文档
Ocr;Ocr;识别图像文本;识别扫描 PDF 文档的文字(需微软 Office 2003或2007的光学字符识别(OCR)引擎支持)
AutoBookmark;BookmarkGenerator;自动生成书签;根据 PDF 的文本样式生成书签文件
Rename;Rename;批量重命名文件;根据 PDF 的文本属性更改文件名
@@ -62,6 +62,6 @@ td {
-
著作权所有:WMJordan;主页:$AppHomePage;电邮:wmjordan@163.com
+
著作权所有:WMJordan;主页:$appHomePage;电邮:wmjordan@163.com
\ No newline at end of file diff --git a/App/Functions/FrontPageControl.cs b/App/Functions/FrontPageControl.cs index 692d845..28ef5ba 100644 --- a/App/Functions/FrontPageControl.cs +++ b/App/Functions/FrontPageControl.cs @@ -19,19 +19,19 @@ namespace PDFPatcher bool ITabContent.CanClose => false; public override void ExecuteCommand(string commandName, params string[] parameters) { - if (commandName == Commands.Open) { - var n = AppContext.MainForm.ShowPdfFileDialog(); - if (n != null) { - AppContext.MainForm.OpenFileWithEditor(n); - } - return; - } - if (commandName == Commands.CleanUpInexistentFiles) { - AppContext.CleanUpInexistentFiles(AppContext.Recent.SourcePdfFiles); - AppContext.CleanUpInexistentFiles(AppContext.Recent.InfoDocuments); - AppContext.CleanUpInexistentFolders(AppContext.Recent.Folders); - RefreshContent(); - return; + switch (commandName) { + case Commands.Open: + var n = AppContext.MainForm.ShowPdfFileDialog(); + if (n != null) { + AppContext.MainForm.OpenFileWithEditor(n); + } + return; + case Commands.CleanUpInexistentFiles: + AppContext.CleanUpInexistentFiles(AppContext.Recent.SourcePdfFiles); + AppContext.CleanUpInexistentFiles(AppContext.Recent.InfoDocuments); + AppContext.CleanUpInexistentFolders(AppContext.Recent.Folders); + RefreshContent(); + return; } base.ExecuteCommand(commandName, parameters); } @@ -40,7 +40,7 @@ namespace PDFPatcher InitializeComponent(); Text = "主页"; RefreshContent(); - RecentFileItemClicked = (s, args) => { AppContext.MainForm.OpenFileWithEditor(args.ClickedItem.ToolTipText); }; + RecentFileItemClicked = (s, args) => AppContext.MainForm.OpenFileWithEditor(args.ClickedItem.ToolTipText); AllowDrop = true; } @@ -68,27 +68,29 @@ namespace PDFPatcher base.SetupCommand(item); } - private void RefreshContent() { + void RefreshContent() { + var s = FormHelper.GetDpiScale(this); _FrontPageBox.Text = __FrontPagePattern - .Replace(Properties.Resources.FrontPage, @"
$3
") + .Replace(Properties.Resources.FrontPage, $@"
$3
") + .Replace("$sideBarWidth", (s * 180).ToText() + "px") .Replace("$appName", Constants.AppName) - .Replace("$AppHomePage", Constants.AppHomePage) + .Replace("$appHomePage", Constants.AppHomePage) .Replace("
  • ", GetLastFileList()); } - private string GetLastFileList() { + string GetLastFileList() { var i = 0; - return String.Concat(AppContext.Recent.SourcePdfFiles.ConvertAll((s) => FileHelper.IsPathValid(s) && System.IO.File.Exists(s) + return String.Concat(AppContext.Recent.SourcePdfFiles.ConvertAll((s) => FileHelper.IsPathValid(s) && new FilePath(s).ExistsFile ? String.Concat(@"
  • ", SubstringAfter(s, '\\'), "
  • ") : String.Concat(@"
  • ", SubstringAfter(s, '\\'), "
  • "))); } - private void _FrontPageBox_LinkClicked(object sender, HtmlLinkClickedEventArgs e) { + void _FrontPageBox_LinkClicked(object sender, HtmlLinkClickedEventArgs e) { HandleLinkClicked(e.Link); e.Handled = true; } - private void _FrontPageBox_ImageLoad(object sender, HtmlImageLoadEventArgs e) { + void _FrontPageBox_ImageLoad(object sender, HtmlImageLoadEventArgs e) { LoadResourceImage(e); }