コード例 #1
0
ファイル: MenuObjectExtensions.cs プロジェクト: NLADP/ADF
        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
ファイル: TestTaskProvider.cs プロジェクト: NLADP/ADF
 ///<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
ファイル: TaskExecutionExtensions.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 RunTask(this ITask origin, ApplicationTask name, params object[] p)
 {
     TaskManager.Run(origin, name, p);
 }
コード例 #8
0
ファイル: TaskExecutionExtensions.cs プロジェクト: NLADP/ADF
 public static void ExecuteAndRun(this ITask task, ApplicationTask name, params Action[] actions)
 {
     if (task.Execute(actions)) task.RunTask(name);
 }
コード例 #9
0
ファイル: TaskProvider.cs プロジェクト: erwinbovendeur/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 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);
 }