コード例 #1
0
        private void button_Click(object sender, EventArgs e)
        {
            if (sendData.Text == "")
            {
                MessageBox.Show("Please input a value!", "Alert", MessageBoxButtons.OK);
                return;
            }
            if (UserControlBtnClicked != null)
            {
                UserControlBtnClicked(this, new EventArgs());
            }

            bool isSuccess = dataSend.SendControlData(sendData.Text, this.RelatedPort, this.PortBind, this.BoardNumber);
        }
コード例 #2
0
        private void LDDSonoff_Click(object sender, EventArgs e)
        {
            string currentName = "";
            string RelatedPort = "";
            // string DeviceType = "";
            string PortData = "";
            string PortBind = "";

            string BoardNumber = this.BoardNumber;

            DataBus.DataSend.CDataSend dataSend;
            dataSend = new DataBus.DataSend.CDataSend();

            Library.Common.ButtonCheck comp = (Library.Common.ButtonCheck)sender;
            currentName = "Dechp_" + comp.Name;
            dataPT.GetBoardSendPortByNameBdnum(currentName, BoardNumber, ref RelatedPort, ref PortData, ref PortBind);
            dataSend.SendControlData(this.DeviceRun.currentState, RelatedPort, PortBind, this.BoardNumber);
        }
コード例 #3
0
        private void sendButtonClick(object sender, EventArgs e)
        {
            Type t = sender.GetType();

            Library.SendButton tb = (Library.SendButton)sender;
            DataBus.DataAccess.CData_PointTable dataPT = new DataBus.DataAccess.CData_PointTable();
            DataBus.DataSend.CDataSend          dataSend;
            dataSend = new DataBus.DataSend.CDataSend();

            string RelatedPort = "";
            string PortData    = "";
            string PortBind    = "";
            string DeviceType  = "";


            PropertyInfo m_BoardNumber = t.GetProperty("BoardNumber");
            PropertyInfo m_RelatedPort = t.GetProperty("RelatedPort");
            PropertyInfo m_PortData    = t.GetProperty("PortData");
            PropertyInfo m_PortBind    = t.GetProperty("PortBind");
            PropertyInfo m_DeviceName  = t.GetProperty("DeviceName");
            PropertyInfo m_DeviceType  = t.GetProperty("RelatedDeviceType");
            string       currentName   = "Denchp_" + t.Name.ToString();

            dataPT.GetBoardPortByNameBdnum(currentName, BoardNumber, ref RelatedPort, ref DeviceType);
            dataPT.GetBoardSendPortByNameBdnum(currentName, BoardNumber, ref RelatedPort, ref PortData, ref PortBind);
            bool isSuccess = dataSend.SendControlData(tb.sendData.Text, RelatedPort, PortBind, this.BoardNumber);

            if (isSuccess == true)
            {
                System.Windows.Forms.MessageBox.Show("Success!");
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Failed!");
            }

            m_BoardNumber.SetValue(tb, BoardNumber, null);
            m_RelatedPort.SetValue(tb, RelatedPort, null);
            //m_DeviceType.SetValue(tb, currentType, null);
            m_DeviceName.SetValue(tb, currentName, null);
            m_PortData.SetValue(tb, PortData, null);
            m_PortBind.SetValue(tb, PortBind, null);
        }