| | |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Reflection; |
| | | using System.Web.UI.WebControls; |
| | | |
| | | namespace HMI.Core.Api |
| | | { |
| | |
| | | private MethodInfo OnTabChangeMethod; |
| | | private MethodInfo SetBaseFolderMethod; |
| | | private MethodInfo SetLoggerMethod; |
| | | private MethodInfo CanDeActiveMethod; |
| | | private MethodInfo CanActiveMethod; |
| | | |
| | | public PluginPackage(object content) |
| | | { |
| | |
| | | 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() |
| | |
| | | { |
| | | SetLoggerMethod?.Invoke(Content, new object[] { logger }); |
| | | } |
| | | |
| | | public bool CanActive() |
| | | { |
| | | return (bool)CanActiveMethod?.Invoke(Content, null); |
| | | } |
| | | |
| | | public bool CanDeActive() |
| | | { |
| | | return (bool)CanDeActiveMethod?.Invoke(Content, null); |
| | | } |
| | | } |
| | | } |