Example #1
0
        public LogicMethod CreateEntityEventMethod(LogicMethodType methodType, string methodName)
        {
            if (this.EntityClassInfo == null)
            {
                Log.Error("LogicEntityClass: CreateEntityEventMethod: class not defined \"{0}\"", this.abe);
                return(null);
            }
            LogicMethod logicMethod = base.GetMethodByName(methodName);

            if (logicMethod != null)
            {
                Log.Fatal("LogicClass: already create method \"{0}\"", methodName);
                return(null);
            }
            logicMethod                     = (LogicMethod)Entities.Instance.Create(methodType, this);
            logicMethod.MethodName          = methodName;
            logicMethod.isEntityEventMethod = true;
            logicMethod.PostCreate();
            base.Add(logicMethod);
            MethodInfo method = logicMethod.EntityEventInfo.EventHandlerType.GetMethod("Invoke");

            ParameterInfo[] parameters = method.GetParameters();
            for (int i = 1; i < parameters.Length; i++)
            {
                ParameterInfo parameterInfo = parameters[i];
                logicMethod.CreateParameter(parameterInfo.ParameterType, parameterInfo.Name);
            }
            return(logicMethod);
        }
Example #2
0
 private void initMethods()
 {
     if (this.methods == null)
     {
         this.methods = new Dictionary <string, LogicMethod>();
         foreach (Entity current in base.Children)
         {
             LogicMethod logicMethod = current as LogicMethod;
             if (logicMethod != null)
             {
                 this.methods.Add(logicMethod.MethodName, logicMethod);
             }
         }
     }
 }
Example #3
0
        public LogicMethod CreateMethod(LogicMethodType methodType, string methodName)
        {
            this.initMethods();
            LogicMethod logicMethod = this.GetMethodByName(methodName);

            if (logicMethod != null)
            {
                Log.Fatal("LogicClass: already create method \"{0}\"", methodName);
                return(null);
            }
            logicMethod            = (LogicMethod)Entities.Instance.Create(methodType, this);
            logicMethod.MethodName = methodName;
            logicMethod.PostCreate();
            this.methods.Add(methodName, logicMethod);
            return(logicMethod);
        }
Example #4
0
 protected internal override void OnRemoveChild(Entity entity)
 {
     if (this.methods != null)
     {
         LogicMethod logicMethod = entity as LogicMethod;
         if (logicMethod != null)
         {
             this.methods.Remove(logicMethod.MethodName);
         }
     }
     if (this.variables != null)
     {
         LogicVariable logicVariable = entity as LogicVariable;
         if (logicVariable != null)
         {
             this.variables.Remove(logicVariable.VariableName);
         }
     }
     base.OnRemoveChild(entity);
 }
Example #5
0
 internal void Add(LogicMethod logicMethod)
 {
     this.initMethods();
     this.methods.Add(logicMethod.MethodName, logicMethod);
 }