コード例 #1
0
        private int LoadTasks()
        {
            lock (_taskMonitorList)
            {
                Globals.WriteToDebugFile("TaskMonitor: Loading Tasks");
                int  msToNext = 86400000;                //24h * 60m * 60s * 1000 <- the max wait time is 24h
                Time now      = new Time(DateTime.Now);

                LSTasksConfig tasksCfg = TasksLoader.LoadTasksFromFile();
                _updateRate = tasksCfg.UpdateRate * 1000;
                _positionTools.UseCellLocation = tasksCfg.UseCellLocation;
                List <Task> taskList = tasksCfg.TaskList;

                foreach (Task task in taskList)
                {
                    TasksMonitorTask tmt = new TasksMonitorTask();
                    tmt.task      = task;
                    tmt.msToStart = GetMsToTask(now, task);
                    _taskMonitorList.Add(tmt);
                    if (tmt.msToStart < msToNext)
                    {
                        msToNext = tmt.msToStart.Value;
                    }
                }
                _lastUpdate = now;
                return(msToNext);
            }
        }
コード例 #2
0
        private int LoadTasks()
        {
            lock (_taskMonitorList)
            {
                Globals.WriteToDebugFile("TaskMonitor: Loading Tasks");
                int msToNext = 86400000; //24h * 60m * 60s * 1000 <- the max wait time is 24h
                Time now = new Time(DateTime.Now);

                LSTasksConfig tasksCfg = TasksLoader.LoadTasksFromFile();
                _updateRate = tasksCfg.UpdateRate * 1000;
                _positionTools.UseCellLocation = tasksCfg.UseCellLocation;
                List<Task> taskList = tasksCfg.TaskList;

                foreach (Task task in taskList)
                {
                    TasksMonitorTask tmt = new TasksMonitorTask();
                    tmt.task = task;
                    tmt.msToStart = GetMsToTask(now, task);
                    _taskMonitorList.Add(tmt);
                    if (tmt.msToStart < msToNext) msToNext = tmt.msToStart.Value;
                }
                _lastUpdate = now;
                return msToNext;
            }
        }