Esempio n. 1
0
 /// <summary>
 /// Add a task to the taskmanager
 /// </summary>
 /// <param name="task">The Task</param>
 /// <param name="interval">Interval in seconds</param>
 /// <param name="start">Automatically start, after it's added. You can also manually start by task.Start()</param>
 private void AddTask(TaskBase task, long interval, bool start)
 {
     task.Interval = interval;
     this.Tasks.Add(task);
     if (start)
     {
         task.Start();
     }
 }
Esempio n. 2
0
        public TaskBase CreateTask(Type t, int settingId)
        {
            TaskBase task = (TaskBase)Activator.CreateInstance(t);

            task.SettingID = settingId;
            task.LoadSettings();
            task.RunOnStart = true;
            AddTask(task, task.DefaultInterval, task.RunOnStart);
            return(task);
        }