Пример #1
0
 private void btnAddDev_Click(object sender, EventArgs e)
 {
     frm_AddDevice fAddDev = new frm_AddDevice();
     fAddDev.ShowDialog();
     //DHClient.DHSetShowException(true);
     try
     {
         if (fAddDev.blnOKEnter == true)
         {
             //设备用户信息获得
             deviceInfo = new NET_DEVICEINFO();
             int error = 0;
             //设备用户登录
             pLoginID = DHClient.DHLogin(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)
             {
                 //btnStartRealPlay.Enabled = true;
                 btnStartPlay.Enabled = true;
             }
             else
             {
                 //btnStartRealPlay.Enabled = false;
                 btnStartPlay.Enabled = false;
                 MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
             }
         }
     }
     catch
     {
         //报最后一次操作的错误信息
         MessageBox.Show(DHClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
     }
 }
Пример #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            frm_AddDevice fAddDev = new frm_AddDevice();

            fAddDev.ShowDialog();
            //NETClient.NETSetShowException(true);
            try
            {
                if (fAddDev.blnOKEnter == true)
                {
                    //Device username info get
                    deviceInfo = new NET_DEVICEINFO();
                    int error = 0;
                    //Device user login
                    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)
                    {
                        btnStartRealPlay.Enabled = true;
                        btnLogin.Enabled         = false;
                        btnLogout.Enabled        = true;
                    }
                    else
                    {
                        btnStartRealPlay.Enabled = false;
                        btnLogin.Enabled         = true;
                        btnLogout.Enabled        = false;
                        MessageBox.Show(NETClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
                    }
                }
            }
            catch
            {
                //Error in last operation
                MessageBox.Show(NETClient.LastOperationInfo.ToString(pErrInfoFormatStyle), pMsgTitle);
            }
        }