public bool AddCameraListByVideoSupplier(uint VideoSupplierId) { var row = Framework.Container.Instance.CommService.GET_NET_STORE_LIST().Find(it => it.Id == VideoSupplierId); if (row != null) { float x = 121.48f; float y = 31.23f; Random r = new Random(); ConfigServices.DIOService server = new ConfigServices.DIOService(Framework.Container.Instance.IVXProtocol); server.Login(row.ProtocolType, row.IP, (ushort)row.Port, row.UserName, row.Password); List <CameraInfoV3_1> list = new List <CameraInfoV3_1>(); foreach (ConfigServices.Interop.TDIO_ChannelInfo item in server.GetChannelList()) { list.Add(new CameraInfoV3_1() { CameraID = item.szChannelId, CameraName = item.szChannelName, PosCoordX = x, PosCoordY = y, VideoSupplierChannelID = item.szChannelId, VideoSupplierDeviceID = VideoSupplierId, }); x += ((float)r.NextDouble() - 0.5f) / 5f; y += ((float)r.NextDouble() - 0.5f) / 5f; } Framework.Container.Instance.CommService.ADD_CAMERA_LIST(list); } return(true); }
private void InitCameraList(DevComponents.AdvTree.Node pNode) { if (pNode.Cells[3].Text != "Plat") { return; } if (pNode.Tag is ConfigServices.DIOService) { return; } DataModel.VideoSupplierDeviceInfo info = pNode.Tag as DataModel.VideoSupplierDeviceInfo; if (info == null) { return; } ConfigServices.DIOService server = new ConfigServices.DIOService(Framework.Container.Instance.IVXProtocol); server.Login(info.ProtocolType, info.IP, (ushort)info.Port, info.UserName, info.Password); //ConfigServices.DIOService server = pNode.Tag as ConfigServices.DIOService; pNode.Tag = server; treeListFtpFile.SuspendLayout(); try { var list = server.GetChannelList(); pNode.Nodes.Clear(); foreach (IVX.Live.ConfigServices.Interop.TDIO_ChannelInfo item in list) { DevComponents.AdvTree.Node snode = new DevComponents.AdvTree.Node(); snode.Expanded = false; snode.Name = "Camera"; snode.ImageIndex = 1; snode.Text = item.szChannelName; snode.Cells.Add(new DevComponents.AdvTree.Cell(item.szChannelId)); snode.Cells.Add(new DevComponents.AdvTree.Cell("0")); snode.Cells.Add(new DevComponents.AdvTree.Cell("Camera")); snode.Nodes.Add(new DevComponents.AdvTree.Node(NullValue)); snode.NodeDoubleClick += new EventHandler(snode_NodeDoubleClick); snode.Tag = item; pNode.Nodes.Add(snode); } } catch (Exception) { //Framework.Container.Instance.InteractionService.ShowMessageBox("无法连接FTP服务器,或获取HTTP文件列表失败。", Framework.Environment.PROGRAM_NAME); return; } treeListFtpFile.ResumeLayout(); }