示例#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
 /// <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
 /// <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
 /// <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);
 }