private void CalOtherMSCount(VM_TDRSInfo td) { if (td == null) { return; } if (td.MSStatus(td.InputDiInfo).MsStatusTwo == true) { n_MSTwoCount = n_MSTwoCount + 1; } else if (td.MSStatus(td.InputDiInfo).MsStatusThree == true) { n_MSThreeCount = n_MSThreeCount + 1; } else if (td.MSStatus(td.InputDiInfo).MsStatusFour == true) { n_MSFourCount = n_MSFourCount + 1; } }
private string CalNumberMs(VM_TDRSInfo td) { //"0"代表没有任何磁钢数据过来,1代表有一号信号过来 ,“2”代表有234信号过来 string ret = "0"; if (td == null) { ret = "0"; } else if (td.MSStatus(td.InputDiInfo).MsStatusOne == true) { ret = "1"; } else if (td.InputDiInfo == "00001111") { ret = "0"; } else if (td.MSStatus(td.InputDiInfo).MsStatusTwo == true || td.MSStatus(td.InputDiInfo).MsStatusThree == true || td.MSStatus(td.InputDiInfo).MsStatusFour == true) { ret = "2"; } return(ret); }
void GetStatus() { // read Di port state byte portData = 0; ErrorCode err = ErrorCode.Success; for (int i = 0; (i + m_startPort) < instantDiCtrl1.Features.PortCount && i < m_portCountShow; ++i) { err = instantDiCtrl1.Read(i + m_startPort, out portData); if (err != ErrorCode.Success) { //timer1.Enabled = false; HandleError(err); return; } m_HtDicPortToValue[(i + m_startPort).ToString()] = portData.ToString("X2"); // m_portNum[i].Text = (i + m_startPort).ToString(); //m_portHex[i].Text = portData.ToString("X2"); //加入设备状态变化的列表 if (i == 1) { if (tdrs == null) { VM_TDRSInfo tdrs = new VM_TDRSInfo(); } tdrs.HeadingDirection = (Direction)Enum.Parse(typeof(Direction), Config.TrainDirection); tdrs.PortInfo = portData.ToString("X2"); tdrs.InputDiInfo = tdrs.InputDiInfo; tdrs.CREATED = DateTime.Now; bool flag = false; flag = STSEventLogManage.Instance.AddEventLog(tdrs); tdrs.MSStatus(tdrs.InputDiInfo); if (flag) { //信号产生变化后,通知外部 IDIInputInfo(); } } // Set picture box state for (int j = 0; j < 8; ++j) { //m_pictrueBox[i, j].Image = imageList1.Images[(portData >> j) & 0x1]; //m_pictrueBox[i, j].Invalidate(); } } }