/// <summary> /// 保存巡航方案修改的信息 /// </summary> public void SaveVideoPatrolPlan() { Logger.Instance.WriteLog("保存巡航方案修改的信息"); string idList = ""; string timeList = ""; foreach (GameObject go in SelectedMornitorDictionary.Keys) { idList += MornitorInfos[SelectedMornitorDictionary[go]].Id + "|"; timeList += go.transform.FindChild("Time").GetComponent <UIInput>().value + "|"; } int idListLength = idList.Length; int timeListLength = timeList.Length; if (idList.Length > 0) { timeList = timeList.Remove(timeListLength - 1); idList = idList.Remove(idListLength - 1); } string planName = PlanName.GetComponentInChildren <UIInput> ().value; int PlaninfosIndex = FindVideoPatrolPlanInfoIndex(planName); VideoPatrolPlanInfo info = VideoPatrolPlanInfos[PlaninfosIndex]; info.MonitorList = idList; info.PlayTimeList = timeList; VideoPatrolPlanEditMapPanel.GetComponent <DrawMap> ().Draw(planName, idList.Split('|')); VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao(); vppDao.Update001(info.Id, idList, timeList); VideoPatrolPlanInfos[PlaninfosIndex] = info; VideoPatrolPlanViewPanel.SendMessage("ReloadRecord"); }
/// <summary> /// 创建新的巡逻方案 /// </summary> public void AddVideoPatrolPlan() { Logger.Instance.WriteLog("创建新的巡逻方案"); VideoPatrolPlanInfo info = new VideoPatrolPlanInfo(); int i = 1; VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao(); while (true) { vppDao.Select004("新建方案" + i); if (vppDao.Result.Count <= 0) { break; } i++; } info.Name = "新建方案" + i; info.MonitorList = ""; info.PlayTimeList = ""; Logger.Instance.WriteLog("保存新建巡逻方案"); vppDao.Insert001(info.Name, info.MonitorList, info.PlayTimeList, DataStore.UserInfo.UserName); Logger.Instance.WriteLog("加载新建巡逻方案"); vppDao.Select002(); if (vppDao.Result.Count <= 0 || vppDao.Result[0].Name != info.Name) { Logger.Instance.WriteLog("新建巡逻方案失败"); return; } info = vppDao.Result [0]; AddItemToVideoPatrolPlanGrid(info); ShowPlanDetail(VideoPatrolPlanGrid.GetChild(VideoPatrolPlanGrid.transform.childCount - 1).gameObject); }
/// <summary> /// 删除选定的巡逻方案 /// </summary> public void DeleteVideoPatrolPlan() { Logger.Instance.WriteLog("删除选定的巡逻方案"); if (VideoPatrolPlanInfos.Count <= 0) { return; } string planName = PlanName.GetComponentInChildren <UIInput> ().value; int PlaninfosIndex = FindVideoPatrolPlanInfoIndex(planName); VideoPatrolPlanInfo info = VideoPatrolPlanInfos[PlaninfosIndex]; VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao(); vppDao.Delete001(info.Id); VideoPatrolPlanInfos.RemoveAt(PlaninfosIndex); PlanNameList.Remove(planName); if (VideoPatrolPlanInfos.Count > 0) { PlanName.GetComponentInChildren <UIInput> ().value = VideoPatrolPlanInfos[0].Name; } else { PlanName.GetComponentInChildren <UIInput> ().value = ""; } if (VideoPatrolPlanInfos.Count <= 0) { AddVideoPatrolPlan(); } ShowDetailList(PlanName.GetComponentInChildren <UIInput> ().value); VideoPatrolPlanViewPanel.SendMessage("ReloadRecord"); }
/// <summary> /// 创建新的巡逻方案 /// </summary> public void AddVideoPatrolPlan() { Logger.Instance.WriteLog("创建新的巡逻方案"); VideoPatrolPlanInfo info = new VideoPatrolPlanInfo(); int i = 1; while (PlanNameList.Contains("新建方案" + i)) { i++; } info.Name = "新建方案" + i; info.MonitorList = ""; info.PlayTimeList = ""; VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao(); Logger.Instance.WriteLog("保存新建巡逻方案"); vppDao.Insert001(info.Name, info.MonitorList, info.PlayTimeList, DataStore.UserInfo.UserName); Logger.Instance.WriteLog("加载新建巡逻方案"); vppDao.Select002(); if (vppDao.Result.Count <= 0 || vppDao.Result[0].Name != info.Name) { Logger.Instance.WriteLog("新建巡逻方案失败"); return; } info = vppDao.Result [0]; VideoPatrolPlanInfos.Add(info); PlanNameList.Add(info.Name); PlanName.GetComponentInChildren <UIInput> ().value = info.Name; ShowDetailList(PlanName.GetComponentInChildren <UIInput> ().value); VideoPatrolPlanViewPanel.SendMessage("ReloadRecord"); }
/// <summary> /// 当方案选择列表变更选项时调用 /// </summary> // public void PopuListValueChange() // { // UIPopupList PopuList = Popuplist.GetComponent<UIPopupList> (); // ShowDetailList (PopuList.value); // } /// <summary> /// 在显示面板中显示指定方案的详细信息 /// </summary> /// <param name="planName">Plan name.</param> void ShowDetailList(string planName) { Logger.Instance.WriteLog("显示指定方案的详细信息"); PlanName.GetComponentInChildren <UIInput> ().value = planName; SelectedMornitorList.transform.DestroyChildren(); SelectedMornitorDictionary.Clear(); if (planName.Trim() == "") { VideoPatrolPlanEditMapPanel.GetComponent <DrawMap> ().Clear(); selectPlanInfosIndex = -1; return; } VideoPatrolPlanInfo info = FindVideoPatrolPlanInfo(planName); selectPlanInfosIndex = FindVideoPatrolPlanInfoIndex(planName); string[] MornitorIdList = info.MonitorList.Split('|'); string[] TimeList = info.PlayTimeList.Split('|'); int index = -1; for (int i = 0; i < MornitorIdList.Length; i++) { index = findMornitorInfosIndex(MornitorIdList[i]); if (index < 0) { continue; } AddToSelectedMornitorList(i + 1, MornitorInfos[index].Description, index, TimeList[i]); } SelectedMornitorList.Reposition(); VideoPatrolPlanEditMapPanel.GetComponent <DrawMap> ().Draw(planName, MornitorIdList); }
// void SetInitPlanName() // { // if(VideoPatrolPlanInfos.Count <= 0) return; // VideoPatrolPlanInfo info = VideoPatrolPlanInfos [selectPlanInfosIndex]; // Popuplist.GetComponentInChildren<UIInput> ().value = info.Name; // } /// <summary> /// 当项目名称改变时调用 /// </summary> void PlanNameChanged() { Logger.Instance.WriteLog("视频巡航方案名称被改变"); //UIPopupList PopuList = Popuplist.GetComponent<UIPopupList> (); VideoPatrolPlanInfo info = VideoPatrolPlanInfos [selectPlanInfosIndex]; string currentName = info.Name; string newName = PlanName.GetComponentInChildren <UIInput> ().value; if (newName.Trim() == "") { PlanName.GetComponentInChildren <UIInput> ().value = currentName; return; } if (currentName == newName) { return; } if (PlanNameList.Contains(newName)) { PlanName.GetComponentInChildren <UIInput> ().value = currentName; return; } PlanNameList [selectPlanInfosIndex] = newName; info.Name = newName; VideoPatrolPlanInfos [selectPlanInfosIndex] = info; PlanName.GetComponentInChildren <UIInput> ().value = newName; Logger.Instance.WriteLog("更新视频巡航方案名称"); VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao(); vppDao.Update002(info.Id, info.Name); VideoPatrolPlanEditMapPanel.GetComponent <DrawMap> ().Title.text = info.Name; VideoPatrolPlanViewPanel.SendMessage("ReloadRecord"); }
/// <summary> /// 根据name检索视频巡航方案记录 /// </summary> public void Select004(string name) { Result = new List <VideoPatrolPlanInfo> (); string sql = "select ID,NAME,DEVICEIDLIST,PLAYTIMELIST,ACCOUNTNAME,CREATETIME from CYGJ_VIDEO_PATROL_PLAN where NAME = '" + name + "'"; DataSet ds = OdbcDataManager.Instance.odbcOra.ReturnDataSet(sql, "CYGJ_VIDEO_PATROL_PLAN"); if (ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { VideoPatrolPlanInfo info = new VideoPatrolPlanInfo(); info.Id = dr["ID"].ToString(); info.Name = dr["NAME"].ToString(); info.MonitorList = dr["DEVICEIDLIST"].ToString(); info.PlayTimeList = dr["PLAYTIMELIST"].ToString(); info.AccountName = dr["ACCOUNTNAME"].ToString(); info.CreateTime = dr["CREATETIME"].ToString(); Result.Add(info); } } Logger.Instance.WriteLog("根据name检索视频巡航方案记录。检索件数:" + Result.Count); }
public void Init(VideoPatrolPlanInfo _info) { info = _info; No.text = info.Id; PlanName.text = info.Name; CreateTime.text = DateTime.Parse(info.CreateTime).ToString("yyyMMdd"); Creator.text = info.AccountName; }
private void AddItemToVideoPatrolPlanGrid(VideoPatrolPlanInfo info) { GameObject RecordItem = Instantiate(RecordItemPrefab) as GameObject; RecordItem.GetComponent <VideoPatrolPlanItem>().Init(info); VideoPatrolPlanGrid.AddChild(RecordItem.transform); RecordItem.transform.localScale = new Vector3(1, 1, 1); UIEventListener.Get(RecordItem).onClick = ShowPlanDetail; }
/// <summary> /// 查找指定名称的巡逻方案的详细信息 /// </summary> /// <returns>相应的巡逻方案信息/returns> /// <param name="planName">Plan name.</param> private VideoPatrolPlanInfo FindPlanInfo(string planName) { VideoPatrolPlanInfo retVal = new VideoPatrolPlanInfo(); foreach (VideoPatrolPlanInfo info in VideoPatrolPlanInfos) { if (info.Name == planName) { retVal = info; break; } } return(retVal); }
public void Init(string _PlanName, DelVideoPatrolPlanNameChanged _VideoPatrolPlanNameChanged) { Logger.Instance.WriteLog("加载巡逻方案的数据"); VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao(); vppDao.Select004(_PlanName); if (vppDao.Result.Count > 0) { VPPlaninfo = vppDao.Result[0]; } PlanName.value = VPPlaninfo.Name; VideoPatrolPlanNameChanged = _VideoPatrolPlanNameChanged; if (DicMornitorInfos == null) { LoadDeviceInfoRecord(); } ShowDetailList(); }
public void RunPlan() { Logger.Instance.WriteLog("运行当前选择的巡逻方案"); MainMenuController.canNotOpen = true; UIPopupList PopuList = PatrolPlanPopuplist.GetComponent <UIPopupList>(); string planName = PopuList.value; VideoPatrolPlanInfo info = FindPlanInfo(planName); MonitorIdList = info.MonitorList.Split('|'); PlayTimeList = info.PlayTimeList.Split('|'); //显示播放窗口,并设置相关的回调函数 VideoPatrolWindow.SetActive(true); PlayVideoPatrolPlan pvpPlan = VideoPatrolWindow.GetComponent <PlayVideoPatrolPlan>(); pvpPlan.NextVideo = PlayNextMonitroVideo; pvpPlan.StopVideo = StopPlan; pvpPlan.WriteLog = WriteLog; pvpPlan.SavePicture = SavePicture; ConstomNext(pvpPlan); MapPanel.SetActive(true); MapPanel.GetComponent <DrawMap>().Draw(planName, MonitorIdList, true); nextVideoIndex = 0; PlayNextMonitroVideo(); //巡逻方案开始后,禁用启动按钮和选择列表 PatrolPlanPopuplist.GetComponent <BoxCollider>().enabled = false; BtnStartPlanNormalSprite = BtnStartPlan.GetComponent <UIButton>().normalSprite; BtnStartPlan.GetComponent <UIButton>().normalSprite = BtnStartPlan.GetComponent <UIButton>().pressedSprite; BtnStartPlan.GetComponent <BoxCollider>().enabled = false; VideoPatrolLogDao vplDao = new VideoPatrolLogDao(); string time = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); vplDao.Insert001(DataStore.UserInfo.RealName, time, planName); PatrolLogID = vplDao.currentId; dirctoryPath = Application.dataPath + "/SaveImage/" + planName + System.DateTime.Parse(time).ToString("yyyyMMddHHmmss"); Directory.CreateDirectory(dirctoryPath); }