/// <summary> /// unpause move (after Pause only) /// </summary><see cref="Pause"/> public void unPause(PauseTicket ticket) { try { if (ticket != null) ticket.Dispose(); } catch (ObjectDisposedException de) { Dbg("ticket already disposed" + de); } Dbg("unpause " + this.automovestatus + " lvl=" + ptickets.Count); }
/// <summary> /// pause move /// </summary> public PauseTicket Pause(double tm = -1) { Dbg("pause " + this.automovestatus); if (this.automovestatus < 1) return null; try { TimeSpan timer; if (tm < 0) timer = TimeSpan.FromDays(100); // MaxValue низзя! else timer = TimeSpan.FromMilliseconds(tm); PauseTicket ticket = new PauseTicket(timer); ptickets.Add(ticket); Dbg("ptickets " + ptickets.Count); if (this.automovestatus == 1 || this.automovestatus == 4) { this.automovestatus = 3; this.autorotatestatus = 3; } StopMoving(); StopRotate(); this.autobuffstatus = 2; // ToDo: save point for long dist Thread.Sleep(50); return ticket; } catch (Exception e) { Dbg("pause fail " + e); return null; } }