/// <summary> /// Override Client.ProcessState - to process server changed state /// </summary> /// <param name="data"></param> public override void ProcessState(StateData data) { PlanState = (EPlanState)data.state; var changed = SpotsPassed != data.spots_passed; SpotsPassed = data.spots_passed; SpotsTotal = data.spots_count; switch (PlanState) { case EPlanState.INPROCESS: fFinished = false; Header = ReadData.NextPacketHeader(); var cmd = (EDataCommand)Header.value; ReadData.Skip(1); // ??? not clear why, but it works if (changed && PlanInProcess != null) { PlanInProcess.Invoke(data); } break; case EPlanState.FINISHED: fFinished = true; if (PlanFinished != null) { PlanFinished.Invoke(); } break; case EPlanState.PAUSED: if (PlanPaused != null) { PlanPaused.Invoke(); } break; case EPlanState.NOTREADY: fReady = false; break; case EPlanState.READY: fReady = true; break; case EPlanState.UNKNOWN: fReady = false; break; } base.ProcessState(data); }
/// <summary> /// Pauses the plan processing on server. /// </summary> /// <returns><c>true</c> if OK, <c>false</c> otherwise.</returns> public virtual bool Pause() { var ret = SendCommand(EPlanCommand.PAUSEPLAN); if (ret && (PlanPaused != null)) { PlanPaused.Invoke(); } return(ret); }