保存缓存时 自动保存文档
This commit is contained in:
parent
8ceaf028d8
commit
70c0654a41
Binary file not shown.
@ -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);
|
||||||
|
@ -98,14 +98,24 @@ 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>
|
||||||
@ -550,7 +560,7 @@ namespace AIProofread.Model
|
|||||||
if (item.Tag != "i") index++;
|
if (item.Tag != "i") index++;
|
||||||
if (mark != null)
|
if (mark != null)
|
||||||
{
|
{
|
||||||
marks.Add(item.Id, new ProofreadItem(item,correct.Insert, mark, Id));
|
marks.Add(item.Id, new ProofreadItem(item, correct.Insert, mark, Id));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (item.Tag == "i")
|
if (item.Tag == "i")
|
||||||
@ -572,9 +582,10 @@ 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -703,7 +714,7 @@ namespace AIProofread.Model
|
|||||||
{
|
{
|
||||||
hasProcessMark = true;
|
hasProcessMark = true;
|
||||||
marks[proofreadId].Process(status);
|
marks[proofreadId].Process(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool Saved()
|
internal bool Saved()
|
||||||
@ -712,15 +723,20 @@ namespace AIProofread.Model
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(!hasProofreaded && !CurrentDocument.Saved) // 没有校对前需要提示保存
|
if (!hasProofreaded && !CurrentDocument.Saved) // 没有校对前需要提示保存
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(hasProofreaded && hasProcessMark && !CurrentDocument.Saved)
|
if (hasProofreaded && hasProcessMark && !CurrentDocument.Saved)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void Save()
|
||||||
|
{
|
||||||
|
CurrentDocument.Save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,14 +357,13 @@ namespace AIProofread
|
|||||||
/// 显示登录窗口
|
/// 显示登录窗口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <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>
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user