예제 #1
0
        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
                        });
                    }
                    //}
                }
            }
        }
예제 #4
0
        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);
        }
예제 #12
0
        public void UpdateCheckedResources(VideoPictureResource resource, bool isChecked)
        {
            UpdateCheckedResourcesEx(resource, isChecked);

            if (IsForVideoSearch)
            {
                Framework.Container.Instance.SelectedTaskUnitsForSearch = m_CheckedTaskUnitInfos.ToArray();
            }
        }
예제 #13
0
        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);
         }
     }
 }
예제 #15
0
        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);
        }
예제 #16
0
        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, "无点位图片"));
        }
예제 #17
0
        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);
            }
        }
예제 #19
0
 public void RetrieveChildren(VideoPictureResource parentResource)
 {
     if (parentResource.Type == ResourceType.VideoCamera)
     {
         FillupCameraVideos(parentResource);
     }
     else if (parentResource.Type == ResourceType.NonCameraVideoFolder)
     {
         FillupNonCameraVideos(parentResource);
     }
 }
예제 #20
0
        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);
            }
        }
예제 #21
0
 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);
         }
     }
 }
예제 #22
0
        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;
            }
        }
예제 #24
0
        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;
            }
        }
예제 #29
0
        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);
                    }
                }
            }
        }
예제 #30
0
        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);
                }
            }
        }