Falcon.TaskScheduling/Falcon.TaskSchedulingTests/TaskUnit.cs

44 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using Falcon.TaskScheduling;
namespace Falcon.TaskSchedulingTests
{
public class TaskUnit:ITaskUnit
{
public string State { get; set; }
public string Result { get; set; }
public TaskType Type { get; set; }
public static List<TaskUnit> ResultList { get; set; } = new List<TaskUnit>();
public TaskUnit() {
this.State = "";
}
public TaskUnit(string state,TaskType type) {
this.State = state;
this.Type = type;
}
public object Run() {
return this.State as object;
}
public void TaskCallback(object result,Exception ex) {
if(result is string str) {
this.Result = str;
} else {
this.Result = "";
}
ResultList.Add(this);
}
}
public enum TaskType
{
system,
first,
queue,
idel,
}
}