public Task TurnOff() { if (turnOnTask != null && !turnOnTask.IsCompleted) { terminalTurnOnTask.Cancel(); } TurnOffing = true; //无论设备么情况,传输和碎料必须停止 this.Pulverizer.TurnOff(); this.Transfer.TurnOff(); var token = terminalTurnOffTask.Token; return(turnOffTask = Task.Run(() => { ExhaustMain.TurnOff(); Thread.Sleep(200); ExhaustSlave.TurnOff(); Thread.Sleep(10000); PrimaryPump.TurnOff(); SecondaryPump.TurnOff(); Thread.Sleep(200); PlasmaGeneratorGroup.TurnOff(); UVLight.TurnOff(); this.GrayFan.TurnOff(); }, token).ContinueWith(task => { TurnOffing = false; })); }
/// <summary> /// /// </summary> public void TurnOn() { if (turnOffTask != null && !turnOffTask.IsCompleted && Enable) { throw new TerminalException("正在关闭中,请等完全关闭后再启动."); } var token = terminalTurnOnTask.Token; turnOnTask = Task.Run(() => { //无论设备么情况,传输和碎料必须停止 this.Pulverizer.TurnOff(); Thread.Sleep(200); this.Transfer.TurnOff(); PrimaryPump.TurnOn(); SecondaryPump.TurnOn(); Thread.Sleep(5000); PlasmaGeneratorGroup.TurnOn(); UVLight.TurnOn(); Thread.Sleep(3000); ExhaustMain.TurnOn(); Thread.Sleep(200); ExhaustSlave.TurnOn(); this.GrayFan.TurnOn(); }, token); }
public GarbageTerminal(Pulverizer pulverizer, GrayFan grayFan, PrimaryPump pump, PlasmaGeneratorGroup plasmaGenerator, ExhaustMain exhaustMain, ExhaustSlave exhaustSlave, Transfer transfer, ReactionCabin reactionCabin, UVLight uvLight, SecondaryPump secondary, IPowerController powerController, IOptionsMonitor <DeviceSetting> deviceSetting) { Transfer = transfer; Pulverizer = pulverizer; GrayFan = grayFan; this.PrimaryPump = pump; this.SecondaryPump = secondary; ExhaustMain = exhaustMain; ExhaustSlave = exhaustSlave; ReactionCabin = reactionCabin; UVLight = uvLight; this.controller = powerController; DeviceSetting = deviceSetting; this.GrayFan.Terminal = this; PlasmaGeneratorGroup = plasmaGenerator; plasmaGenerator.Terminal = this; }