private void PresetPatrolsDeleteBtn_Click(object sender, EventArgs e) { bool iRet = handleCruise(NETDEV_PTZ_CRUISECMD_E.NETDEV_PTZ_DEL_CRUISE); if (true != iRet) { return; } if ((m_curSelectedTreeChannelIndex < 0) || (m_curSelectedTreeDeviceIndex < 0)) { MessageBox.Show("Please select a device", "warning"); return; } if (PresetPatrolsIDCobBox.SelectedIndex >= 0) { GeneralDef.ChannelInfo channelInfo = m_deviceInfoList[m_curSelectedTreeDeviceIndex].m_channelInfoList[m_curSelectedTreeChannelIndex]; channelInfo.m_CruiseInfoList.astCruiseInfo[PresetPatrolsIDCobBox.SelectedIndex].astCruisePoint = new NETDEV_CRUISE_POINT_S[NETDEVSDK.NETDEV_MAX_CRUISEPOINT_NUM]; channelInfo.m_CruiseInfoList.astCruiseInfo[PresetPatrolsIDCobBox.SelectedIndex].dwCuriseID = 0; channelInfo.m_CruiseInfoList.astCruiseInfo[PresetPatrolsIDCobBox.SelectedIndex].dwSize = 0; channelInfo.m_CruiseInfoList.astCruiseInfo[PresetPatrolsIDCobBox.SelectedIndex].szCuriseName = ""; PresetPatrolsIDCobBox.SelectedIndex = 0; PresetPatrolsIDCobBox_SelectedIndexChanged(null, null); } }
private void PresetPatrolsIDCobBox_SelectedIndexChanged(object sender, EventArgs e) { int nSplit = PresetPatrolsIDCobBox.SelectedIndex; if ((m_iChannelID <= 0) || (m_curSelectedTreeChannelIndex < 0)) { MessageBox.Show("Please select device", "warning"); return; } this.cruiseListView.Items.Clear(); GeneralDef.ChannelInfo channelInfo = m_deviceInfoList[m_curSelectedTreeDeviceIndex].m_channelInfoList[m_curSelectedTreeChannelIndex]; if (channelInfo.m_CruiseInfoList.dwSize <= 0) { this.PresetPatrolsNameText.Text = ""; } for (Int32 i = 0; i < channelInfo.m_CruiseInfoList.dwSize; i++) { if (channelInfo.m_CruiseInfoList.astCruiseInfo[i].dwCuriseID == nSplit + 1) { NETDEV_CRUISE_INFO_S strCruiseInfo = channelInfo.m_CruiseInfoList.astCruiseInfo[i]; this.PresetPatrolsNameText.Text = strCruiseInfo.szCuriseName; for (Int32 j = 0; j < strCruiseInfo.dwSize; j++) { ListViewItem item = new ListViewItem(Convert.ToString(strCruiseInfo.astCruisePoint[j].dwPresetID)); item.SubItems.Add(Convert.ToString(strCruiseInfo.astCruisePoint[j].dwStayTime / 1000)); item.SubItems.Add(Convert.ToString(strCruiseInfo.astCruisePoint[j].dwSpeed)); cruiseListView.Items.Add(item); } break; } else { this.PresetPatrolsNameText.Text = ""; } } return; }
bool handleCruise(NETDEV_PTZ_CRUISECMD_E eCruisecmd) { if ((m_curSelectedTreeChannelIndex < 0) || (m_curSelectedTreeDeviceIndex < 0)) { MessageBox.Show("Please select device", "warning"); return(false); } if (PresetPatrolsIDCobBox.SelectedIndex >= 0) { GeneralDef.ChannelInfo channelInfo = m_deviceInfoList[m_curSelectedTreeDeviceIndex].m_channelInfoList[m_curSelectedTreeChannelIndex]; NETDEV_CRUISE_INFO_S strCruiseInfo = channelInfo.m_CruiseInfoList.astCruiseInfo[PresetPatrolsIDCobBox.SelectedIndex]; int ret = NETDEVSDK.NETDEV_PTZCruise_Other(m_lpDevHandle, m_iChannelID, (int)eCruisecmd, ref strCruiseInfo); if (NETDEVSDK.TRUE == ret) { return(true); } } return(false); }
private void PresetPatrolsSaveBtn_Click(object sender, EventArgs e) { String StrCruiseName = PresetPatrolsNameText.Text; if ("" == StrCruiseName) { MessageBox.Show("Please entry cruise name", "warning"); return; } if ((m_curSelectedTreeChannelIndex < 0) || (m_curSelectedTreeDeviceIndex < 0)) { MessageBox.Show("Please select Device", "warning"); return; } if (PresetPatrolsIDCobBox.SelectedIndex >= 0) { GeneralDef.ChannelInfo channelInfo = m_deviceInfoList[m_curSelectedTreeDeviceIndex].m_channelInfoList[m_curSelectedTreeChannelIndex]; NETDEV_CRUISE_INFO_S strCruiseInfo = channelInfo.m_CruiseInfoList.astCruiseInfo[PresetPatrolsIDCobBox.SelectedIndex]; strCruiseInfo.dwCuriseID = PresetPatrolsIDCobBox.SelectedIndex + 1; strCruiseInfo.szCuriseName = StrCruiseName; Int32 dwSize = strCruiseInfo.dwSize; strCruiseInfo.dwSize = cruiseListView.Items.Count; if (strCruiseInfo.dwSize <= 0) { MessageBox.Show("Please add one item", "warning"); return; } for (Int32 i = 0; i < strCruiseInfo.dwSize; i++) { strCruiseInfo.astCruisePoint[i].dwPresetID = Convert.ToInt32(cruiseListView.Items[i].SubItems[0].Text); strCruiseInfo.astCruisePoint[i].dwStayTime = Convert.ToInt32(cruiseListView.Items[i].SubItems[1].Text) * 1000; strCruiseInfo.astCruisePoint[i].dwSpeed = Convert.ToInt32(cruiseListView.Items[i].SubItems[2].Text); } if (dwSize > 0) { int iRet = NETDEVSDK.NETDEV_PTZCruise_Other(m_lpDevHandle, m_iChannelID, (int)NETDEV_PTZ_CRUISECMD_E.NETDEV_PTZ_MODIFY_CRUISE, ref strCruiseInfo); if (NETDEVSDK.TRUE != iRet) { m_oNetDemo.showFailLogInfo(m_deviceInfoList[m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_curSelectedTreeChannelIndex + 1), "Modify cruise", NETDEVSDK.NETDEV_GetLastError()); } else { m_oNetDemo.showSuccessLogInfo(m_deviceInfoList[m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_curSelectedTreeChannelIndex + 1), "Modify cruise"); } } else { int iRet = NETDEVSDK.NETDEV_PTZCruise_Other(m_lpDevHandle, m_iChannelID, (int)NETDEV_PTZ_CRUISECMD_E.NETDEV_PTZ_ADD_CRUISE, ref strCruiseInfo); if (NETDEVSDK.TRUE != iRet) { m_oNetDemo.showFailLogInfo(m_deviceInfoList[m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_curSelectedTreeChannelIndex + 1), "Add cruise", NETDEVSDK.NETDEV_GetLastError()); } else { m_oNetDemo.showSuccessLogInfo(m_deviceInfoList[m_curSelectedTreeDeviceIndex].m_ip + " chl:" + (m_curSelectedTreeChannelIndex + 1), "Add cruise"); } } presetPatrolsRefreshBtn_Click(null, null); } return; }