public void FreshDriverStatus() { if (Visible == false || bMouseIn) { return; } Action atc = () => { if (m_plcRes == PLCResponse.SUCCESS) { if (strPreValue == strValue && bRefresh == true) { return; } textBoxDisplay.Text = strValue; } else { bTimeOut = true; strValue = m_plcRes.ToString(); textBoxDisplay.Text = m_plcRes.ToString(); } bRefresh = true; strPreValue = strValue; }; textBoxDisplay.Invoke(atc); }
public void FreshDriverStatus() { if (Visible == false) { return; } Action atc = () => { if (m_plcRes == PLCResponse.SUCCESS) { if (bPreStatus == bCurrentStatus && bRefresh == true) { return; } if (bCurrentStatus) { buttonBit.Text = strOnText; buttonBit.ForeColor = colorOnForeColor; buttonBit.BackColor = colorOnBackColor; } else { buttonBit.Text = strOffText; buttonBit.ForeColor = colorOffForeColor; buttonBit.BackColor = colorOffBackColor; } } else { bTimeOut = true; buttonBit.Text = m_plcRes.ToString(); buttonBit.ForeColor = colorOffForeColor; buttonBit.BackColor = colorOffBackColor; } bRefresh = true; bPreStatus = bCurrentStatus; }; buttonBit.Invoke(atc); }