From b544d5cccd76735e034c8055918a50927b437474 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期二, 10 十一月 2026 08:29:04 +0800
Subject: [PATCH] fix: 维护模式重复进入失败与按钮灰死 + Broker 并发验证用例
---
HMI.Core/Api/PluginPackage.cs | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/HMI.Core/Api/PluginPackage.cs b/HMI.Core/Api/PluginPackage.cs
index f1e48ef..da7969e 100644
--- a/HMI.Core/Api/PluginPackage.cs
+++ b/HMI.Core/Api/PluginPackage.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
-using System.Web.UI.WebControls;
namespace HMI.Core.Api
{
@@ -12,7 +11,7 @@
public static Dictionary<object, IPlugin> Cache = new Dictionary<object, IPlugin>();
public static IPlugin Get(object obj)
{
- if(obj is null) return null;
+ if (obj is null) return null;
if (obj is IPlugin plugin)
{
return plugin;
@@ -34,6 +33,8 @@
private MethodInfo OnTabChangeMethod;
private MethodInfo SetBaseFolderMethod;
private MethodInfo SetLoggerMethod;
+ private MethodInfo CanDeActiveMethod;
+ private MethodInfo CanActiveMethod;
public PluginPackage(object content)
{
@@ -47,6 +48,8 @@
OnTabChangeMethod = content.GetType().GetMethod("OnTabChange", new Type[] { typeof(object), typeof(object) });
SetBaseFolderMethod = content.GetType().GetMethod("SetBaseFolder", new Type[] { typeof(string) });
SetLoggerMethod = content.GetType().GetMethod("SetLogger", new Type[] { typeof(ILog) });
+ CanDeActiveMethod = content.GetType().GetMethod("CanDeActive");
+ CanActiveMethod = content.GetType().GetMethod("CanActive");
}
public void Active()
@@ -93,5 +96,15 @@
{
SetLoggerMethod?.Invoke(Content, new object[] { logger });
}
+
+ public bool CanActive()
+ {
+ return (bool)CanActiveMethod?.Invoke(Content, null);
+ }
+
+ public bool CanDeActive()
+ {
+ return (bool)CanDeActiveMethod?.Invoke(Content, null);
+ }
}
}
--
Gitblit v1.9.1