示例#1
0
        private void OnGetDOData(string rawData)
        {
            var dateObj = AdvantechHttpWebUtility.ParserJsonToObj <DOSlotValueData>(rawData);

            UpdateDOUIStatus(dateObj);
            InvokeReadStatus();
        }
示例#2
0
        private void OnGetDIData(string rawData)
        {
            var dateObj = AdvantechHttpWebUtility.ParserJsonToObj <DISlotValueData>(rawData);

            UpdateDIUIStatus(dateObj);
            GetDOValue();
        }
示例#3
0
        private void btnCh_Click(int i_iCh, TextBox txtBox)
        {
            DOSetValueData doData = new DOSetValueData()
            {
                Val = (txtBox.Text == "1") ? 0 : 1
            };                                                                                   // was ON, now set to OFF };
            int iChannel = i_iCh - m_iDiTotal;
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string sz_Jsonify = serializer.Serialize(doData);

            try
            {
                AdvantechHttpWebUtility httpRequest = new AdvantechHttpWebUtility();
                httpRequest.SendPATCHRequest(m_szAccount, m_szPassword, GetURL(m_szIP, m_iPort, WISE_RESTFUL_URI.do_value + "/slot_" + m_iSlot + "/ch_" + iChannel), sz_Jsonify);
            }
            catch
            {
                MessageBox.Show("Set digital output failed!", "Error");
            }
            finally
            {
                System.GC.Collect();
            }
        }
示例#4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            txtModule.Text = m_Adam3600Type.ToString();
            txtSlot.Text   = "Slot " + m_iSlot.ToString();
            m_textBoxList  = new List <TextBox>();
            m_textBoxList.Add(txtCh0); m_textBoxList.Add(txtCh1);
            m_textBoxList.Add(txtCh2); m_textBoxList.Add(txtCh3);
            m_textBoxList.Add(txtCh4); m_textBoxList.Add(txtCh5);
            m_textBoxList.Add(txtCh6); m_textBoxList.Add(txtCh7);
            m_textBoxList.Add(txtCh8); m_textBoxList.Add(txtCh9);
            m_textBoxList.Add(txtCh10); m_textBoxList.Add(txtCh11);
            m_textBoxList.Add(txtCh12); m_textBoxList.Add(txtCh13);
            m_textBoxList.Add(txtCh14); m_textBoxList.Add(txtCh15);
            m_textBoxList.Add(txtCh16); m_textBoxList.Add(txtCh17);
            m_textBoxList.Add(txtCh18); m_textBoxList.Add(txtCh19);
            m_textBoxList.Add(txtCh20); m_textBoxList.Add(txtCh21);
            m_textBoxList.Add(txtCh22); m_textBoxList.Add(txtCh23);

            m_DIOPanelList = new List <Panel>();
            m_DIOPanelList.Add(panelCh0); m_DIOPanelList.Add(panelCh1);
            m_DIOPanelList.Add(panelCh2); m_DIOPanelList.Add(panelCh3);
            m_DIOPanelList.Add(panelCh4); m_DIOPanelList.Add(panelCh5);
            m_DIOPanelList.Add(panelCh6); m_DIOPanelList.Add(panelCh7);
            m_DIOPanelList.Add(panelCh8); m_DIOPanelList.Add(panelCh9);
            m_DIOPanelList.Add(panelCh10); m_DIOPanelList.Add(panelCh11);
            m_DIOPanelList.Add(panelCh12); m_DIOPanelList.Add(panelCh13);
            m_DIOPanelList.Add(panelCh14); m_DIOPanelList.Add(panelCh15);
            m_DIOPanelList.Add(panelCh16); m_DIOPanelList.Add(panelCh17);
            m_DIOPanelList.Add(panelCh18); m_DIOPanelList.Add(panelCh19);
            m_DIOPanelList.Add(panelCh20); m_DIOPanelList.Add(panelCh21);
            m_DIOPanelList.Add(panelCh22); m_DIOPanelList.Add(panelCh23);

            m_DIOBtnList = new List <Button>();
            m_DIOBtnList.Add(btnCh0); m_DIOBtnList.Add(btnCh1);
            m_DIOBtnList.Add(btnCh2); m_DIOBtnList.Add(btnCh3);
            m_DIOBtnList.Add(btnCh4); m_DIOBtnList.Add(btnCh5);
            m_DIOBtnList.Add(btnCh6); m_DIOBtnList.Add(btnCh7);
            m_DIOBtnList.Add(btnCh8); m_DIOBtnList.Add(btnCh9);
            m_DIOBtnList.Add(btnCh10); m_DIOBtnList.Add(btnCh11);
            m_DIOBtnList.Add(btnCh12); m_DIOBtnList.Add(btnCh13);
            m_DIOBtnList.Add(btnCh14); m_DIOBtnList.Add(btnCh15);
            m_DIOBtnList.Add(btnCh16); m_DIOBtnList.Add(btnCh17);
            m_DIOBtnList.Add(btnCh18); m_DIOBtnList.Add(btnCh19);
            m_DIOBtnList.Add(btnCh20); m_DIOBtnList.Add(btnCh21);
            m_DIOBtnList.Add(btnCh22); m_DIOBtnList.Add(btnCh23);

            m_HttpRequestDI = new AdvantechHttpWebUtility();
            m_HttpRequestDI.ResquestOccurredError += this.OnGetDIHttpRequestError;
            m_HttpRequestDI.ResquestResponded     += this.OnGetDIData;
            m_HttpRequestDO = new AdvantechHttpWebUtility();
            m_HttpRequestDO.ResquestOccurredError += this.OnGetDOHttpRequestError;
            m_HttpRequestDO.ResquestResponded     += this.OnGetDOData;
            if (m_Adam3600Type == ADAM3600Type.ADAM3600)
            {
                Initial_ADAM_3600();
            }
            else if (m_Adam3600Type == ADAM3600Type.ADAM3651)
            {
                Initial_ADAM_3651();
            }
            else
            {
                Initial_ADAM_3656();
            }
        }