Example #1
0
        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;
                }
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
        private void Refesh_IoListView()
        {
            int nCpu    = ListBox_CPU.SelectedIndex;
            int nModule = ListBox_Module.SelectedIndex;

            if (nCpu < 0 || nModule < 0 || ListView_IO_List.Items.Count <= 0)
            {
                return;
            }

            try
            {
                for (int nIndex = 0; nIndex < ListView_IO_List.Items.Count; nIndex++)
                {
                    ListViewItem _Item     = ListView_IO_List.Items[nIndex];
                    string       strIoName = _Item.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);
                    _Item.SubItems[3].Text = string.Format("{0}", _IO.Value);
                }
            }
            catch
            { }
        }
Example #4
0
        private void Refresh_IO_List(int nTabIndex, TabPage _Page)
        {
            if (nTabIndex < 0 || _Page == null)
            {
                return;
            }

            string strIO_Name = "";
            string strIO_Type = "";

            foreach (Control ctrl in _Page.Controls)
            {
                if (ctrl.GetType().Name == "Win_ListView")
                {
                    Win_ListView listView = ctrl as Win_ListView;

                    if (listView != null)
                    {
                        foreach (ListViewItem list in listView.Items)
                        {
                            strIO_Name = list.SubItems[0].Text;
                            strIO_Type = list.SubItems[1].Text;

                            SRZ_IO _IO = null;

                            if (strIO_Type == SRZ_IO_TYPE.TIO_8888.ToString())
                            {
                                _IO = m_SRZ_IoList.GetLinkData(strIO_Name, nTabIndex, SRZ_IO_TYPE.TIO_8888);
                            }
                            else if (strIO_Type == SRZ_IO_TYPE.TIO_VVVV.ToString())
                            {
                                _IO = m_SRZ_IoList.GetLinkData(strIO_Name, nTabIndex, SRZ_IO_TYPE.TIO_VVVV);
                            }
                            else if (strIO_Type == SRZ_IO_TYPE.DIO.ToString())
                            {
                                _IO = m_SRZ_IoList.GetLinkData(strIO_Name, nTabIndex, SRZ_IO_TYPE.DIO);
                            }

                            if (_IO != null)
                            {
                                if (_IO.IO_Type == SRZ_IO_TYPE.DIO)
                                {
                                    string strVal = _IO.Value == 0 ? "OFF" : "ON";
                                    if (strVal != list.SubItems[2].Text)
                                    {
                                        list.SubItems[2].Text = strVal;
                                    }
                                }
                                else
                                {
                                    string strVal = _IO.Value.ToString();
                                    if (strVal != list.SubItems[2].Text)
                                    {
                                        list.SubItems[2].Text = strVal;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Example #5
0
        public SRZ_IO GetLinkData(string strIoName, int nCpuIndex, SRZ_IO_TYPE type)
        {
            SRZ_IO Rtn = null;

            for (int nCpu = 0; nCpu < SRZ_Cpu.Count; nCpu++)
            {
                if (nCpu != nCpuIndex)
                {
                    continue;
                }

                for (int nModule = 0; nModule < SRZ_Cpu[nCpu].Module_List.Count; nModule++)
                {
                    if (SRZ_Cpu[nCpu].Module_List[nModule].IO_Type != type)
                    {
                        continue;
                    }

                    for (int nIO = 0; nIO < SRZ_Cpu[nCpu].Module_List[nModule].Read_Value.Count; nIO++)
                    {
                        SRZ_IO _IO = SRZ_Cpu[nCpu].Module_List[nModule].Read_Value[nIO];
                        if (_IO.IO_Name.Equals(strIoName) && _IO.IO_Type.Equals(type))
                        {
                            Rtn = _IO;
                            break;
                        }
                    }
                    if (Rtn != null)
                    {
                        break;
                    }

                    for (int nIO = 0; nIO < SRZ_Cpu[nCpu].Module_List[nModule].Set_Value.Count; nIO++)
                    {
                        SRZ_IO _IO = SRZ_Cpu[nCpu].Module_List[nModule].Set_Value[nIO];
                        if (_IO.IO_Name.Equals(strIoName) && _IO.IO_Type.Equals(type))
                        {
                            Rtn = _IO;
                            break;
                        }
                    }
                    if (Rtn != null)
                    {
                        break;
                    }

                    for (int nIO = 0; nIO < SRZ_Cpu[nCpu].Module_List[nModule].Read_Out_Value.Count; nIO++)
                    {
                        SRZ_IO _IO = SRZ_Cpu[nCpu].Module_List[nModule].Read_Out_Value[nIO];
                        if (_IO.IO_Name.Equals(strIoName) && _IO.IO_Type.Equals(type))
                        {
                            Rtn = _IO;
                            break;
                        }
                    }
                    if (Rtn != null)
                    {
                        break;
                    }
                }
                if (Rtn != null)
                {
                    break;
                }
            }
            return(Rtn);
        }
 public void SetIO(SRZ_IO _IO)
 {
     m_IO = _IO;
 }