fix: 修正扩展初始化时面板没有初始化的问题
This commit is contained in:
parent
fa62b66a02
commit
d061406026
Binary file not shown.
@ -110,14 +110,8 @@ namespace AIProofread.Model
|
|||||||
public DocumentInfo SetActiveDocument(Document originDocument)
|
public DocumentInfo SetActiveDocument(Document originDocument)
|
||||||
{
|
{
|
||||||
if (originDocument == null) return null;
|
if (originDocument == null) return null;
|
||||||
var document = Get(originDocument);
|
var document = InitDocument(originDocument);
|
||||||
|
|
||||||
// 如果不存在,则添加
|
|
||||||
if (document == null)
|
|
||||||
{
|
|
||||||
document = new DocumentInfo(originDocument);
|
|
||||||
Add(document);
|
|
||||||
}
|
|
||||||
if (ActiveDocument == document) return document;
|
if (ActiveDocument == document) return document;
|
||||||
else if (Globals.ThisAddIn.IsWPS)
|
else if (Globals.ThisAddIn.IsWPS)
|
||||||
{
|
{
|
||||||
@ -135,5 +129,18 @@ namespace AIProofread.Model
|
|||||||
{
|
{
|
||||||
documentList.ForEach(d => d.HidePane());
|
documentList.ForEach(d => d.HidePane());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DocumentInfo InitDocument(Document originDocument)
|
||||||
|
{
|
||||||
|
var document = Get(originDocument);
|
||||||
|
|
||||||
|
// 如果不存在,则添加
|
||||||
|
if (document == null)
|
||||||
|
{
|
||||||
|
document = new DocumentInfo(originDocument);
|
||||||
|
Add(document);
|
||||||
|
}
|
||||||
|
return document;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,6 +289,22 @@ namespace AIProofread
|
|||||||
Logger.Error("Init WPS Error ", ex);
|
Logger.Error("Init WPS Error ", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 默认已经打开了文档 直接初始化
|
||||||
|
if(CurrentWordApplication.Documents.Count > 0){
|
||||||
|
foreach (Document item in CurrentWordApplication.Documents)
|
||||||
|
{
|
||||||
|
var info = documentList.InitDocument(item);
|
||||||
|
// 直接初始化面板
|
||||||
|
info.CheckPanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Error("Initialize documentlist Error ", ex);
|
||||||
|
}
|
||||||
string verTextFile = Config.APP_BASE_DIR + Path.GetFileName("app_version.txt");
|
string verTextFile = Config.APP_BASE_DIR + Path.GetFileName("app_version.txt");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -345,7 +361,8 @@ namespace AIProofread
|
|||||||
ActiveDocument = documentList.SetActiveDocument(CurrentWordApplication.ActiveDocument);
|
ActiveDocument = documentList.SetActiveDocument(CurrentWordApplication.ActiveDocument);
|
||||||
ActiveDocument.CheckBtnStatus();
|
ActiveDocument.CheckBtnStatus();
|
||||||
CheckDocumentClosed(null, null);
|
CheckDocumentClosed(null, null);
|
||||||
if (formCommonsenseDetection != null) {
|
if (formCommonsenseDetection != null)
|
||||||
|
{
|
||||||
formCommonsenseDetection.SendMessageToWeb("document-change", null);
|
formCommonsenseDetection.SendMessageToWeb("document-change", null);
|
||||||
}
|
}
|
||||||
//LogHelper.Log("Application_DocumentChange -- " + ActiveDocument.fileName + " track is " + ActiveDocument.CurrentDocument.TrackRevisions);
|
//LogHelper.Log("Application_DocumentChange -- " + ActiveDocument.fileName + " track is " + ActiveDocument.CurrentDocument.TrackRevisions);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user