Exemplo n.º 1
0
        private void SetActivatedTask(IEvent ce)
        {
            if (!ce.Enabled)
            {
                return;
            }

            // TODO: check that the beginning time of task is updated, otherwise the task won't be triggered
            ce.UpdateBeginningTime();

            if (IsEventInRange(ce))
            {
                if (ce.ActionEndsEventArgs != null)
                {
                    ce.ActionStartsEvent += EventHandlerFactory.CreateStartingEventHandler(ce);
                    if (ce.ActionEndsEventArgs != null)
                    {
                        ce.ActionEndsEvent += EventHandlerFactory.CreateEndingEventHandler(ce);
                    }
                }

                ActivatedEvents.Add(ce);

                if (ce.AutoDelete)
                {
                    ce.SelfDestructEvent += DeleteEvent;
                }

                ce.SetTimer();
            }
        }