Пример #1
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            m_bStart       = false;      // the action stops at the beginning
            m_szIP         = "10.0.0.1"; // device IP address
            m_iPort        = 80;         // http port is 80
            m_szAccount    = "root";     // Login account
            m_szPassword   = "******"; // Login password
            m_iPollingTime = 1000;
            m_iSlot        = 0;          //Device localhost default slot is 0

            //m_WISE4000Type = WISEType.WISE4050LAN; // the sample is for WISE-4050/LAN
            //m_WISE4000Type = WISEType.WISE4050; // the sample is for Wise-4050
            m_WISE4000Type = WISEType.WISE4051; // the sample is for Wise-4051
            //m_WISE4000Type = WISEType.WISE4060LAN; // the sample is for Wise-4060/LAN
            // m_WISE4000Type = WISEType.WISE4060; // the sample is for Wise-4060

            txtModule.Text = m_WISE4000Type.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_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;
            IniWISE_DIO();
        }
Пример #2
0
        public Form1()
        {
            InitializeComponent();
            m_iUDiRangeCode = 480;
            m_bStart        = false;         // the action stops at the beginning
            m_szIP          = "192.168.1.1"; // device IP address
            m_iPort         = 80;            // Http port is 80
            m_szAccount     = "root";        // Login account
            m_szPassword    = "******";    // Login password
            m_iSlot         = 0;             //Device localhost default slot is 0
            m_iPollingTime  = 1000;

            m_HttpRequestAI = new AdvantechHttpWebUtility();
            m_HttpRequestAI.ResquestOccurredError += this.OnGetAIHttpRequestError;//Delegate callback for resquest value occurred error
            m_HttpRequestAI.ResquestResponded     += this.OnGetAIData;

            m_HttpRequestDI = new AdvantechHttpWebUtility();
            m_HttpRequestDI.ResquestOccurredError += this.OnGetDIHttpRequestError;//Delegate callback for resquest value occurred error
            m_HttpRequestDI.ResquestResponded     += this.OnGetDIData;


            m_HttpRequestDO = new AdvantechHttpWebUtility();
            m_HttpRequestDO.ResquestOccurredError += this.OnGetDOHttpRequestError;//Delegate callback for resquest value occurred error
            m_HttpRequestDO.ResquestResponded     += this.OnGetDOData;

            //m_WISEType = WISEType.WISE4012E; // the sample is for WISE-4012E
            m_WISEType = WISEType.WISE4012; // the sample is for WISE-4012
            //m_WISEType = WISEType.WISE4010LAN; // the sample is for WISE-4010LAN

            m_UDiChannelList = new List <UiChannelInfo>();
            m_AITextBoxList  = new List <TextBox>();
            m_AICheckboxList = new List <CheckBox>();
            m_DIOTextBoxList = new List <TextBox>();
            m_AIPanelList    = new List <Panel>();
            m_DIOPanelList   = new List <Panel>();
            m_DIOBtnList     = new List <Button>();

            m_DIOBtnList.Add(this.btnCh0); m_DIOBtnList.Add(this.btnCh1);
            m_DIOBtnList.Add(this.btnCh2); m_DIOBtnList.Add(this.btnCh3);

            m_AIPanelList.Add(this.panelAI0); m_AIPanelList.Add(this.panelAI1);
            m_AIPanelList.Add(this.panelAI2); m_AIPanelList.Add(this.panelAI3);

            m_DIOPanelList.Add(this.panelDIO0); m_DIOPanelList.Add(this.panelDIO1);
            m_DIOPanelList.Add(this.panelDIO2); m_DIOPanelList.Add(this.panelDIO3);

            m_AITextBoxList.Add(this.txtAIValue0); m_AITextBoxList.Add(this.txtAIValue1);
            m_AITextBoxList.Add(this.txtAIValue2); m_AITextBoxList.Add(this.txtAIValue3);

            m_AICheckboxList.Add(this.chkboxCh0); m_AICheckboxList.Add(this.chkboxCh1);
            m_AICheckboxList.Add(this.chkboxCh2); m_AICheckboxList.Add(this.chkboxCh3);

            m_DIOTextBoxList.Add(this.txtDIOValue0); m_DIOTextBoxList.Add(this.txtDIOValue1);
            m_DIOTextBoxList.Add(this.txtDIOValue2); m_DIOTextBoxList.Add(this.txtDIOValue3);

            txtModule.Text = m_WISEType.ToString();

            // arrange channel text box

            if (m_WISEType == WISEType.WISE4012)
            {
                Initial_WISE_4012();
            }
            else if (m_WISEType == WISEType.WISE4012E)
            {
                Initial_WISE_4012E();
            }
            else
            {
                Initial_WISE_4010LAN();
            }
        }