Exemplo n.º 1
0
 private void InternalPauseAll()
 {
     for (int ndx = 0; ndx < _tasks.Count; ndx++)
     {
         TaskDetail taskDetail = _tasks[ndx] as TaskDetail;
         InternalPauseTask(taskDetail.Name, taskDetail.GroupName);
     }
 }
Exemplo n.º 2
0
        private void InternalResumeTask(string name, string group)
        {
            TaskDetail taskDetail = _tasks[GetFullyQualifiedTaskName(name, group)] as TaskDetail;

            if (taskDetail != null)
            {
                taskDetail.TimerInfo.Start();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Schedule task using ITask object.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="group"></param>
        /// <param name="trigger"></param>
        /// <param name="start"></param>
        /// <param name="task"></param>
        public void ScheduleTask(string name, string group, TaskTrigger trigger, bool start, ITask task)
        {
            TaskDetail taskDetail = new TaskDetail(name, group, task, trigger);

            lock (_syncObject)
            {
                InternalScheduleTask(taskDetail);
            }
        }
Exemplo n.º 4
0
        private void InternalDeleteTask(string name, string group)
        {
            string     taskName   = GetFullyQualifiedTaskName(name, group);
            TaskDetail taskDetail = _tasks[taskName] as TaskDetail;

            if (taskDetail != null)
            {
                taskDetail.TimerInfo.Stop();
                _tasks.Remove(taskName);
            }
        }
Exemplo n.º 5
0
        private void InternalScheduleTask(TaskDetail taskDetail)
        {
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval       = taskDetail.Trigger.Interval;
            timer.Elapsed       += taskDetail.onTimerElapsed;
            taskDetail.TimerInfo = timer;

            string fullName = GetFullyQualifiedTaskName(taskDetail.Name, taskDetail.GroupName);

            _tasks.Add(fullName, taskDetail);
            taskDetail.TimerInfo.Start();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Schedules the specified task via a delegate.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="group"></param>
        /// <param name="trigger"></param>
        /// <param name="start"></param>
        /// <param name="method"></param>
        public void ScheduleTask(string name, string group, TaskTrigger trigger, bool start, OnTaskExecute method)
        {
            TaskDetail taskDetail = new TaskDetail(name, group, null, trigger);

            taskDetail.IsTaskBased = false;
            taskDetail.TaskMethod  = method;

            lock (_syncObject)
            {
                InternalScheduleTask(taskDetail);
            }
        }