public Task <bool> Initial() { return(Task.Run(() => { var target = eHuiJinYunStagePosition.Initial; Position = target | eHuiJinYunStagePosition.OnGoing; CurrentAGV.Goto(target, (int)AGV.eSpeed.Speed4); //new NotifyWatcher(CurrentAGV).WaitOne((s, a) => CurrentAGV.Position == target); while (CurrentAGV.Position != target) { Thread.Sleep(1000); } Position = target; return true; })); }
public Task <bool> NextStage() { if (Position < eHuiJinYunStagePosition.Finish) { var target = (Position + 1); Position = target | eHuiJinYunStagePosition.OnGoing; return(Task.Run(() => { CurrentAGV.Goto(target, (int)AGV.eSpeed.Speed4); // new NotifyWatcher(CurrentAGV).WaitOne((s, a) => CurrentAGV.Position == target); while (CurrentAGV.Position != target) { Thread.Sleep(1000); } Position = target; return true; })); } return(Task.Run <bool>(() => false)); }