Exemplo n.º 1
0
        protected override void OnRuntimeEnable()
        {
            base.OnRuntimeEnable();

            FieldInfo fieldInfo = Target.GetType().GetField("_helper", BindingFlags.Instance | BindingFlags.NonPublic);

            _helper = fieldInfo != null ? (fieldInfo.GetValue(Target) as IInternalModuleHelper) : null;
        }
Exemplo n.º 2
0
 /// <summary>
 /// 初始化模块
 /// </summary>
 internal virtual void OnInitialization()
 {
     if (HelperType != "<None>")
     {
         Type type = ReflectionToolkit.GetTypeInRunTimeAssemblies(HelperType);
         if (type != null)
         {
             if (typeof(IInternalModuleHelper).IsAssignableFrom(type))
             {
                 Helper        = Activator.CreateInstance(type) as IInternalModuleHelper;
                 Helper.Module = this;
             }
             else
             {
                 throw new HTFrameworkException(HTFrameworkModule.Input, "创建内置模块助手失败:内置模块助手类 " + HelperType + " 必须实现该模块对应的助手接口!");
             }
         }
         else
         {
             throw new HTFrameworkException(HTFrameworkModule.Input, "创建内置模块助手失败:丢失内置模块助手类 " + HelperType + "!");
         }
     }
 }