DIspose添加
This commit is contained in:
@@ -24,7 +24,7 @@ using NLog;
|
||||
|
||||
namespace TestingModule.ViewModels
|
||||
{
|
||||
public class CommandTreeViewModel:NavigateViewModelBase
|
||||
public class CommandTreeViewModel:NavigateViewModelBase,IDisposable
|
||||
{
|
||||
#region 属性
|
||||
private string _SearchText;
|
||||
@@ -108,7 +108,25 @@ namespace TestingModule.ViewModels
|
||||
ReloadCommand = new DelegateCommand(Reload);
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
try
|
||||
{
|
||||
_ScopedContext = null!;
|
||||
InstructionTree?.Clear();
|
||||
SubPrograms?.Clear();
|
||||
TreeNodeMap?.Clear();
|
||||
XmlDocumentCache?.Clear();
|
||||
InstructionTree = null!;
|
||||
SubPrograms = null!;
|
||||
TreeNodeMap = null!;
|
||||
XmlDocumentCache = null!;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.Error($"清理指令树缓存失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
#region 委托命令
|
||||
private void Reload()
|
||||
{
|
||||
@@ -584,6 +602,8 @@ namespace TestingModule.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user