static void Main(string[] args) { TinctTask t1 = new TinctTask(); t1.TaskStatus = TinctTaskStatus.WaittingToRun; t1.Context.TaskData = ""; t1.Context.ControllerName = "TinctTest"; t1.Context.ActionName = "LoadData"; t1.Context.TaskID = t1.ID; TinctTask t = new TinctTask(); t.TaskStatus = TinctTaskStatus.Waitting; t.Context.TaskData = ""; t.Context.ControllerName = "TinctTest"; t.Context.ActionName = "LoadData"; t.Context.TaskID = t.ID; t.WaittingTinctTasks.Add(t1); TinctTask t2 = new TinctTask(); t2.TaskStatus = TinctTaskStatus.WaittingToRun; t2.Context.TaskData = ""; t2.Context.ControllerName = "TinctTest"; t2.Context.ActionName = "LoadData"; t2.Context.TaskID = t2.ID; BaseTinctTaskRepository tre = new TinctTaskRepository(); tre.AddTinctTask(t); tre.AddTinctTask(t1); tre.AddTinctTask(t2); TinctTaskMangement.TinctWork.TinctTaskManeger tm = new TinctTaskMangement.TinctWork.TinctTaskManeger(); tm.Repository = tre; tm.Start(); Console.Read(); }
public override void RemoveTinctTask(TinctTask task) { lock (synctasks) { tinctTasks.Remove(task); } }
public override void AddTinctTask(TinctTask task) { task.TinctTaskStatusChanged += Task_TinctTaskStatusChanged; //log var taskInfo = new TinctTaskInfo(task.Context, task.TaskStatus); foreach (var w in task.WaittingTinctTasks) { taskInfo.WaitTaskIDs.Add(w.ID); } logentity.Message = taskInfo; logger.LogInfo(logentity); lock (synctasks) { tinctTasks.Add(task); } if (task.TaskStatus == TinctTaskStatus.WaittingToRun) { lock (syncqueue) { queuetasks.Enqueue(task); if (EnqueTask != null) { EnqueTask(this, new EventArgs()); } } } }
public abstract void RemoveTinctTask(TinctTask task);
public abstract void AddTinctTask(TinctTask task);