From 907f4bc971219a1e6fab06e1370c75348d977baa Mon Sep 17 00:00:00 2001 From: callmeyan Date: Mon, 6 Jan 2025 21:52:49 +0800 Subject: [PATCH] =?UTF-8?q?fixed:=20=E7=BB=86=E5=8C=96=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + AIProofread/Ribbon1.cs | 6 +++--- AIProofread/core/CommonSenseDetection.cs | 10 ++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index cec4222..06ba399 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ bin packages TestConsoleApp .vs +obj **/obj/Debug/** **/obj/Release/** **/obj/Test/** \ No newline at end of file diff --git a/AIProofread/Ribbon1.cs b/AIProofread/Ribbon1.cs index 481646c..26ae0ac 100644 --- a/AIProofread/Ribbon1.cs +++ b/AIProofread/Ribbon1.cs @@ -601,10 +601,10 @@ namespace AIProofread btnDetectionAll.Enabled = r.Start == r.End; } - public void SetDetectionBtnStatus(bool status) + public void SetDetectionBtnStatus(bool allStatus,bool rangeStatus) { - btnDetectionAll.Enabled = status; - btnDetectionParagraph.Enabled = status; + btnDetectionAll.Enabled = allStatus; + btnDetectionParagraph.Enabled = rangeStatus; } } } diff --git a/AIProofread/core/CommonSenseDetection.cs b/AIProofread/core/CommonSenseDetection.cs index a4aa866..c76b9f4 100644 --- a/AIProofread/core/CommonSenseDetection.cs +++ b/AIProofread/core/CommonSenseDetection.cs @@ -64,7 +64,7 @@ namespace AIProofread.core this.checkingKey = checkingKey; this.checkingSummary = checkingSummary; this.checkingLocation = checkingLocation; - Globals.ThisAddIn.ribbon.SetDetectionBtnStatus(false); + Globals.ThisAddIn.ribbon.SetDetectionBtnStatus(false,false); } else { @@ -72,7 +72,8 @@ namespace AIProofread.core this.checkingKey = null; this.checkingSummary = null; this.checkingLocation = null; - Globals.ThisAddIn.ribbon.SetDetectionBtnStatus(true); + var enableAll = string.IsNullOrEmpty(checkingSummary); + Globals.ThisAddIn.ribbon.SetDetectionBtnStatus(enableAll,!enableAll); } } @@ -98,6 +99,11 @@ namespace AIProofread.core public void Close() { + if (isChecking) + { + Globals.ThisAddIn.formCommonsenseDetection.Hide(); + return; + } Globals.ThisAddIn.HideDetection(); } }