コード例 #1
0
        /// <summary>
        /// Add device1 handling
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddDevice2_Click(object sender, EventArgs e)
        {
            frm_AddDevice fAddDev = new frm_AddDevice();

            fAddDev.ShowDialog();
            try
            {
                if (fAddDev.blnOKEnter == true)
                {
                    //Get device user info.
                    deviceInfo = new NET_DEVICEINFO();
                    int error = 0;
                    //Device2 login:Pay attention to the login ID.
                    pLoginID2 = NETClient.NETLogin(fAddDev.cmbDevIP.Text.ToString(), ushort.Parse(fAddDev.txtDevProt.Text.ToString()), fAddDev.txtName.Text.ToString(), fAddDev.txtPassword.Text.ToString(), out deviceInfo, out error);
                    //Judge if it login success.
                    if (pLoginID2 != 0)
                    {
                        MessageBox.Show("Device2 login successed!", "Warning");
                    }
                    else
                    {
                        MessageBox.Show("Device2 login failed!", "Warning");
                    }
                }
            }
            catch
            {
            }
        }
コード例 #2
0
ファイル: frm_MainC.cs プロジェクト: zhoujiechj/Scan
        /// <summary>
        /// [user login]Press the button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUserLogin_Click(object sender, EventArgs e)
        {
            frm_AddDevice fAddDev = new frm_AddDevice();

            fAddDev.ShowDialog();
            try
            {
                if (fAddDev.blnOKEnter == true)
                {
                    //Device User Info Acquisition
                    deviceInfo = new NET_DEVICEINFO();
                    int error = 0;
                    pLoginID = NETClient.NETLogin(fAddDev.cmbDevIP.Text.ToString(), ushort.Parse(fAddDev.txtDevProt.Text.ToString()), fAddDev.txtName.Text.ToString(), fAddDev.txtPassword.Text.ToString(), out deviceInfo, out error);
                    if (pLoginID != 0)
                    {
                        pPlayBackHandle             = new int[deviceInfo.byChanNum];
                        pRealPlayHandle             = null;
                        btnRealPlay.Text            = StringUtil.ConvertString("Start Real-time Monitoring");
                        btnMultiPlay.Text           = strMultiPlayStart;
                        btnUserLogin.Enabled        = false;
                        btnRealPlay.Enabled         = true;
                        btnPlayBackByTime.Enabled   = true;
                        gpbPlayBackControl.Enabled  = false;
                        btnUserLogout.Enabled       = true;
                        gpbPTZControl.Enabled       = false;
                        btnPlayByRecordFile.Enabled = true;
                        btnMultiPlay.Enabled        = true;
                        cmbChannelSelect.Items.Clear();
                        picRealPlay = picRealPlay0;
                        for (int i = 0; i < deviceInfo.byChanNum; i++)
                        {
                            cmbChannelSelect.Items.Add(i.ToString());
                        }
                    }
                    else
                    {
                        MessageBox.Show(NETClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                        btnUserLogin_Click(null, null);
                    }
                }
            }
            catch
            {
                MessageBox.Show(NETClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                btnUserLogin_Click(null, null);
            }
        }