Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DroneTaskContext" /> class.
        /// </summary>
        /// <param name="module">The module from where the task came from.</param>
        /// <param name="task">The task being executed.</param>
        /// <param name="env">The env.</param>
        /// <param name="log">The task log.</param>
        /// <param name="taskRunner">The run task function use to run other tasks.</param>
        /// <exception cref="System.ArgumentNullException">module
        /// or
        /// task
        /// or
        /// config
        /// or
        /// taskLog
        /// or
        /// runTask</exception>
        public DroneTaskContext(
			DroneModule module,
			DroneTask task, 
			DroneEnv env,
			Logger log, 
			DroneTaskRunner taskRunner)
        {
            if(module == null)
                throw new ArgumentNullException("module");

            if(task == null)
                throw new ArgumentNullException("task");

            if(env == null)
                throw new ArgumentNullException("env");

            if(log == null)
                throw new ArgumentNullException("log");

            if(taskRunner == null)
                throw new ArgumentNullException("taskRunner");

            this.Module = module;
            this.Task = task;
            this.Env = env;
            this.Log = log;
            this.taskRunner = taskRunner;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds the given task to this module
        /// </summary>
        /// <param name="task">The task.</param>
        /// <exception cref="System.ArgumentNullException">task</exception>
        public void Add(DroneTask task)
        {
            if(task == null)
                throw new ArgumentNullException("task");

            this.tasks[task.Name] = task;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Runs the specified task object.
        /// </summary>
        /// <param name="task">The task.</param>
        /// <exception cref="System.ArgumentNullException">task</exception>
        public void Run(DroneTask task)
        {
            if (task == null)
                throw new ArgumentNullException("task");

            this.taskRunner(task, this.Env);
        }