Пример #1
0
        private void FireEvent(SchedulerItem I)
        {
            try
            {
                // save chagnes before it fires in case its chagned during the fire
                I = m_database.SaveHistory(I);

                if (I.RunOnce) I.Enabled = false;
                if (I.Enabled) I.CalculateNextRunTime(I.TimeToRun);

                if (!I.HisotryKeep)
                    m_database.HistoryDeleteOld(I);
                m_database.SchedulerSave(I);

                // now fire
                List<Object> reciept = EventManager.FireGenericEventHandler(I.FireFunction, I.FireParams);
                if (!I.HistoryReciept)
                    I = m_database.SaveHistoryComplete(I);
                else
                {
                    foreach (string results in reciept.Cast<string>().Where(results => results != ""))
                    {
                        m_database.SaveHistoryCompleteReciept(I.HistoryLastID, results);
                    }
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.ErrorFormat("[Scheduler] FireEvent Error {0}: {1}", I.id, e.ToString());
            }
        }