Exemplo n.º 1
0
 public TEvent FindEvent(TEnvirnoment Envir, TEvent __Event)
 {
     return(m_EventList.Find(c =>
     {
         return (c.m_Envir == Envir) && (c == __Event);
     }));
 }
Exemplo n.º 2
0
        public void Run()
        {
            TEvent __Event = null;
            byte   nCode   = 0;

            try
            {
                try
                {
                    nCode = 1;
                    for (int I = m_EventList.Count - 1; I >= 0; I--)
                    {
                        if (m_EventList.Count <= 0)
                        {
                            break;
                        }
                        nCode   = 2;
                        __Event = m_EventList[I];
                        nCode   = 3;
                        if (__Event != null)
                        {
                            if (__Event.m_boActive && ((HUtil32.GetTickCount() - __Event.m_dwRunStart) > __Event.m_dwRunTick))
                            {
                                __Event.m_dwRunStart = HUtil32.GetTickCount();
                                nCode = 4;
                                __Event.Run();
                                if (__Event.m_boClosed)
                                {
                                    try
                                    {
                                        nCode = 5;
                                        m_ClosedEventList.Add(__Event);
                                    }
                                    finally
                                    {
                                    }
                                    nCode = 6;
                                    m_EventList.RemoveAt(I);
                                }
                            }
                        }
                    }
                }
                finally
                {
                }
                nCode = 7;
                foreach (var item in m_ClosedEventList)
                {
                    if (item != null)
                    {
                        if ((HUtil32.GetTickCount() - item.m_dwCloseTick) > 300000)// 5 * 60 * 1000
                        {
                            m_ClosedEventList.Remove(item);
                            nCode = 8;
                            if (item != null)
                            {
                                Dispose(item);
                            }
                            nCode = 9;
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("{异常} TEventManager.Run Code:" + nCode);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 添加事件
 /// </summary>
 /// <param name="__Event"></param>
 public void AddEvent(TEvent Event)
 {
     m_EventList.Add(Event);
 }