保存缓存时 自动保存文档

This commit is contained in:
LittleBoy 2024-11-11 17:45:40 +08:00
parent 8ceaf028d8
commit 70c0654a41
9 changed files with 35 additions and 15 deletions

Binary file not shown.

View File

@ -650,6 +650,11 @@ namespace AIProofread
return BridgeResult.Error(1, "请先保存文档"); return BridgeResult.Error(1, "请先保存文档");
} }
} }
else
{
// 静默时 自动保存文档
Globals.ThisAddIn.ActiveDocument.Save();
}
try try
{ {
File.WriteAllText(Globals.ThisAddIn.ActiveDocument.ProofreadCachePath, cache); File.WriteAllText(Globals.ThisAddIn.ActiveDocument.ProofreadCachePath, cache);

View File

@ -100,12 +100,22 @@ namespace AIProofread.Model
public void ShowDialog(string message, string confirmText, string confirmAction) public void ShowDialog(string message, string confirmText, string confirmAction)
{ {
TaskPane.Control.BeginInvoke(new Action(() => { TaskPane.Control.BeginInvoke(new Action(() =>
{
//MessageBox.Show(message, "提示"); //MessageBox.Show(message, "提示");
FormMessage.ShowMessage(message, confirmText, confirmAction); FormMessage.ShowMessage(message, confirmText, confirmAction);
})); }));
} }
public void ShowLogin(string action)
{
TaskPane.Control.BeginInvoke(new Action(() =>
{
FormLogin frm = new FormLogin(action);
frm.ShowDialog();
}));
}
/// <summary> /// <summary>
/// 隐藏面板 /// 隐藏面板
/// </summary> /// </summary>
@ -572,7 +582,8 @@ namespace AIProofread.Model
// //item.Value.mark.Shading.BackgroundPatternColor = WdColor.wdColorLightOrange; // //item.Value.mark.Shading.BackgroundPatternColor = WdColor.wdColorLightOrange;
//} //}
} }
}catch(Exception e) }
catch (Exception e)
{ {
Logger.Log(string.Format("mark color error {0}", e.Message)); Logger.Log(string.Format("mark color error {0}", e.Message));
} }
@ -722,5 +733,10 @@ namespace AIProofread.Model
} }
return true; return true;
} }
internal void Save()
{
CurrentDocument.Save();
}
} }
} }

View File

@ -359,12 +359,11 @@ namespace AIProofread
/// <param name="action"></param> /// <param name="action"></param>
public void ShowLoginForm(string action) { public void ShowLoginForm(string action) {
// 关闭之前的窗口 // 关闭之前的窗口
if(LoginFormList.Count > 0){ //if(LoginFormList.Count > 0){
LoginFormList.ForEach(f => f.Close()); // LoginFormList.ForEach(f => f.Close());
} //}
FormLogin frm = new FormLogin(action); //LoginFormList.Add(frm);
LoginFormList.Add(frm); ActiveDocument?.ShowLogin(action);
frm.Show();
} }
/// <summary> /// <summary>