Beispiel #1
0
 public ModuleLoadNotifier(ModuleImplementation[] moduleImplementations)
 {
     object obj;
     MethodInfo mi;
     foreach(ModuleImplementation moduleImplementation in moduleImplementations) {
         //Specific reflection, really fragile, dammit.
         obj = moduleImplementation.GetType().GetProperty("ModuleTypeLoader").GetValue(moduleImplementation, null);
         mi = obj.GetType().GetMethod("ModuleLoaded");
         _methods.Add(moduleImplementation.TypeOfModule + "ModuleLoaded", new ModuleImplementationMethod<LateBoundProcedure>(mi, obj));
         mi = obj.GetType().GetMethod("ModuleUnloading");
         _methods.Add(moduleImplementation.TypeOfModule + "ModuleUnloading", new ModuleImplementationMethod<LateBoundProcedure>(mi, obj));
     }
 }
Beispiel #2
0
 public ModuleRepository(ModuleImplementation[] moduleImplemenations)
 {
     object obj;
     MethodInfo mi;
     foreach (ModuleImplementation moduleImplemenation in moduleImplemenations) {
         obj = moduleImplemenation.GetType().GetProperty("Repository").GetValue(moduleImplemenation, null);
         mi = obj.GetType().GetMethod("Add", new Type[] {typeof (Guid)});
         _methods.Add("Add" + moduleImplemenation.TypeOfModule, new ModuleImplementationMethod<LateBoundProcedure>(mi, obj));
         mi = obj.GetType().GetMethod("Get", new Type[] {typeof (Guid)});
         _methods.Add("Get" + moduleImplemenation.TypeOfModule, new ModuleImplementationMethod<LateBoundMethod>(mi, obj));
         mi = obj.GetType().GetMethod("GetAll");
         _methods.Add("GetAll" + moduleImplemenation.TypeOfModule, new ModuleImplementationMethod<LateBoundMethod>(mi, obj));
         mi = obj.GetType().GetMethod("Remove", new Type[] {typeof (Guid)});
         _methods.Add("Remove" + moduleImplemenation.TypeOfModule,
                      new ModuleImplementationMethod<LateBoundProcedure>(mi, obj));
     }
 }