diff --git a/.vs/AIProofread/v17/.suo b/.vs/AIProofread/v17/.suo index 3bc684e..8f74e5c 100644 Binary files a/.vs/AIProofread/v17/.suo and b/.vs/AIProofread/v17/.suo differ diff --git a/AIProofread/AIProofread.csproj.user b/AIProofread/AIProofread.csproj.user index 5edd783..4e84e50 100644 --- a/AIProofread/AIProofread.csproj.user +++ b/AIProofread/AIProofread.csproj.user @@ -8,6 +8,10 @@ Project - C:\Soft\Kingsoft\WPS Office\12.1.0.17827\office6\wps.exe + C:\Soft\Kingsoft\WPS Office\12.1.0.18608\office6\wps.exe + + + Program + C:\Soft\Kingsoft\WPS Office\12.1.0.18608\office6\wps.exe \ No newline at end of file diff --git a/AIProofread/Bridge.cs b/AIProofread/Bridge.cs index 802e910..b65d1c5 100644 --- a/AIProofread/Bridge.cs +++ b/AIProofread/Bridge.cs @@ -275,7 +275,8 @@ namespace AIProofread // 如果是 //var shouldCheckSaved = ext.EndsWith(".wps") || doc.Paragraphs.Count < 200 || doc.Tables.Count < 20; // !shouldCheckSaved && - if (!documentInfo.Saved() || !doc.Saved) + // 必须保存才能继续校对 + if (!doc.Saved) { data.Add("code", 1); data.Add("message", "请保存文档后再进行校对"); @@ -618,7 +619,7 @@ namespace AIProofread { try { - DocumentUtil.ExportProofreadResult(); + Globals.ThisAddIn.ActiveDocument.ExportResult(); return BridgeResult.Success(); } catch (Exception ex) diff --git a/AIProofread/Config.cs b/AIProofread/Config.cs index c57e474..413de15 100644 --- a/AIProofread/Config.cs +++ b/AIProofread/Config.cs @@ -12,7 +12,7 @@ namespace AIProofread public class Config { public static readonly string APP_NAME = "AI校对王"; - public static readonly string APP_VERSION = "1.2.2"; + public static readonly string APP_VERSION = "2.0.0"; public static bool IS_WPS = false; public static readonly string CONFIG_FILE = AppDomain.CurrentDomain.BaseDirectory + "app.json"; diff --git a/AIProofread/Controls/FormLogger.Designer.cs b/AIProofread/Controls/FormLogger.Designer.cs index cf0e51f..fbdbed5 100644 --- a/AIProofread/Controls/FormLogger.Designer.cs +++ b/AIProofread/Controls/FormLogger.Designer.cs @@ -31,11 +31,11 @@ this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormLogger)); this.LogText = new System.Windows.Forms.RichTextBox(); - this.panel1 = new System.Windows.Forms.Panel(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.TsmiClear = new System.Windows.Forms.ToolStripMenuItem(); - this.panel1.SuspendLayout(); + this.panel1 = new System.Windows.Forms.Panel(); this.contextMenuStrip1.SuspendLayout(); + this.panel1.SuspendLayout(); this.SuspendLayout(); // // LogText @@ -50,45 +50,46 @@ this.LogText.Name = "LogText"; this.LogText.ReadOnly = true; this.LogText.ShowSelectionMargin = true; - this.LogText.Size = new System.Drawing.Size(784, 491); + this.LogText.Size = new System.Drawing.Size(784, 310); this.LogText.TabIndex = 0; this.LogText.Text = ""; // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.TsmiClear}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(125, 26); + // + // TsmiClear + // + this.TsmiClear.Name = "TsmiClear"; + this.TsmiClear.Size = new System.Drawing.Size(124, 22); + this.TsmiClear.Text = "清除日志"; + this.TsmiClear.Click += new System.EventHandler(this.TsmiClear_Click); + // // panel1 // this.panel1.Controls.Add(this.LogText); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(784, 491); + this.panel1.Size = new System.Drawing.Size(784, 310); this.panel1.TabIndex = 1; // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.TsmiClear}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(181, 48); - // - // TsmiClear - // - this.TsmiClear.Name = "TsmiClear"; - this.TsmiClear.Size = new System.Drawing.Size(180, 22); - this.TsmiClear.Text = "清除日志"; - this.TsmiClear.Click += new System.EventHandler(this.TsmiClear_Click); - // // FormLogger // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(784, 491); + this.ClientSize = new System.Drawing.Size(784, 310); this.Controls.Add(this.panel1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "FormLogger"; this.Text = "实时日志"; + this.TopMost = true; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormLogger_FormClosed); - this.panel1.ResumeLayout(false); this.contextMenuStrip1.ResumeLayout(false); + this.panel1.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/AIProofread/Model/DocumentInfo.cs b/AIProofread/Model/DocumentInfo.cs index ed60807..dc165cb 100644 --- a/AIProofread/Model/DocumentInfo.cs +++ b/AIProofread/Model/DocumentInfo.cs @@ -60,7 +60,7 @@ namespace AIProofread.Model /// /// 文件名称 /// - private string fileName; + public string fileName; private string uniqueId; public string UniqueId { get { return uniqueId; } } @@ -222,6 +222,7 @@ namespace AIProofread.Model public void Initialize() { + this.fileName = CurrentDocument.FullName; ranges.Clear(); ComputeUniqueId(); if (TaskPane == null) CreateTaskPane(); @@ -758,5 +759,13 @@ namespace AIProofread.Model Logger.Log(ex); } } + + public void ExportResult() + { + TaskPane.Control.BeginInvoke(new Action(() => + { + DocumentUtil.ExportProofreadResult(); + })); + } } } diff --git a/AIProofread/ThisAddIn.cs b/AIProofread/ThisAddIn.cs index b1fb4a3..e407311 100644 --- a/AIProofread/ThisAddIn.cs +++ b/AIProofread/ThisAddIn.cs @@ -73,6 +73,7 @@ namespace AIProofread try { AppInitialize(); + Logger.Log("ThisAddIn_Startup IS_WPS --> " + IsWPS); // 处理文档事件 Application.DocumentOpen += Application_DocumentOpen; @@ -183,10 +184,11 @@ namespace AIProofread { return; } - //var activeDocument = CurrentWordApplication.ActiveDocument; + var activeDocument = CurrentWordApplication.ActiveDocument; // 设置当前文档 - ActiveDocument = documentList.SetActiveDocument(CurrentWordApplication.ActiveDocument); + ActiveDocument = documentList.SetActiveDocument(activeDocument); + Logger.Log("Application_DocumentChange -- " + ActiveDocument.fileName); } public void SetActiveDocument(Document doc) @@ -212,13 +214,12 @@ namespace AIProofread private void Application_WindowActivate(Document activeDoc, Window Wn) { ActiveDocument = documentList.SetActiveDocument(activeDoc); - + Logger.Log("Application_WindowActivate -- " + ActiveDocument.fileName); //// 当前文档添加书签集合 //if (!allMarks.ContainsKey(activeDoc)) //{ // allMarks[activeDoc] = new Dictionary(); //} - //Logger.Log("Application_WindowActivate -- " + activeDoc.FullName); ////ShowPanel(Doc); //// 创建面板 //if (!taskPanels.ContainsKey(activeDoc)) diff --git a/AIProofread/core/DocumentUtil.cs b/AIProofread/core/DocumentUtil.cs index 1170fcb..b3267fb 100644 --- a/AIProofread/core/DocumentUtil.cs +++ b/AIProofread/core/DocumentUtil.cs @@ -561,7 +561,7 @@ namespace AIProofread { suggest += "(敏感词)"; } - else if (string.IsNullOrEmpty(it.Addition)) + else if (!string.IsNullOrEmpty(it.Addition)) { suggest += $"({it.Addition})"; } diff --git a/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache b/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache index d728ba0..5372cbb 100644 Binary files a/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache and b/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache differ diff --git a/AIProofread/obj/Debug/AIProofread.dll b/AIProofread/obj/Debug/AIProofread.dll index a418594..de827d7 100644 Binary files a/AIProofread/obj/Debug/AIProofread.dll and b/AIProofread/obj/Debug/AIProofread.dll differ diff --git a/AIProofread/obj/Debug/AIProofread.pdb b/AIProofread/obj/Debug/AIProofread.pdb index cd193f5..9a1c43a 100644 Binary files a/AIProofread/obj/Debug/AIProofread.pdb and b/AIProofread/obj/Debug/AIProofread.pdb differ