fixed缓存初始化无法找到mark
This commit is contained in:
parent
76147498f4
commit
3c0d0f4608
Binary file not shown.
@ -16,6 +16,10 @@ namespace AIProofread
|
|||||||
public static bool IS_WPS = false;
|
public static bool IS_WPS = false;
|
||||||
|
|
||||||
public static readonly string CONFIG_FILE = AppDomain.CurrentDomain.BaseDirectory + "app.json";
|
public static readonly string CONFIG_FILE = AppDomain.CurrentDomain.BaseDirectory + "app.json";
|
||||||
|
/// <summary>
|
||||||
|
/// 文本背景色
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string TextBackgroundColor = "#D6AA69";
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 网页访问地址
|
/// 网页访问地址
|
||||||
|
@ -571,7 +571,7 @@ namespace AIProofread.Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
// 颜色转码
|
// 颜色转码
|
||||||
var color = (WdColor)ColorTranslator.ToOle(Colors.FromHex(item.Color));
|
var color = (WdColor)ColorTranslator.ToOle(Colors.FromHex(Config.TextBackgroundColor));
|
||||||
// 给选区添加背景颜色
|
// 给选区添加背景颜色
|
||||||
mark.Shading.BackgroundPatternColor = color;
|
mark.Shading.BackgroundPatternColor = color;
|
||||||
//try
|
//try
|
||||||
@ -743,5 +743,19 @@ namespace AIProofread.Model
|
|||||||
TaskPane.Visible = true;
|
TaskPane.Visible = true;
|
||||||
TaskPane.Control.Focus();
|
TaskPane.Control.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void Close()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
marks.Clear();
|
||||||
|
ranges.Clear();
|
||||||
|
TaskPane.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Log(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,22 @@ namespace AIProofread.Model
|
|||||||
{
|
{
|
||||||
return documentList.Remove(documentInfo);
|
return documentList.Remove(documentInfo);
|
||||||
}
|
}
|
||||||
|
public bool Remove(Document originDocument)
|
||||||
|
{
|
||||||
|
if(Count > 0 && originDocument != null)
|
||||||
|
{
|
||||||
|
documentList.RemoveAll(x =>
|
||||||
|
{
|
||||||
|
if(x.CurrentDocument == originDocument)
|
||||||
|
{
|
||||||
|
x.Close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取文档的索引
|
/// 获取文档的索引
|
||||||
|
@ -246,6 +246,7 @@ namespace AIProofread
|
|||||||
private void Application_DocumentBeforeClose(Document currentDoc, ref bool Cancel)
|
private void Application_DocumentBeforeClose(Document currentDoc, ref bool Cancel)
|
||||||
{
|
{
|
||||||
Logger.Log("DocumentBeforeClose", currentDoc.FullName);
|
Logger.Log("DocumentBeforeClose", currentDoc.FullName);
|
||||||
|
documentList.Remove(currentDoc);
|
||||||
//if (allMarks.ContainsKey(currentDoc))
|
//if (allMarks.ContainsKey(currentDoc))
|
||||||
//{
|
//{
|
||||||
// allMarks.Remove(currentDoc);
|
// allMarks.Remove(currentDoc);
|
||||||
|
@ -306,12 +306,13 @@ namespace AIProofread
|
|||||||
if (!document.Bookmarks.Exists(markName)) return null;
|
if (!document.Bookmarks.Exists(markName)) return null;
|
||||||
|
|
||||||
ControlCollection controls = Globals.Factory.GetVstoObject(document).Controls;
|
ControlCollection controls = Globals.Factory.GetVstoObject(document).Controls;
|
||||||
// 删除原有书签
|
|
||||||
controls.Remove(markName);
|
|
||||||
//return controls[markName] as Bookmark;
|
//return controls[markName] as Bookmark;
|
||||||
|
//var obj = controls[markName];
|
||||||
var bookmark = marks[markName];
|
var bookmark = marks[markName];
|
||||||
var start = bookmark.Range.Start;
|
var start = bookmark.Range.Start;
|
||||||
var end = bookmark.Range.End;
|
var end = bookmark.Range.End;
|
||||||
|
// 删除原有书签
|
||||||
|
controls.Remove(markName);
|
||||||
return controls.AddBookmark(document.Range(start, end), markName);
|
return controls.AddBookmark(document.Range(start, end), markName);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -550,7 +551,30 @@ namespace AIProofread
|
|||||||
row.CreateCell(3).SetCellValue(originText);
|
row.CreateCell(3).SetCellValue(originText);
|
||||||
|
|
||||||
row.CreateCell(4).SetCellValue(it.Origin);
|
row.CreateCell(4).SetCellValue(it.Origin);
|
||||||
row.CreateCell(5).SetCellValue(it.Text);
|
if(it.Tag == "r") {
|
||||||
|
var suggest = it.Text;
|
||||||
|
if(it.Type == "sensitive")
|
||||||
|
{
|
||||||
|
suggest += "(敏感词)";
|
||||||
|
}
|
||||||
|
else if (it.Type == "blacklist")
|
||||||
|
{
|
||||||
|
suggest += "(敏感词)";
|
||||||
|
}
|
||||||
|
else if (string.IsNullOrEmpty(it.Addition))
|
||||||
|
{
|
||||||
|
suggest += $"({it.Addition})";
|
||||||
|
}
|
||||||
|
row.CreateCell(5).SetCellValue(suggest);
|
||||||
|
}
|
||||||
|
else if(it.Tag == "i")
|
||||||
|
{
|
||||||
|
row.CreateCell(5).SetCellValue("新增");
|
||||||
|
}
|
||||||
|
else if (it.Tag == "e")
|
||||||
|
{
|
||||||
|
row.CreateCell(5).SetCellValue("删除");
|
||||||
|
}
|
||||||
row.CreateCell(6).SetCellValue(StatusText(it.IsAccept));
|
row.CreateCell(6).SetCellValue(StatusText(it.IsAccept));
|
||||||
id++;
|
id++;
|
||||||
}
|
}
|
||||||
@ -583,7 +607,7 @@ namespace AIProofread
|
|||||||
private static string StatusText(int status)
|
private static string StatusText(int status)
|
||||||
{
|
{
|
||||||
if (status == AcceptStatus.Accept) return "采纳";
|
if (status == AcceptStatus.Accept) return "采纳";
|
||||||
else if (status == AcceptStatus.Review) return "采纳";
|
else if (status == AcceptStatus.Review) return "复核";
|
||||||
else if (status == AcceptStatus.Ignore) return "忽略";
|
else if (status == AcceptStatus.Ignore) return "忽略";
|
||||||
|
|
||||||
return "未处理";
|
return "未处理";
|
||||||
|
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