refactor: 将Framework库和RT、UI放在同一个解决方案中。
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
using Aitex.Core.RT.Routine;
|
||||
using Aitex.Core.Util;
|
||||
|
||||
namespace SicModules.UnLoads.Routines
|
||||
{
|
||||
public class UnLoadCoolingRoutine : UnLoadBaseRoutine
|
||||
{
|
||||
enum RoutineStep
|
||||
{
|
||||
TimeDealy
|
||||
}
|
||||
|
||||
private DeviceTimer _dt = new DeviceTimer();
|
||||
|
||||
private int _coolingTime;
|
||||
|
||||
public UnLoadCoolingRoutine()
|
||||
{
|
||||
Name = "UnLoad Cooling";
|
||||
}
|
||||
|
||||
public void Init(int coolingTime)
|
||||
{
|
||||
_coolingTime = coolingTime;
|
||||
}
|
||||
|
||||
public override Result Start(params object[] objs)
|
||||
{
|
||||
Reset();
|
||||
_dt.Start(0);
|
||||
Notify("Start");
|
||||
return Result.RUN;
|
||||
}
|
||||
|
||||
|
||||
public override Result Monitor()
|
||||
{
|
||||
try
|
||||
{
|
||||
Delay((int)RoutineStep.TimeDealy, _coolingTime);
|
||||
}
|
||||
catch (RoutineBreakException)
|
||||
{
|
||||
return Result.RUN;
|
||||
}
|
||||
catch (RoutineFaildException)
|
||||
{
|
||||
return Result.FAIL;
|
||||
}
|
||||
_dt.Stop();
|
||||
Notify("Finished");
|
||||
|
||||
return Result.DONE;
|
||||
}
|
||||
|
||||
public override void Abort()
|
||||
{
|
||||
if (!_dt.IsIdle())
|
||||
{
|
||||
_dt.Stop();
|
||||
}
|
||||
|
||||
base.Abort();
|
||||
}
|
||||
|
||||
public int GetRemainedTime()
|
||||
{
|
||||
if (!_dt.IsIdle())
|
||||
{
|
||||
int coolingRemain = _coolingTime - (int)(_dt.GetElapseTime() / 1000);
|
||||
return coolingRemain >= 0 ? coolingRemain : 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user