예제 #1
0
        public static MenuObject AddLast(this MenuObject menu, string title, ApplicationTask task, string topic = "", string tip = "")
        {
            var sub = new MenuObject(title, task, topic, tip) { Parent = menu };

            menu.SubMenus.Add(sub);

            return menu.Parent;
        }
예제 #2
0
파일: MenuObject.cs 프로젝트: NLADP/ADF
 public MenuObject(string title, ApplicationTask task = null, string topic = "", string tip = "")
 {
     Title = title;
     Task = task;
     Topic = topic;
     Tip = tip;
     Enabled = false;
     SubMenus = new List<MenuObject>();
 }
예제 #3
0
 ///<summary>
 ///  Running a task
 ///</summary>
 ///<param name="origin">Task to run the new task from.</param>
 ///<param name="name">Task to run</param>
 ///<param name="p">Optional parameters</param>
 public void Run(ITask origin, ApplicationTask name, params object[] p)
 {
     TestManager.Register(TestItemType.Task, name, TestAction.TaskStarted, p);
 }
예제 #4
0
파일: Task.cs 프로젝트: erwinbovendeur/ADF
 /// <summary>
 /// Initializes a new instance of the <see cref="Task"/> class with the specified predefined task name of <see cref="ApplicationTask"/> and starting point of task.
 /// </summary>
 /// <param name="name">The <see cref="ApplicationTask"/> that defines the task name whose value will set.</param>
 /// <param name="origin">The <see cref="ITask"/> that defines the start point of task.</param>
 public Task(ApplicationTask name, ITask origin)
 {
     id = Guid.NewGuid();
     this.name = name;
     this.origin = origin;
 }
예제 #5
0
파일: Task.cs 프로젝트: erwinbovendeur/ADF
 /// <summary>
 /// Initializes a new instance of the <see cref="Task"/> class with the specified predefined task name of <see cref="ApplicationTask"/> class object.
 /// </summary>
 /// <param name="name">The <see cref="ApplicationTask"/> that defines the task name whose value will set.</param>
 public Task(ApplicationTask name)
 {
     origin = Empty;
     this.name = name;
 }
예제 #6
0
파일: Task.cs 프로젝트: erwinbovendeur/ADF
 /// <summary>
 /// Provide a method to continue one or more tasks after completion of specified task.
 /// </summary>
 /// <param name="finishedtask">The task which will check for cmpletion.</param>
 /// <param name="returns">The <see cref="TaskResult"/> that defines the current status of a task.</param>
 /// <param name="p">The array of tasks, which will be executed.</param>
 public virtual void Continue(ApplicationTask finishedtask, TaskResult returns, params object[] p)
 {
     Finish(returns, p);
 }
예제 #7
0
 /// <summary>
 /// Provides a method to run or execute one or more tasks.
 /// </summary>
 /// <param name="origin">The <see cref="ITask"/> that defines the start point of task.</param>
 /// <param name="name">The <see cref="ApplicationTask"/> that defines the name of task.</param>
 /// <param name="p">The array of tasks, which will be executed.</param>
 public static void RunTask(this ITask origin, ApplicationTask name, params object[] p)
 {
     TaskManager.Run(origin, name, p);
 }
예제 #8
0
 public static void ExecuteAndRun(this ITask task, ApplicationTask name, params Action[] actions)
 {
     if (task.Execute(actions)) task.RunTask(name);
 }
예제 #9
0
        /// <summary>
        /// Provides a method to run or execute one or more tasks.
        /// </summary>
        /// <param name="origin">The <see cref="ITask"/> that defines the start point of task.</param>
        /// <param name="name">The <see cref="ApplicationTask"/> that defines the name of task.</param>
        /// <param name="p">The array of tasks, which will be executed.</param>
        public void Run(ITask origin, ApplicationTask name, params object[] p)
        {
            if (!AuthorizationManager.IsAllowed(name))
            {
                LogManager.Log("Not authorized for task " + name);
                return;
            }

            var mainType = Main.GetType();

            var typeName =
                string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}Task",
                              mainType.Namespace,
                              Type.Delimiter,
                              name.Name.Replace('/', Type.Delimiter));

            var type = mainType.Assembly.GetType(typeName, true);

            object[] parms = { name, origin ?? Main };

            var task = Activator.CreateInstance(type, parms) as ITask;

            if (task == null) return;

            tasks[task.Id] = task;

            Debug.WriteLine("Starting task: " + task.Name);

            task.Run(p);
        }
예제 #10
0
파일: TaskManager.cs 프로젝트: NLADP/ADF
 /// <summary>
 /// Provides a method to run or execute one or more tasks.
 /// </summary>
 /// <param name="origin">The <see cref="ITask"/> that defines the start point of task.</param>
 /// <param name="name">The <see cref="ApplicationTask"/> that defines the name of task.</param>
 /// <param name="p">The array of tasks, which will be executed.</param>
 public static void Run(ITask origin, ApplicationTask name, params object[] p)
 {
     Provider.Run(origin, name, p);
 }
예제 #11
0
파일: TaskManager.cs 프로젝트: NLADP/ADF
 /// <summary>
 /// Run or execute an array of tasks by the specified <see cref="ApplicationTask"/> name.
 /// </summary>
 /// <param name="name">The <see cref="ITask"/> that defines the start point of task.</param>
 /// <param name="p">The array of tasks, which will be executed.</param>
 public static void Run(ApplicationTask name, params object[] p)
 {
     Run(null, name, p);
 }