/// <summary> /// initialize the images' loading /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); NETClient.NETInit(disConnect, IntPtr.Zero); downLoadFun = new fDownLoadPosCallBack(DownLoadPosFun); timeDownLoadFun = new fTimeDownLoadPosCallBack(TimeDownLoadPosFun); //timeDownLoadFun = new fDownLoadPosCallBack(TimeDownLoadPosFun); setProgressPos = new fSetProgressPos(DownloadProgress); grbMain.Enabled = false; btnDownLoad1.Tag = ""; btnDownLoad2.Tag = ""; StringUtil.InitControlText(this); }
/// <summary> /// 设备初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void DeviceInititalize() { m_SnapRevCallBack = new fSnapRevCallBack(SnapRevCallBack); try { //远程抓取监控回调 NETClient.Init(m_DisConnectCallBack, IntPtr.Zero, null); NETClient.SetAutoReconnect(m_ReConnectCallBack, IntPtr.Zero); NETClient.SetSnapRevCallBack(m_SnapRevCallBack, IntPtr.Zero); //下载视频回调 m_DownloadPosCallBack = new fTimeDownLoadPosCallBack(DownLoadPosCallBack); fDownLoadDataCallBack = new fDataCallBack(DataCallBack); } catch (Exception ex) { throw ex; } }
/// <summary> /// 画面加载初期化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); downLoadFun = new fDownLoadPosCallBack(DownLoadPosFun); timeDownLoadFun = new fTimeDownLoadPosCallBack(TimeDownLoadPosFun); //timeDownLoadFun = new fDownLoadPosCallBack(TimeDownLoadPosFun); setProgressPos = new fSetProgressPos(DownloadProgress); grbMain.Enabled = true; btnDownLoad1.Tag = ""; btnDownLoad2.Tag = ""; StringUtil.InitControlText(this); this.FormClosing += new FormClosingEventHandler((a, b) => { System.Diagnostics.Process.GetProcessesByName("SDKDownLoadFileDemo.exe"); }); }
private void DownloadProgress(int lPlayHandle, UInt32 dwTotalSize, UInt32 dwDownLoadSize) { if (dwDownLoadSize != 0xFFFFFFFF && dwDownLoadSize != 0xFFFFFFFE && dwDownLoadSize <= dwTotalSize) { int iPos = (int)((dwDownLoadSize * 100) / dwTotalSize); Console.WriteLine(iPos.ToString() + " " + dwDownLoadSize.ToString() + "/" + dwTotalSize.ToString()); psbMain.Value = iPos; } else { if (0xFFFFFFFF == dwDownLoadSize) { //btnDownLoad2.Tag = ""; psbMain.Value = 0; MessageUtil.ShowMsgBox(StringUtil.ConvertString("下载结束!")); //btnDownLoad1.Enabled = true; //btnDownLoad2.Enabled = true; psbMain.Value = 0; //DHClient.DHStopDownload(lPlayHandle); } else if (0xFFFFFFFE == dwDownLoadSize) { //btnDownLoad2.Tag = ""; psbMain.Value = 0; MessageUtil.ShowMsgBox(StringUtil.ConvertString("磁盘空间不足!")); //btnDownLoad1.Enabled = true; //btnDownLoad2.Enabled = true; psbMain.Value = 0; //setProgressPos = new fSetProgressPos(DownloadProgress); setProgressPos -= new fSetProgressPos(DownloadProgress); //this.btnOK.Text = "重试"; downLoadFun -= new fDownLoadPosCallBack(DownLoadPosFun); timeDownLoadFun -= new fTimeDownLoadPosCallBack(TimeDownLoadPosFun); this.Close(); //DHClient.DHStopDownload(lPlayHandle); } } }
private void frm_DownLoadVadioByTime_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); downLoadFun = new fDownLoadPosCallBack(DownLoadPosFun); timeDownLoadFun = new fTimeDownLoadPosCallBack(TimeDownLoadPosFun); setProgressPos = new fSetProgressPos(DownloadProgress); for (int i = 0; i < 5; i++) { cmbChannelSelect.Items.Add(i.ToString()); } //cmbChannelSelect.Items.Add("全部"); cmbChannelSelect.SelectedIndex = 0; dtpStart.Value = DateTime.Now.AddDays(-7); txtDirPath2.Text = this.DownLoadPath; txtFileName2.Text = this.DownLoadFileName; Utility.StringUtil.InitControlText(this); }
/// <summary> /// 画面加载初期化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, EventArgs e) { disConnect = new fDisConnect(DisConnectEvent); DHClient.DHInit(disConnect, IntPtr.Zero); downLoadFun = new fDownLoadPosCallBack(DownLoadPosFun); timeDownLoadFun = new fTimeDownLoadPosCallBack(TimeDownLoadPosFun); //timeDownLoadFun = new fDownLoadPosCallBack(TimeDownLoadPosFun); setProgressPos = new fSetProgressPos(DownloadProgress); grbMain.Enabled = false; btnDownLoad1.Tag = ""; btnDownLoad2.Tag = ""; StringUtil.InitControlText(this); }
public static extern IntPtr CLIENT_DownloadByTimeEx(IntPtr lLoginID, int nChannelId, int nRecordFileType, ref NET_TIME tmStart, ref NET_TIME tmEnd, string sSavedFileName, fTimeDownLoadPosCallBack cbTimeDownLoadPos, IntPtr dwUserData, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser, IntPtr pReserved);
private static extern int CLIENT_DownloadByTime(int lLoginID, int nChannelId, int nRecordFileType, ref NET_TIME tmStart, ref NET_TIME tmEnd, string sSavedFileName, fTimeDownLoadPosCallBack cbTimeDownLoadPos, IntPtr dwUserData);
/// <summary> /// Chronological Download,Specified channel direct input start time and end time to put video download /// </summary> /// <param name="lLoginID">CLIENT_Loginreturn value</param> /// <param name="nChannelId">Image channel number,Starting from 0</param> /// <param name="nRecordFileType">Retention</param> /// <param name="tmStart">Start time</param> /// <param name="tmEnd">End Time</param> /// <param name="sSavedFileName">To save the video file name,Full path</param> /// <param name="cbTimeDownLoadPos">Download progress callback function</param> /// <param name="dwUserData">Download progress callback user-defined data</param> /// <returns>Successful return downloadsID,Failure to return0</returns> public static int NETDownloadByTime(int lLoginID, int nChannelId, int nRecordFileType, DateTime tmStart, DateTime tmEnd, string sSavedFileName, fTimeDownLoadPosCallBack cbTimeDownLoadPos, IntPtr dwUserData) { int intReturnValue = 0; NET_TIME ntStart = ToNetTime(tmStart); NET_TIME ntEnd = ToNetTime(tmEnd); intReturnValue = CLIENT_DownloadByTime(lLoginID, nChannelId, nRecordFileType, ref ntStart, ref ntEnd, sSavedFileName, cbTimeDownLoadPos, dwUserData); NETThrowLastError(); return intReturnValue; }
private static extern int CLIENT_PlayBackByTimeEx(int lLoginID,int nChannelID, ref NET_TIME lpStartTime, ref NET_TIME lpStopTime, IntPtr hWnd, fTimeDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser);
private static extern int CLIENT_PlayBackByTime(int lLoginID, int nChannelID, ref NET_TIME lpStartTime, ref NET_TIME lpStopTime, IntPtr hWnd, fTimeDownLoadPosCallBack cbDownLoadPos, IntPtr dwUserData);
/// <summary> /// 网络按时间回放 /// </summary> /// <param name="lLoginID">设备用户登录句柄</param> /// <param name="nChannelID">通道ID</param> /// <param name="tmStart">录像开始时间</param> /// <param name="tmEnd">录像结束时间</param> /// <param name="hWnd">录像回放容器句柄</param> /// <param name="cbDownLoadPos">进度回调函数</param> /// <param name="dwPosUser">用户自定义数据[进度]</param> /// <param name="cbData">数据回调函数</param> /// <param name="dwDataUser">用户自定义数据[进度]</param> /// <returns>成功返回网络回放ID,失败返回0</returns> public static int DHPlayBackByTime(int lLoginID, int nChannelID, DateTime tmStart, DateTime tmEnd, IntPtr hWnd, fTimeDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser,fDataCallBack cbData,IntPtr dwDataUser) { try { int returnValue = 0; NET_TIME timeStart = ToNetTime(tmStart); NET_TIME timeEnd = ToNetTime(tmEnd); returnValue = CLIENT_PlayBackByTimeEx(lLoginID, nChannelID, ref timeStart, ref timeEnd, hWnd, cbDownLoadPos, dwPosUser, cbData, dwDataUser); DHThrowLastError(returnValue); return returnValue; } catch (Exception e) { DHThrowLastError(e); return 0; } }