private void NMFTimer_Tick(object sender, EventArgs e) { if (!IsNMFCon) { IsNMFCon = nmfdio.Connect(DevNum, IP[0], IP[1], IP[2], 200); } short nRet; short[] nPinStatus = new short[128]; bool[] state = new bool[15]; try { nRet = NMF.nmf_GetBrdAllStatus(DevNum, out nmfdio.tAllStatus); nRet = NMF.nmf_DIGet(DevNum, nPinStatus); if (nRet != 0) { return; } for (int i = 0; i < 15; i++) { //CheckBox chkBox = (Controls.Find("checkBox_In" + i.ToString(), true)[0] as CheckBox); if (i < nmfdio.tAllStatus.nCntDIBrd * NMF.BRD_VS_DIO_PINS) { /*chkBox.Enabled = true; * chkBox.ImageIndex = nPinStatus[i]; * if (chkBox.ImageIndex == 0) * chkBox.CheckState = CheckState.Unchecked; * else * chkBox.CheckState = CheckState.Checked;*/ if (nPinStatus[i] == 1) { state[i] = true; } else { state[i] = false; } } else { state[i] = false; } } myledbulb1.On = state[0]; myledbulb2.On = state[1]; myledbulb3.On = state[2]; myledbulb4.On = state[4]; myledbulb5.On = state[5]; myledbulb6.On = state[6]; myledbulb7.On = state[7]; myledbulb8.On = state[8]; myledbulb9.On = state[9]; myledbulb10.On = state[10]; myledbulb11.On = state[11]; myledbulb12.On = state[12]; //myledbulb13.On = state[13]; myledbulb14.On = state[14]; } catch { NMFTimer.Enabled = false; MessageBox.Show("NMF연결 상태를 확인해주세요"); } }