private void AddNode(VideoPictureResource vpResource, int parentNodeId) { TreeListNode node = treeList1.AppendNode(new object[] { vpResource, vpResource.Name, vpResource.Type, vpResource.Subject }, parentNodeId, ShowImage?vpResource.ImageIndex : -1, ShowImage?vpResource.SelectImageIndex : -1, -1); bool isLeaf = false; if (m_viewModelbase.ShowObjectType == TreeShowType.Camera) { isLeaf = vpResource.Type == ResourceType.Camera; } else { isLeaf = (vpResource.Type == ResourceType.VideoFile || vpResource.Type == ResourceType.PicSet); } node.HasChildren = !isLeaf; node.Tag = vpResource; vpResource.TreeNode = node; if (vpResource.Type == ResourceType.Camera) { RegisterCamera(vpResource); } }
private void FillupNonCameraVideos(VideoPictureResource parentResource) { List <TaskUnitInfo> taskUnits = null; try { taskUnits = Framework.Container.Instance.TaskManagerService.GetTaskUnitsWithoutCamera(); } catch (SDKCallException ex) { Common.SDKCallExceptionHandler.Handle(ex, "获取非点位任务单元集合"); } if (taskUnits != null /*&& taskUnits.Count > 0*/) { VideoPictureResource child; foreach (TaskUnitInfo unit in taskUnits) { if (Match(unit, m_filter)) { child = new VideoPictureResource(ResourceType.VideoFile, string.Format("{0}", unit.TaskUnitName), unit); parentResource.AddChild(child); } } //parentResource.Expand = true; } }
void OnCameraGroupAdded(CameraGroupInfo info) { foreach (VideoPictureResource item in m_RootResources) { VideoPictureResource camres = GetResourceByCameraGroup(item, info); if (camres != null) { return; } } //VideoPictureResource rootres = null; foreach (VideoPictureResource child in m_RootResources) { if (child.Type == ResourceType.CameraPicFolder || child.Type == ResourceType.CameraVideoFolder) { VideoPictureResource resource = new VideoPictureResource(ResourceType.CameraGroup, info.GroupName, info); FillupCameraResources(resource, ResourceType.Camera, info); child.AddChild(resource); // if (child.Expand) //{ if (TreeNodeAdded != null) { TreeNodeAdded(null, new EventAddNodeArgs { ParantTreeNode = child.TreeNode, NodeResource = resource }); } //} } } }
public void UpdateCheckedResourcesEx(VideoPictureResource resource, bool isChecked) { if (resource != null) { if (resource.Type == ResourceType.File) { TaskUnitInfo taskUnit = resource.Subject as TaskUnitInfo; if (taskUnit != null) { if (isChecked && !m_CheckedTaskUnitInfos.Contains(taskUnit)) { m_CheckedTaskUnitInfos.Add(taskUnit); } else if (!isChecked && m_CheckedTaskUnitInfos.Contains(taskUnit)) { m_CheckedTaskUnitInfos.Remove(taskUnit); } } } if (resource.Children != null && resource.Children.Count > 0) { foreach (VideoPictureResource child in resource.Children) { UpdateCheckedResourcesEx(child, isChecked); } } } }
private void FillupCameraVideos(VideoPictureResource parentResource) { CameraInfo camera = parentResource.Subject as CameraInfo; List <TaskUnitInfo> taskUnits = null; try { taskUnits = Framework.Container.Instance.TaskManagerService.GetTaskUnitsByCameraID(camera.CameraID); } catch (SDKCallException ex) { Common.SDKCallExceptionHandler.Handle(ex, "获取点位任务单元集合"); } if (taskUnits != null /*&& taskUnits.Count > 0*/) { VideoPictureResource child; foreach (TaskUnitInfo unit in taskUnits) { if (Match(unit, m_filter)) { child = new VideoPictureResource(ResourceType.VideoFile, string.Format("{0}[{1} - {2}]", unit.TaskUnitName, unit.StartTime.ToString(DataModel.Constant.DATETIME_FORMAT), unit.EndTime.ToString(DataModel.Constant.DATETIME_FORMAT)), unit); parentResource.AddChild(child); } } //parentResource.Expand = true; } }
public void UpdateCheckedResourcesEx(VideoPictureResource resource, bool isChecked) { if (resource != null) { if (resource.Type == ResourceType.VideoFile) { TaskUnitInfo taskUnit = resource.Subject as TaskUnitInfo; if (taskUnit != null) { if (isChecked && !m_DTID2TaskUnitInfo.ContainsKey(taskUnit.TaskUnitID)) { m_DTID2TaskUnitInfo.Add(taskUnit.TaskUnitID, taskUnit); m_DTDisplayIndex2TaskUnitInfo.Add(resource.DisplayIndex, taskUnit); } else if (!isChecked && m_DTID2TaskUnitInfo.ContainsKey(taskUnit.TaskUnitID)) { m_DTID2TaskUnitInfo.Remove(taskUnit.TaskUnitID); m_DTDisplayIndex2TaskUnitInfo.Remove(resource.DisplayIndex); } } } //if (resource.Children != null && resource.Children.Count > 0) //{ // foreach (VideoPictureResource child in resource.Children) // { // UpdateCheckedResourcesEx(child, isChecked); // } //} } }
private void AddNode(VideoPictureResource vpResource, int parentNodeId) { TreeListNode node = treeList1.AppendNode(new object[] { vpResource, vpResource.Name, vpResource.Type, vpResource.Subject }, parentNodeId, ShowImage?vpResource.ImageIndex : -1, ShowImage?vpResource.SelectImageIndex : -1, -1); bool isLeaf = false; if (m_viewModelbase.ShowObjectType == TreeShowType.Camera) { isLeaf = vpResource.Type == ResourceType.Task; } else { isLeaf = (vpResource.Type == ResourceType.VideoFile || vpResource.Type == ResourceType.PicSet); } node.HasChildren = !isLeaf; node.Tag = vpResource; vpResource.TreeNode = node; vpResource.DisplayIndex = Common.Utils.GetNodeDisplayIndex(node); if (vpResource.Children.Count > 0 && node.Nodes.Count == 0) { foreach (VideoPictureResource child in vpResource.Children) { AddNode(child, node.Id); } } }
//VideoPictureResource OnTaskAdded(TaskInfo info) //{ // foreach (VideoPictureResource item in m_RootResources) // { // VideoPictureResource task = GetResourceByTask(item, info); // if (task != null) // return task; // } // VideoPictureResource resource = // new VideoPictureResource(ResourceType.Task, info.TaskName, info); // m_RootResources.Add(resource); // if (resource != null) // { // if (TreeNodeAdded != null) // TreeNodeAdded(null, new EventAddNodeArgs { NodeResource = resource }); // } // return resource; //} void OnTaskModified(TaskInfo info) { VideoPictureResource task = null; foreach (VideoPictureResource child in m_RootResources) { task = GetResourceByTask(child, info); if (task != null) { break; } } if (task != null) { task.Name = info.TaskName; task.Subject = info; if (/*task.Expand &&*/ TreeNodeEdited != null) { TreeNodeEdited(null, new EventEditNodeArgs { NodeResource = task }); } } }
private void OnTaskUnitDeleted(uint taskUnitID) { VideoPictureResource taskunitres = null; foreach (VideoPictureResource item in m_RootResources) { taskunitres = GetResourceByTaskUnit(item, new TaskUnitInfo { TaskUnitID = taskUnitID }); if (taskunitres != null) { break; } } if (taskunitres != null) { // 删除的任务单元, 需要在CheckedResources 集合中删除 UpdateCheckedResources(taskunitres, false); if (TreeNodeDeleted != null) { TreeNodeDeleted(null, new EventDeleteNodeArgs { NodeResource = taskunitres }); } } }
void OnCameraGroupModified(CameraGroupInfo info) { VideoPictureResource camres = null; foreach (VideoPictureResource child in m_RootResources) { camres = GetResourceByCameraGroup(child, info); if (camres != null) { break; } } if (camres != null) { camres.Name = info.GroupName; camres.Subject = info; if (/*camres.Expand &&*/ TreeNodeEdited != null) { TreeNodeEdited(null, new EventEditNodeArgs { NodeResource = camres }); } } else { OnCameraGroupAdded(info); } }
private void FillupResources() { m_RootResources = new List <VideoPictureResource>(); VideoPictureResource m_ResourceCameraVideoFolder = new VideoPictureResource(ResourceType.VideoSupplierDevice, "网络存储设备"); m_RootResources.Add(m_ResourceCameraVideoFolder); FillupVideoSupplierDeviceResources(m_ResourceCameraVideoFolder, ResourceType.CameraGroup); }
public void UpdateCheckedResources(VideoPictureResource resource, bool isChecked) { UpdateCheckedResourcesEx(resource, isChecked); if (IsForVideoSearch) { Framework.Container.Instance.SelectedTaskUnitsForSearch = m_CheckedTaskUnitInfos.ToArray(); } }
private void treeList1_AfterCheckNode(object sender, DevExpress.XtraTreeList.NodeEventArgs e) { VideoPictureResource resource = e.Node.Tag as VideoPictureResource; if (resource != null) { m_viewModelbase.UpdateCheckedResources(resource, e.Node.Checked); } }
public void RetrieveChildren(VideoPictureResource parentResource) { if (parentResource.Children == null || parentResource.Children.Count == 0) { if (parentResource.Type == ResourceType.Camera) { FillupCameraVideos(parentResource); } } }
private void FillupVideoFolders() { m_ResourceCameraVideoFolder = new VideoPictureResource(ResourceType.CameraVideoFolder, "点位视频"); m_RootResources.Add(m_ResourceCameraVideoFolder); FillupCameraResources(m_ResourceCameraVideoFolder, ResourceType.VideoCamera); VideoPictureResource resource = new VideoPictureResource(ResourceType.NonCameraVideoFolder, "无点位视频"); m_RootResources.Add(resource); }
private void FillupPicFolders() { VideoPictureResource resource = new VideoPictureResource(ResourceType.CameraPicFolder, "点位图片"); m_RootResources.Add(resource); FillupCameraResources(m_ResourceCameraVideoFolder, ResourceType.PicCamera); m_RootResources.Add(new VideoPictureResource( ResourceType.NonCameraPicFolder, "无点位图片")); }
public void SelectCameraNode(int cameraId) { if (m_DTCameraId2VPResource.ContainsKey(cameraId)) { VideoPictureResource vpResource = m_DTCameraId2VPResource[cameraId]; treeList1.Selection.Clear(); TreeListNode treeNode = vpResource.TreeNode as TreeListNode; treeNode.Selected = true; } }
void OnTaskUnitAnalyseFinished(uint taskUnitId) { TaskUnitInfo taskUnitInfo = null; try { taskUnitInfo = Framework.Container.Instance.TaskManagerService.GetTaskUnitById(taskUnitId); } catch (SDKCallException ex) { Common.SDKCallExceptionHandler.Handle(ex, "根据编号获取任务单元"); return; } VideoPictureResource taskunitres = null; foreach (VideoPictureResource item in m_RootResources) { taskunitres = GetResourceByTaskUnit(item, new TaskUnitInfo { TaskUnitID = taskUnitId }); if (taskunitres != null) { break; } } if (taskunitres != null) { string name = taskUnitInfo.TaskUnitName; if (taskUnitInfo.CameraId != 0) { name = string.Format("{0}[{1} - {2}]", taskUnitInfo.TaskUnitName, taskUnitInfo.StartTime.ToString(DataModel.Constant.DATETIME_FORMAT), taskUnitInfo.EndTime.ToString(DataModel.Constant.DATETIME_FORMAT)); } else { name = string.Format("{0}", taskUnitInfo.TaskUnitName); } taskunitres.Name = name; taskunitres.Subject = taskUnitInfo; if (/*taskunitres.Expand &&*/ TreeNodeEdited != null) { TreeNodeEdited(null, new EventEditNodeArgs { NodeResource = taskunitres }); } } else { OnTaskUnitAdded(taskUnitInfo); } }
public void RetrieveChildren(VideoPictureResource parentResource) { if (parentResource.Type == ResourceType.VideoCamera) { FillupCameraVideos(parentResource); } else if (parentResource.Type == ResourceType.NonCameraVideoFolder) { FillupNonCameraVideos(parentResource); } }
void m_viewModelbase_TaskUnitAdded(object sender, EventAddNodeArgs e) { TreeListNode pnode = e.ParantTreeNode as TreeListNode; VideoPictureResource child = e.NodeResource as VideoPictureResource; if (child != null && child.TreeNode == null) { AddNode(child, pnode != null?pnode.Id:-1); } }
private void FillupCameraResources(VideoPictureResource folder, ResourceType resourceType) { if (Cameras != null && Cameras.Count > 0) { foreach (CameraInfo camera in Cameras) { VideoPictureResource resource = new VideoPictureResource(resourceType, camera.CameraName, camera); folder.AddChild(resource); } } }
private void UnRegisterCamera(VideoPictureResource vpResource) { CameraInfo camera = vpResource.Subject as CameraInfo; Debug.Assert(camera != null); if (camera != null) { if (m_DTCameraId2VPResource.ContainsKey((int)camera.CameraID)) { m_DTCameraId2VPResource.Remove((int)camera.CameraID); } } }
private void FillupCameraResources() { if (CameraGroups != null) { foreach (CameraGroupInfo cameragroup in CameraGroups) { VideoPictureResource resource = new VideoPictureResource(ResourceType.CameraGroup, cameragroup.GroupName, cameragroup); FillupCameraResources(resource, ResourceType.Camera, cameragroup); m_RootResources.Add(resource); } // folder.Expand = true; } }
void m_viewModelbase_TaskUnitEdited(object sender, EventEditNodeArgs e) { VideoPictureResource child = e.NodeResource as VideoPictureResource; if (child != null && child.TreeNode != null) { TreeListNode node = child.TreeNode as TreeListNode; node[0] = child; node[1] = child.Name; node[3] = child.Subject; node.Tag = child; node.HasChildren = child.Type != ResourceType.VideoFile; } }
private void OnTaskUnitAdded(TaskUnitInfo taskUnitInfo) { foreach (VideoPictureResource item in m_RootResources) { VideoPictureResource taskunitres = GetResourceByTaskUnit(item, taskUnitInfo); if (taskunitres != null) { return; } } VideoPictureResource camres = null; foreach (VideoPictureResource item in m_RootResources) { camres = GetResourceByCamera(item, new CameraInfo { CameraID = taskUnitInfo.CameraId }); if (camres != null) { break; } } if (camres != null /*&& camres.Expand*/) { if (Match(taskUnitInfo, m_filter)) { VideoPictureResource child; if (taskUnitInfo.CameraId != 0) { child = new VideoPictureResource(ResourceType.VideoFile, string.Format("{0}[{1} - {2}]", taskUnitInfo.TaskUnitName, taskUnitInfo.StartTime.ToString(DataModel.Constant.DATETIME_FORMAT), taskUnitInfo.EndTime.ToString(DataModel.Constant.DATETIME_FORMAT)), taskUnitInfo); } else { child = new VideoPictureResource(ResourceType.VideoFile, string.Format("{0}", taskUnitInfo.TaskUnitName), taskUnitInfo); } camres.AddChild(child); if (TreeNodeAdded != null) { TreeNodeAdded(null, new EventAddNodeArgs { ParantTreeNode = camres.TreeNode, NodeResource = child }); } } } }
public void RetrieveChildren(VideoPictureResource parentResource) { //if(!parentResource.Expand) //{ // if (m_viewType == TreeShowType.Camera) // { // return; // } // if (parentResource.Type == ResourceType.Task) // { // FillupTaskUnits(parentResource); // } //} }
private void UpdateResourceByTaskID(uint ID, VideoPictureResource res) { if (res.Type == ResourceType.Task && res.Subject is TaskInfo) { TaskInfo camera = res.Subject as TaskInfo; if (ID == camera.TaskID) { res.Children.Clear(); FillupTaskUnits(res); return; } } res.Children.ForEach(item => UpdateResourceByTaskID(ID, item)); }
private void FillupCameraGroupResources(VideoPictureResource folder, ResourceType resourceType) { if (CameraGroups != null /*&& TaskGroups.Count > 0*/) { foreach (CameraGroupInfo cameragroup in CameraGroups) { VideoPictureResource resource = new VideoPictureResource(resourceType, cameragroup.GroupName, cameragroup); FillupCameraResources(resource, ResourceType.Camera, cameragroup); folder.AddChild(resource); } //folder.Expand = true; } }
private void FillupChildNodes(TreeListNode parentNode) { VideoPictureResource resource = parentNode[0] as VideoPictureResource; if (resource != null) { m_viewModelbase.RetrieveChildren(resource); if (resource.Children.Count > 0 && parentNode.Nodes.Count == 0) { foreach (VideoPictureResource child in resource.Children) { AddNode(child, parentNode.Id); } } } }
private void FillupNonCameraVideos(VideoPictureResource parentResource) { CameraInfo camera = parentResource.Subject as CameraInfo; List <TaskUnitInfo> taskUnits = Framework.Container.Instance.TaskManagerService.GetTaskUnitsWithoutCamera(); if (taskUnits != null && taskUnits.Count > 0) { VideoPictureResource child; foreach (TaskUnitInfo unit in taskUnits) { child = new VideoPictureResource(ResourceType.File, string.Format("{0}", unit.TaskUnitName), unit); parentResource.AddChild(child); } } }