Beispiel #1
0
 protected EventTable GetEventTable()
 {
     if (_eventTable == null)
     {
         _eventTable = new EventTable();
     }
     return(_eventTable);
 }
Beispiel #2
0
        //-----------------------------------------
        private EventTable GetPreEventTable(string target)
        {
            EventTable table = null;

            if (!_listenEvents.ContainsKey(target))
            {
                table = new EventTable();
                _listenEvents.Add(target, table);
            }
            else
            {
                table = _listenEvents[target];
            }
            return(table);
        }
Beispiel #3
0
        public LogicModule CreateModule(string name)
        {
            LogicModule module = null;
            //Type type = Type.GetType(string.Format("{0}.{1}", _domain, name));
            Type type = Type.GetType(name);

            if (type != null)
            {
                var m = Activator.CreateInstance(type);
                module = m as LogicModule;
            }

            _modules.Add(name, module);

            if (_listenEvents.ContainsKey(name))
            {
                EventTable mgrEvent = null;
                mgrEvent = _listenEvents[name];
                _listenEvents.Remove(name);

                module.SetEventTable(mgrEvent);
            }

            module.Create();

            if (_cacheMessages.ContainsKey(name))
            {
                List <MessageObject> list = _cacheMessages[name];
                for (int i = 0; i < list.Count; i++)
                {
                    MessageObject msgobj = list[i];
                    module.HandleMessage(msgobj.msg, msgobj.args);
                }
                _cacheMessages.Remove(name);
            }

            return(module);
        }
Beispiel #4
0
 internal void SetEventTable(EventTable msgevent)
 {
     _eventTable = msgevent;
 }