private void Update_UI_IPAndID() { cbVideoType.SelectedIndex = 0; cbFileType.SelectedIndex = 0; cbBitStreamType.SelectedIndex = 0; cbQueryMode.SelectedIndex = 0; DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); dtStartTimeFile.Value = dt; dtEndTimeFile.Value = DateTime.Now; dtStartTimeTime.Value = dt; dtEndTimeTime.Value = DateTime.Now; int iChannelNum = 0; NVSSDK.NetClient_GetChannelNum(m_iLogonID, ref iChannelNum); cbPassNOFile.Items.Clear(); cbPassNOFile.Items.Add("All"); for (int i = 0; i < iChannelNum; i++) { cbPassNOFile.Items.Add(i.ToString()); } if (cbPassNOFile.Items.Count > 0) { cbPassNOFile.SelectedIndex = 0; } int iAlarmChannelNo = 0, iAlarmOutPortNum = 0; int iRet = NVSSDK.NetClient_GetAlarmPortNum(m_iLogonID, ref iAlarmChannelNo, ref iAlarmOutPortNum); cbAlarmType.Items.Clear(); for (int i = 0; i < iAlarmChannelNo; i++) { cbAlarmType.Items.Add(i.ToString()); } if (cbAlarmType.Items.Count > 0) { cbAlarmType.SelectedIndex = 0; } cbPassNOTime.Items.Clear(); cbPassNOTime.Items.Add("All"); for (int i = 0; i < iChannelNum; i++) { cbPassNOTime.Items.Add(i.ToString()); } if (cbPassNOTime.Items.Count > 0) { cbPassNOTime.SelectedIndex = 0; } }
private void btnPlayTime_Click(object sender, EventArgs e) { if (dtStartTimeTime.Value >= dtEndTimeTime.Value) { MessageBox.Show("Start Time > End Time!"); return; } if (m_iLogonID < 0) { return; } m_StartTime.m_iYear = Convert.ToUInt16(dtStartTimeTime.Value.Year); m_StartTime.m_iMonth = Convert.ToUInt16(dtStartTimeTime.Value.Month); m_StartTime.m_iDay = Convert.ToUInt16(dtStartTimeTime.Value.Day); m_StartTime.m_iHour = Convert.ToUInt16(dtStartTimeTime.Value.Hour); m_StartTime.m_iMinute = Convert.ToUInt16(dtStartTimeTime.Value.Minute); m_StartTime.m_iSecond = Convert.ToUInt16(dtStartTimeTime.Value.Second); m_EndTime.m_iYear = Convert.ToUInt16(dtEndTimeTime.Value.Year); m_EndTime.m_iMonth = Convert.ToUInt16(dtEndTimeTime.Value.Month); m_EndTime.m_iDay = Convert.ToUInt16(dtEndTimeTime.Value.Day); m_EndTime.m_iHour = Convert.ToUInt16(dtEndTimeTime.Value.Hour); m_EndTime.m_iMinute = Convert.ToUInt16(dtEndTimeTime.Value.Minute); m_EndTime.m_iSecond = Convert.ToUInt16(dtEndTimeTime.Value.Second); int iChannelNo = cbPassNOTime.SelectedIndex; int iStreamNo = cbBitStreamType.SelectedIndex; int iChannelNum = 0; NVSSDK.NetClient_GetChannelNum(m_ClientInfo.m_iServerID, ref iChannelNum); int iRealChannel = iStreamNo * iChannelNum + iChannelNo; //m_PlayPage.SetDownloadParam(m_iLogonID, iRealChannel/*iChannelNo*/, &begintime, &endtime); //m_PlayPage.DoModal(); int irt = -1; irt = PLAYSDK.TC_CreateSystem(IntPtr.Zero); if (irt < 0) { MessageBox.Show("TC_CreateSystem failed!"); } PlayForm frmPlay = new PlayForm(m_ClientInfo, iRealChannel, m_StartTime, m_EndTime, this); frmPlay.ShowDialog(); }
private void btnDownloadTime_Click(object sender, EventArgs e) { if (dtStartTimeTime.Value >= dtEndTimeTime.Value) { MessageBox.Show("Start Time > End Time!"); return; } m_StartTime.m_iYear = Convert.ToUInt16(dtStartTimeTime.Value.Year); m_StartTime.m_iMonth = Convert.ToUInt16(dtStartTimeTime.Value.Month); m_StartTime.m_iDay = Convert.ToUInt16(dtStartTimeTime.Value.Day); m_StartTime.m_iHour = Convert.ToUInt16(dtStartTimeTime.Value.Hour); m_StartTime.m_iMinute = Convert.ToUInt16(dtStartTimeTime.Value.Minute); m_StartTime.m_iSecond = Convert.ToUInt16(dtStartTimeTime.Value.Second); m_EndTime.m_iYear = Convert.ToUInt16(dtEndTimeTime.Value.Year); m_EndTime.m_iMonth = Convert.ToUInt16(dtEndTimeTime.Value.Month); m_EndTime.m_iDay = Convert.ToUInt16(dtEndTimeTime.Value.Day); m_EndTime.m_iHour = Convert.ToUInt16(dtEndTimeTime.Value.Hour); m_EndTime.m_iMinute = Convert.ToUInt16(dtEndTimeTime.Value.Minute); m_EndTime.m_iSecond = Convert.ToUInt16(dtEndTimeTime.Value.Second); string localfile = "Demo_Download" + m_StartTime.m_iYear.ToString() + m_StartTime.m_iMonth.ToString() + m_StartTime.m_iDay.ToString() + m_StartTime.m_iHour.ToString() + m_StartTime.m_iMinute.ToString() + m_StartTime.m_iSecond.ToString() + "-" + m_EndTime.m_iYear.ToString() + m_EndTime.m_iMonth.ToString() + m_EndTime.m_iDay.ToString() + m_EndTime.m_iHour.ToString() + m_EndTime.m_iMinute.ToString() + m_EndTime.m_iSecond.ToString() + ".sdv"; if (!System.IO.Directory.Exists("E:\\netclientdemo_download")) { System.IO.Directory.CreateDirectory("E:\\netclientdemo_download"); } string path = "E:\\netclientdemo_download\\" + localfile; int iChannelNo = cbPassNOTime.SelectedIndex; int iStreamNo = cbBitStreamType.SelectedIndex; int iChannelNum = 0; NVSSDK.NetClient_GetChannelNum(m_ClientInfo.m_iServerID, ref iChannelNum); int iRealChannel = iStreamNo * iChannelNum + iChannelNo; int iRet = NVSSDK.NetClient_NetFileDownloadByTimeSpanEx(ref m_ulConnID, m_ClientInfo.m_iServerID, path, iRealChannel, ref m_StartTime, ref m_EndTime, 0, -1, 16); if (iRet < 0) { if (m_ulConnID != -1) { NVSSDK.NetClient_NetFileStopDownloadFile(m_ulConnID); //m_ulConnID = 0; } return; } else { iRet = NVSSDK.NetClient_NetFileDownloadByTimeSpanEx(ref m_ulConnID, m_ClientInfo.m_iServerID, path, iRealChannel, ref m_StartTime, ref m_EndTime, 1, -1, 16); } pbDownloadTime.Value = 0; timerTime.Enabled = true; }