private void funSetCraneNo(string craneNo) { if (lblCraneNo.InvokeRequired) { Update_EventHandler Update = new Update_EventHandler(funSetCraneNo); this.Invoke(Update, craneNo); } else { lblCraneNo.Text = "Crane " + craneNo; } }
private void funSetCommandID(string commandID) { if (lblCommandID.InvokeRequired) { Update_EventHandler Update = new Update_EventHandler(funSetCommandID); this.Invoke(Update, commandID); } else { lblCommandID.Text = commandID; } }
private void funUpdate(Label label, string text, Color color) { if (label.InvokeRequired) { Update_EventHandler Update = new Update_EventHandler(funUpdate); this.Invoke(Update, label, text, color); } else { label.Text = text; label.BackColor = color; } }
private void funUpdateCraneMode(string text) { if (lblCraneMode.InvokeRequired) { Update_EventHandler Update = new Update_EventHandler(funUpdateCraneMode); this.Invoke(Update, text); } else { switch (text) { case "C": lblCraneMode.Text = "C:电脑模式"; lblCraneMode.BackColor = Color.Lime; break; case "R": lblCraneMode.Text = "R:地上盘模式"; lblCraneMode.BackColor = Color.Red; break; case "M": lblCraneMode.Text = "M:维护模式"; lblCraneMode.BackColor = Color.Red; break; case "I": lblCraneMode.Text = "I:维护模式"; lblCraneMode.BackColor = Color.Red; break; case "N": lblCraneMode.Text = "N:未开启"; lblCraneMode.BackColor = Color.Red; break; case "X": lblCraneMode.Text = "X:未连线"; lblCraneMode.BackColor = Color.Red; break; default: lblCraneMode.Text = text; lblCraneMode.BackColor = Color.White; break; } } }
private void funUpdateCraneState(string text) { if (lblCraneState.InvokeRequired) { Update_EventHandler Update = new Update_EventHandler(funUpdateCraneState); this.Invoke(Update, text); } else { switch (text) { case "W": lblCraneState.Text = "W:待机中"; lblCraneState.BackColor = Color.Lime; break; case "A": lblCraneState.Text = "A:动作中"; lblCraneState.BackColor = Color.Lime; break; case "E": lblCraneState.Text = "E:异常中"; lblCraneState.BackColor = Color.Red; break; case "I": lblCraneState.Text = "I:检查中"; lblCraneState.BackColor = Color.Lime; break; case "N": lblCraneState.Text = "N:未开启"; lblCraneState.BackColor = Color.Red; break; case "X": lblCraneState.Text = "X:未连线"; lblCraneState.BackColor = Color.Red; break; default: lblCraneState.Text = text; lblCraneState.BackColor = Color.White; break; } } }