/// <summary> /// 初始化一个任务执行者 /// </summary> public TaskTester() { this.Context = new TaskInvokerContext(); this._innerSE = new V8ScriptEngine(); this._innerSE.LoadSystemModules(); this.Context.Engine = this._innerSE; }
public TaskInvoker(string scriptFile) { this._innerSE = new V8ScriptEngine(); this._innerSE.LoadSystemModules(); this.Context = new TaskInvokerContext(); this.Context.ExecutePath = FileUnity.GetDrectory(scriptFile); this.Context.Engine = this._innerSE; this.BindContext(); this._needInit = true; this.InitScript(scriptFile); }
/// <summary> /// 初始化一个任务执行者 /// </summary> /// <param name="http"></param> public TaskInvoker(TaskContext taskContext) { this.Status = TaskInvokerStatus.Init; this._innerSE = new V8ScriptEngine(); this._innerSE.LoadSystemModules(); this._innerSE.AddHostObject("http", this.Context.TaskContext.HttpClient); this.Context = new TaskInvokerContext(); this.Context.TaskContext = taskContext; this.Context.Engine = this._innerSE; this._worker = new Thread(ThreadWork); this._notify = new AutoResetEvent(false); this._worker.Start(); }
/// <summary> /// 初始化一个任务执行者 /// </summary> /// <param name="task"></param> public TaskInvoker(Task task) { this.Status = TaskInvokerStatus.Init; this.Context = new TaskInvokerContext(); this.Context.Task = task; this.Context.ExecutePath = task.ExecutePath; this._innerSE = new V8ScriptEngine(); this._innerSE.LoadSystemModules(); this.Context.Engine = this._innerSE; this._worker = new Thread(ThreadWork); this._notify = new AutoResetEvent(false); this._worker.Start(); }
/// <summary> /// 绑定任务执行上下文 /// </summary> /// <param name="context"></param> public static void SetTaskInvokerContext(TaskInvokerContext context) { CallContext.SetData(Key_TaskInvokerContext, context); }