fixed: 修正扩展初始化时面板没有初始化的问题
This commit is contained in:
parent
7e7718b9e0
commit
3ab356ff26
Binary file not shown.
@ -20,12 +20,12 @@ Global
|
|||||||
Test|Any CPU = Test|Any CPU
|
Test|Any CPU = Test|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Debug|Any CPU.ActiveCfg = Release_Anno|Any CPU
|
||||||
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Debug|Any CPU.Build.0 = Release_Anno|Any CPU
|
||||||
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Release|Any CPU.Build.0 = Release|Any CPU
|
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Test|Any CPU.ActiveCfg = Test|Any CPU
|
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Test|Any CPU.ActiveCfg = Release_Anno|Any CPU
|
||||||
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Test|Any CPU.Build.0 = Test|Any CPU
|
{6CE536CB-6154-4FDF-9FFE-23A73B4E84AB}.Test|Any CPU.Build.0 = Release_Anno|Any CPU
|
||||||
{455E23BE-F34F-4F6F-A9EA-381D66170B1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{455E23BE-F34F-4F6F-A9EA-381D66170B1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{455E23BE-F34F-4F6F-A9EA-381D66170B1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{455E23BE-F34F-4F6F-A9EA-381D66170B1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{455E23BE-F34F-4F6F-A9EA-381D66170B1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{455E23BE-F34F-4F6F-A9EA-381D66170B1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
@ -577,7 +577,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ManifestCertificateThumbprint>62DF6B414BD2608A130540A801F32D12E0199A99</ManifestCertificateThumbprint>
|
<ManifestCertificateThumbprint>62DF6B414BD2608A130540A801F32D12E0199A99</ManifestCertificateThumbprint>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Test|AnyCPU'">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Anno|AnyCPU' ">
|
||||||
<OutputPath>bin\Test\</OutputPath>
|
<OutputPath>bin\Test\</OutputPath>
|
||||||
<DefineConstants>VSTO40;TRACE</DefineConstants>
|
<DefineConstants>VSTO40;TRACE</DefineConstants>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
@ -585,7 +585,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Test|Win32'">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Anno|Win32' ">
|
||||||
<OutputPath>bin\Win32\Test\</OutputPath>
|
<OutputPath>bin\Win32\Test\</OutputPath>
|
||||||
<DefineConstants>VSTO40</DefineConstants>
|
<DefineConstants>VSTO40</DefineConstants>
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
@ -32,10 +32,7 @@ namespace AIProofread
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
StreamWriter streamWriter = File.AppendText(path);
|
StreamWriter streamWriter = File.AppendText(path);
|
||||||
streamWriter.WriteLine("***************************[" + tag + "]***************************");
|
streamWriter.WriteLine($"{time} [{tag}]:" + message);
|
||||||
streamWriter.WriteLine("消息:" + message);
|
|
||||||
streamWriter.WriteLine("时间:" + time);
|
|
||||||
streamWriter.WriteLine();
|
|
||||||
streamWriter.Flush();
|
streamWriter.Flush();
|
||||||
streamWriter.Close();
|
streamWriter.Close();
|
||||||
streamWriter.Dispose();
|
streamWriter.Dispose();
|
||||||
|
@ -102,6 +102,7 @@ namespace AIProofread.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void ShowPane()
|
public void ShowPane()
|
||||||
{
|
{
|
||||||
|
CheckPanel();
|
||||||
if (null != TaskPane)
|
if (null != TaskPane)
|
||||||
{
|
{
|
||||||
TaskPane.Visible = PaneVisible = true;
|
TaskPane.Visible = PaneVisible = true;
|
||||||
@ -110,6 +111,7 @@ namespace AIProofread.Model
|
|||||||
|
|
||||||
public void RunInMainThread(Action action)
|
public void RunInMainThread(Action action)
|
||||||
{
|
{
|
||||||
|
CheckPanel();
|
||||||
if (null != TaskPane)
|
if (null != TaskPane)
|
||||||
{
|
{
|
||||||
TaskPane.Control.BeginInvoke(action);
|
TaskPane.Control.BeginInvoke(action);
|
||||||
@ -914,6 +916,7 @@ namespace AIProofread.Model
|
|||||||
|
|
||||||
public void ExportResult(string modelType)
|
public void ExportResult(string modelType)
|
||||||
{
|
{
|
||||||
|
CheckPanel();
|
||||||
TaskPane.Control.BeginInvoke(new Action(() =>
|
TaskPane.Control.BeginInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
DocumentUtil.ExportProofreadResult(modelType);
|
DocumentUtil.ExportProofreadResult(modelType);
|
||||||
@ -922,6 +925,7 @@ namespace AIProofread.Model
|
|||||||
|
|
||||||
public void ShowUpgrade(string data, bool force)
|
public void ShowUpgrade(string data, bool force)
|
||||||
{
|
{
|
||||||
|
CheckPanel();
|
||||||
TaskPane.Control.BeginInvoke(new Action(() =>
|
TaskPane.Control.BeginInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
var upgradeData = JsonConvert.DeserializeObject<UpgradeData>(data);
|
var upgradeData = JsonConvert.DeserializeObject<UpgradeData>(data);
|
||||||
@ -974,7 +978,7 @@ namespace AIProofread.Model
|
|||||||
|
|
||||||
public void ShowSetting()
|
public void ShowSetting()
|
||||||
{
|
{
|
||||||
|
CheckPanel();
|
||||||
TaskPane.Control.BeginInvoke(new Action(() =>
|
TaskPane.Control.BeginInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
FormSetting frm = new FormSetting();
|
FormSetting frm = new FormSetting();
|
||||||
@ -983,6 +987,7 @@ namespace AIProofread.Model
|
|||||||
}
|
}
|
||||||
public void ShowWebView(string url, int width, int height, bool dialog)
|
public void ShowWebView(string url, int width, int height, bool dialog)
|
||||||
{
|
{
|
||||||
|
CheckPanel();
|
||||||
TaskPane.Control.BeginInvoke(new Action(() =>
|
TaskPane.Control.BeginInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
FormWebView view = new FormWebView(url, width, height);
|
FormWebView view = new FormWebView(url, width, height);
|
||||||
@ -1019,7 +1024,7 @@ namespace AIProofread.Model
|
|||||||
return dic;
|
return dic;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void CheckPanel()
|
public void CheckPanel()
|
||||||
{
|
{
|
||||||
Logger.Log(CurrentDocument.FullName + $" TaskPane visible {PaneVisible} has " + (TaskPane == null ? "null" : "exists"));
|
Logger.Log(CurrentDocument.FullName + $" TaskPane visible {PaneVisible} has " + (TaskPane == null ? "null" : "exists"));
|
||||||
if (TaskPane == null) CreateTaskPane();
|
if (TaskPane == null) CreateTaskPane();
|
||||||
|
@ -103,6 +103,19 @@ namespace AIProofread.Model
|
|||||||
return documentList.IndexOf(item);
|
return documentList.IndexOf(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DocumentInfo InitDocument(Document originDocument)
|
||||||
|
{
|
||||||
|
var document = Get(originDocument);
|
||||||
|
|
||||||
|
// 如果不存在,则添加
|
||||||
|
if (document == null)
|
||||||
|
{
|
||||||
|
document = new DocumentInfo(originDocument);
|
||||||
|
Add(document);
|
||||||
|
}
|
||||||
|
return document;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置当前激活的文档
|
/// 设置当前激活的文档
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -110,14 +123,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)
|
||||||
{
|
{
|
||||||
|
@ -285,6 +285,7 @@ namespace AIProofread
|
|||||||
|
|
||||||
private void AppInitialize()
|
private void AppInitialize()
|
||||||
{
|
{
|
||||||
|
Logger.Log("AppInitialize start... ");
|
||||||
CurrentWordApplication = Application;
|
CurrentWordApplication = Application;
|
||||||
// 初始化配置
|
// 初始化配置
|
||||||
InitAppByConfig();
|
InitAppByConfig();
|
||||||
@ -308,6 +309,25 @@ namespace AIProofread
|
|||||||
Logger.Log("Init WPS Error " + ex.Message);
|
Logger.Log("Init WPS Error " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 如果启用直接有文档打开
|
||||||
|
// 初始化面板
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var docList = CurrentWordApplication.Documents;
|
||||||
|
if(docList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (Document item in docList)
|
||||||
|
{
|
||||||
|
Logger.Log("Init Documentinfo ==> " + item.Name);
|
||||||
|
var info = documentList.InitDocument(item);
|
||||||
|
info.CheckPanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Log("Init Documentinfo Error " + ex.Message);
|
||||||
|
}
|
||||||
string verTextFile = Config.APP_BASE_DIR + Path.GetFileName("app_version.txt");
|
string verTextFile = Config.APP_BASE_DIR + Path.GetFileName("app_version.txt");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -317,6 +337,7 @@ namespace AIProofread
|
|||||||
{
|
{
|
||||||
Logger.Log("Write App Version Error " + ex.Message);
|
Logger.Log("Write App Version Error " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitAppByConfig()
|
private void InitAppByConfig()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user