private void ListView_Output_DoubleClick(object sender, EventArgs e) { if (UseOutputControl == false) { return; } ListView listView = ((ListView)sender); int nIndex = listView.SelectedItems[0].Index; if (nIndex < 0) { return; } string strIOName = listView.Items[nIndex].SubItems[0].Text; string strIoType = listView.Items[nIndex].SubItems[1].Text; if (strIOName.StartsWith("SPARE_") == true) { return; //스페어다. } if (strIoType == SRZ_IO_TYPE.TIO_8888.ToString()) { SRZ_IO _IO = m_SRZ_IoList.GetLinkData(strIOName, SRZ_IO_TYPE.TIO_8888); if (_IO != null) { Form_SRZ_Output_Control dlg = new Form_SRZ_Output_Control(); dlg.SetIO(_IO); if (dlg.ShowDialog() == DialogResult.OK) { } } } else if (strIoType == SRZ_IO_TYPE.DIO.ToString()) { SRZ_IO _IO = m_SRZ_IoList.GetLinkData(strIOName, SRZ_IO_TYPE.DIO); if (_IO != null) { float fVal = (_IO.Value == 0) ? 1 : 0; // 현재값과 반대로 보낸다. string strMsg = string.Format("Do you Wan't Send Select IO?\r\n\r\n - IO Name : {0}\r\n - Value : {1}", _IO.IO_Name, (fVal == 1) ? "ON" : "OFF"); if (!MessageBox.Show(strMsg, "Send IO", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2).Equals(DialogResult.Yes)) { return; } _IO.Value = fVal; } } }
private void Btn_IO_List_Change_Click(object sender, EventArgs e) { if (ListView_IO_List.SelectedItems.Count <= 0) { return; } int nCpu = ListBox_CPU.SelectedIndex; int nModule = ListBox_Module.SelectedIndex; int nIo = ListView_IO_List.SelectedItems[0].Index; try { if (Check_IO_Name(txtBox_IoName.Text, nCpu, nModule) == true) { MessageBox.Show("동일한 이름의 IO가 존재합니다. 이름을 변경하세요."); return; } if (MessageBox.Show("입력하신 값으로 변경 하시겠습니까?", "값 변경", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1).Equals(DialogResult.No)) { return; } string strType = ListView_IO_List.Items[nIo].SubItems[1].Text; string strIoName = ListView_IO_List.Items[nIo].SubItems[2].Text; SRZ_IO _IO = m_IO_List_DataSet.GetLinkData(strIoName, nCpu, m_IO_List_DataSet.SRZ_Cpu[nCpu].Module_List[nModule].IO_Type); _IO.IO_Name = txtBox_IoName.Text; if (strType.IndexOf("SET") >= 0) { if (txtBox_Value.Text != "") { _IO.Value = float.Parse(txtBox_Value.Text); } } Init_IoListView(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }