public SyncStatusMode SendStatus() { SyncStatusMode currentStatus = new SyncStatusMode(); if (this.isDone) { currentStatus.CleanSteps = CleanSteps.Done; } else { if (!this.isPause) { if (this.isAuto) { this.Clean(this.isSingleStep); } else { this.ManualClean(this.isForward); } } currentStatus.IsError = false; currentStatus.ErrorMsg = string.Empty; currentStatus.CurrentRailID = this.id; currentStatus.ProgressRate = this.progress; currentStatus.CleanSteps = (CleanSteps)this.currentStep; } return(currentStatus); }
public void GetStatus() { do { status = MachinePortal.GetStatus(); this.UpdateUIDelegate(status); Thread.Sleep(1000); }while (status.CleanSteps != CleanSteps.Done); this.TaskCallBack(); }
private void UpdateProcessUI(SyncStatusMode status) { CheckForIllegalCrossThreadCalls = false; //if (InvokeRequired) //{ // this.BeginInvoke(new AsynUpdateUI(this.Update), status); //} //else //{ this.Update(status); //} }
private void UpdateProcessUI(SyncStatusMode status) { CheckForIllegalCrossThreadCalls = false; if (InvokeRequired) { this.Invoke(new AsynUpdateUI(this.Update), status); } else { this.Update(status); } }
/// <summary> /// 更新界面 /// </summary> /// <param name="status"></param> private void Update(SyncStatusMode status) { CheckForIllegalCrossThreadCalls = false; if (status.IsError) { MessageBox.Show(status.ErrorMsg); } else { this.UpdateUpArrowLocation(status.ProgressRate); if (status.CleanSteps == CleanSteps.Done) { MessageBox.Show("到达终点,清理停止!"); this.PauseManual(); } //this.railsControler.SetRailProgress(status.CleanSteps); } }
private void Update(SyncStatusMode status) { CheckForIllegalCrossThreadCalls = false; if (status.IsError) { MessageBox.Show(status.ErrorMsg); } else { //过滤掉非法数据 float progress = status.ProgressRate > 100 ? 100 : status.ProgressRate < 0 ? 0 : status.ProgressRate; switch (status.CleanSteps) { case CleanSteps.CleanRail: this.CleanRailStepRate = progress; // AutoCleanFrm.RailLength; this.CurrentCleanStep = CleanSteps.CleanRail; this.GunDongFont.Text = this.GetGunDongText(status.CurrentRailID, this.CurrentStatus); break; case CleanSteps.DropAlcohol: this.CleanRailStepRate = 100; this.timerThread1.Abort(); if (this.CurrentCleanStep != CleanSteps.DropAlcohol) { this.timerThread2.Start(new TimeSpan(0, 0, 0)); } this.CoveredWithGreaseStepRate = progress; // AutoCleanFrm.RailLength; this.CurrentCleanStep = CleanSteps.DropAlcohol; this.GunDongFont.Text = this.GetGunDongText(status.CurrentRailID, this.CurrentStatus); break; case CleanSteps.CoveredWithGrease: this.CleanRailStepRate = 100; this.timerThread1.Abort(); this.CoveredWithGreaseStepRate = 100; this.timerThread2.Abort(); if (this.CurrentCleanStep != CleanSteps.CoveredWithGrease) { this.timerThread3.Start(new TimeSpan(0, 0, 0)); } this.DropAlcoholStepRate = progress; // AutoCleanFrm.RailLength; this.CurrentCleanStep = CleanSteps.CoveredWithGrease; this.GunDongFont.Text = this.GetGunDongText(status.CurrentRailID, this.CurrentStatus); break; case CleanSteps.Done: this.CleanRailStepRate = 100; this.timerThread1.Abort(); this.CoveredWithGreaseStepRate = 100; this.timerThread2.Abort(); this.DropAlcoholStepRate = 100; this.timerThread3.Abort(); this.CurrentCleanStep = CleanSteps.Done; int num = (int)this.railsControler.WorkingNum; string numZh = this.ConvertNumToChinese(num); this.startBtn.BackgroundImage = global::CleanSys.Properties.Resources.NewStartBtn; MessageBox.Show($"{numZh}轨道清理完毕!"); this.GunDongFont.Text = this.GetGunDongText(status.CurrentRailID, this.CurrentStatus); break; } this.UpdateUpArrowLocation(progress); this.railsControler.SetRailProgress(status.CleanSteps); } }