From f08871fe7d148d667f2f11f80f64de71a0d9504c Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期一, 15 六月 2026 18:19:37 +0800
Subject: [PATCH] 优化标准老化界面

---
 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