private void stopBtn_Click(object sender, EventArgs e) { if (!this.railsControler.IsAllStoped) { DialogResult result = MessageBox.Show("确实终止清理", "确认", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { RailID id = this.railsControler.WorkingNum; bool isSuccess = MachinePortal.StopManualClean(id); if (!isSuccess) { MessageBox.Show("终止清理失败!"); } else { this.railsControler.Stop(); this.cleanStep = CleanSteps.UnSupported; this.UpdateUpArrowLocation(0); this.ClearStepBtns(); this.PauseManual(); } } } else { MessageBox.Show("清理没有进行,无需终止!"); } }
/// <summary> /// 当第二次单击 前进后者后退的时候,就相当于暂停状态 /// 只是发送 停止命令,并且杀死 更新UI进程,并不改变 轨道,清理步骤 和模拟小车的状态 /// </summary> private void PauseManual() { bool success = MachinePortal.StopManualClean(this.railsControler.WorkingNum); if (success) { this.updateUiThread.Abort(); this.isWorking = false; this.forwardBtn.Enabled = true; this.backfowrdBtn.Enabled = true; this.railsControler.SetRailStatus(RailStatus.Ready); this.forwardBtn.BackgroundImage = global::CleanSys.Properties.Resources.forwardBtn; this.backfowrdBtn.BackgroundImage = global::CleanSys.Properties.Resources.backwardBtn; } else { MessageBox.Show("发送暂停前进命令失败,请检查网络连接!"); } }