public void NotifyDelegates(CNotification notification)
        {
            try
            {
                Lock();

                int delegatesCount = list.Count;
                for (int i = 0; i < delegatesCount; ++i)
                {
                    CNotificationDelegate del = list[i];
                    try
                    {
                        del(notification);
                    }
                    catch (Exception e)
                    {
                        CLog.error(e, "Error while notifying delegate");
                    }
                }
            }
            finally
            {
                Unlock();
            }
        }
        private void PostCallback(CTimer timer)
        {
            CNotification notification = timer.userData as CNotification;

            CAssert.IsNotNull(notification);

            PostImmediately(notification);
        }
        public void PostImmediately(CNotification notification)
        {
            string name = notification.Name;
            CNotificationDelegateList list = FindList(name);

            if (list != null)
            {
                list.NotifyDelegates(notification);
            }
            notification.Recycle();
        }
        public void Post(Object sender, string name, params object[] data)
        {
            CNotificationDelegateList list = FindList(name);

            if (list != null && list.Count > 0)
            {
                CNotification notification = m_notificatoinsPool.NextObject();
                notification.Init(sender, name, data);

                SchedulePost(notification);
            }
        }
        public void PostImmediately(Object sender, string name, params object[] data)
        {
            CNotificationDelegateList list = FindList(name);

            if (list != null && list.Count > 0)
            {
                CNotification notification = m_notificatoinsPool.NextObject();
                notification.Init(sender, name, data);

                list.NotifyDelegates(notification);
                notification.Recycle();
            }
        }
 private static void NullNotificationDelegate(CNotification notification)
 {
 }
        private void SchedulePost(CNotification notification)
        {
            CTimer timer = m_timerManager.Schedule(PostCallback);

            timer.userData = notification;
        }