Skip to content

Commit

Permalink
refactor: 修改 Unloaded 参数
Browse files Browse the repository at this point in the history
  • Loading branch information
uyoufu committed Mar 16, 2023
1 parent 80103a0 commit 50bfe98
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion MSAddinTest/Core/Loader/PluginAssemblyLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public FuncResult LoadAssembly()
// _lastFileHash = newFileHash;

// 执行卸载逻辑
_msAddins.ForEach(x => x.Unloaded());
_msAddins.ForEach(x => x.Unloaded(new AddIn.UnloadedEventArgs(AddIn.UnloadReasons.ExitByOtherApp)));
_msAddins.Clear();

// 读取文件然后加载
Expand Down
1 change: 1 addition & 0 deletions MSAddinTest/MSAddinTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<Reference Include="Bentley.DgnPlatformNET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4bf6c96a266e58d4, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(Microstation)\Bentley.DgnPlatformNET.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
6 changes: 4 additions & 2 deletions MSAddinTest/MSTestInterface/MSTest_Addin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Bentley.MstnPlatformNET.AddIn;

namespace MSAddinTest.MSTestInterface
{
Expand All @@ -24,9 +25,10 @@ public virtual void Init(AddIn addIn)
protected abstract int Run(string[] commandLine);

/// <summary>
/// 卸载后手动清除向 Addin 中添加的一些事件
/// 卸载后手动清除向 Addin 中注册的一些事件
/// </summary>
public virtual void Unloaded() { }
public virtual void Unloaded(UnloadedEventArgs eventArgs) { }


/// <summary>
/// 隐式转换成 addin
Expand Down
4 changes: 2 additions & 2 deletions MSAddinTest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyVersion("1.0.2")]
[assembly: AssemblyFileVersion("1.0.2")]
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ internal class PluginAddin : MSTest_Addin
}

// 在这个方法中释放资源
public override void Unloaded()
public override void Unloaded(UnloadedEventArgs eventArgs)
{
// 当插件重载时,可以在此处卸载上一次加载的事件
}
Expand Down

0 comments on commit 50bfe98

Please sign in to comment.