/// <summary> /// 用户登录按钮按下处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //private void btnUserLogin_Click(object sender, EventArgs e) //{ // string strBtn = btnUserLogin.Text; // if (strBtn == Utility.StringUtil.ConvertString("设备用户登录")) // { // frm_AddDevice fLogin = new frm_AddDevice(); // fLogin.ShowDialog(); // if (fLogin.blnOKEnter == true) // { // //设备用户信息获得 // deviceInfo = new NET_DEVICEINFO(); // int error = 0; // //设备用户登录 // pLoginID = DHClient.DHLogin(fLogin.cmbDevIP.Text.ToString(), ushort.Parse(fLogin.txtDevProt.Text.ToString()), fLogin.txtName.Text.ToString(), fLogin.txtPassword.Text.ToString(), out deviceInfo, out error); // if (pLoginID != 0) // { // strUserName = fLogin.txtDevName.Text; // btnUserLogin.BackColor = Color.Yellow; // btnUserLogin.Text = StringUtil.ConvertString("设备用户注销"); // grbMain.Enabled = true; // } // else // { // //报最后一次操作的错误信息 // MessageUtil.ShowMsgBox(StringUtil.ConvertString(DHClient.LastOperationInfo.errMessage, "ErrorMessage"), // StringUtil.ConvertString(pMsgTitle)); // } // } // } // else if (strBtn == Utility.StringUtil.ConvertString("设备用户注销")) // { // bool result = DHClient.DHLogout(pLoginID); // if (result == false) // { // //报最后一次操作的错误信息 // MessageUtil.ShowMsgBox(StringUtil.ConvertString(DHClient.LastOperationInfo.errMessage, "ErrorMessage"), // StringUtil.ConvertString(pMsgTitle)); // } // btnUserLogin.BackColor = Color.Transparent; // btnUserLogin.Text = StringUtil.ConvertString("设备用户登录"); // grbMain.Enabled = false; // Utility.StringUtil.InitControlText(this); // } //} /// <summary> /// 按文件下载按钮按下 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDownLoad1_Click(object sender, EventArgs e) { frm_PlayBackByFileSet fpf = new frm_PlayBackByFileSet(); int pPlayBackChannelID = 0; NET_RECORDFILE_INFO fileInfo; fpf.gLoginID = pLoginID; fpf.txtDevName.Text = strUserName; fpf.cmbChannelSelect.Items.Clear(); //for (int i = 1; i <= deviceInfo.byChanNum; i++) for (int i = 0; i < 5; i++) { fpf.cmbChannelSelect.Items.Add(i); } fpf.ShowDialog(this); if (fpf.blnOKEnter == true) { pPlayBackChannelID = int.Parse(fpf.txtChannelID.Text.ToString()); fileInfo = fpf.gFileInfo; //**********按文件下载********** if (txtDirPath1.Text.Trim().Length > 0 && txtFileName1.Text.Trim().Length > 0) { string strFileName = txtFileName1.Text; strFileName = strFileName.ToLower(); if (!strFileName.EndsWith(".dav")) { strFileName += ".dav"; } pDownloadHandleByFile = DHClient.DHDownloadByRecordFile(pLoginID, fileInfo, txtDirPath1.Text + @"\" + strFileName, downLoadFun, IntPtr.Zero); if (pDownloadHandleByFile != 0) { btnDownLoad1.Tag = "下载中"; pDownloadHandle = pDownloadHandleByFile; btnDownLoad2.Enabled = false; btnDownLoad1.Enabled = false; btnStopDownLoad1.Enabled = true; MessageUtil.ShowMsgBox(StringUtil.ConvertString("开始下载!"), StringUtil.ConvertString(pMsgTitle)); } else { MessageUtil.ShowMsgBox(StringUtil.ConvertString(DHClient.LastOperationInfo.errMessage, "ErrorMessage"), StringUtil.ConvertString(pMsgTitle)); } } else { MessageUtil.ShowMsgBox(StringUtil.ConvertString("请输入有效的录像保存目录和文件名!"), StringUtil.ConvertString(pMsgTitle)); } //****************************** } }