protected override void InitDevicesGridView(GridView grdView) { base.InitDevicesGridView(grdView); //云电梯UDP端口 this.AddOneGridViewColumn(grdView, CLOUD_ELEVATOR_UDP_PORT, CLOUD_ELEVATOR_UDP_PORT_ALIAS, 150); //第三方对讲机UDP端口 this.AddOneGridViewColumn(grdView, THIRD_INTERCOM_UDP_PORT, THIRD_INTERCOM_UDP_PORT_ALIAS, 150); //云电梯数量 this.AddOneGridViewColumn(grdView, CLOUD_ELEVATOR_COUNT, CLOUD_ELEVATOR_COUNT_ALIAS, 100); //云电梯IP和门属性 for (int i = 1; i <= AppConst.LINKAGE_CTRL_CLOUD_ELEVATOR_MAX_COUNT; i++) { this.AddOneGridViewColumn(grdView, string.Format(CLOUD_ELEVATOR_ITEM_IP, i), string.Format(CLOUD_ELEVATOR_ITEM_IP_ALIAS, i), 120); this.AddOneGridViewColumn(grdView, string.Format(CLOUD_ELEVATOR_ITEM_PROP, i), string.Format(CLOUD_ELEVATOR_ITEM_PROP_ALIAS, i), 120); } this.gcDevices.DataSource = f_DevicesDataTable; ControlUtilityTool.AdjustIndicatorWidth(grdView); }
private void AddOneDeviceToUI(LinkageCtrlInfo linkageCtrlInfo) { DataRow[] rows = f_DevicesDataTable.Select(string.Format("{0}={1}", DEV_ID, linkageCtrlInfo.DevId)); FindCount.AddToUpdate("" + linkageCtrlInfo.DevId); FindCount.AddToUpdate("" + linkageCtrlInfo.DevIp); if (rows.Length > 0) { rows[0].BeginEdit(); try { int FindSumCount = AppEnv.Singleton.UdpCount * AppEnv.Singleton.UdpCount + 1; if (FindCount["" + linkageCtrlInfo.DevId].FontCount > FindSumCount && !FindCount["" + linkageCtrlInfo.DevId].IsHint) { FindCount["" + linkageCtrlInfo.DevId].IsHint = true; HintProvider.ShowAutoCloseDialog(null, "设备ID冲突,ID:" + linkageCtrlInfo.DevId); } if (FindCount[linkageCtrlInfo.DevIp].FontCount > FindSumCount && !FindCount["" + linkageCtrlInfo.DevIp].IsHint) { FindCount["" + linkageCtrlInfo.DevIp].IsHint = true; HintProvider.ShowAutoCloseDialog(null, string.Format("设备IP冲突,IP:{0},ID:{1}", linkageCtrlInfo.DevIp, linkageCtrlInfo.DevId)); } rows[0][DEV_MAC] = linkageCtrlInfo.DevMac; rows[0][DEV_IP] = linkageCtrlInfo.DevIp; rows[0][SUBNET_MARK] = linkageCtrlInfo.SubnetMask; rows[0][GATE_WAY] = linkageCtrlInfo.GateWay; rows[0][CLOUD_ELEVATOR_UDP_PORT] = linkageCtrlInfo.CloudUdpPort; rows[0][THIRD_INTERCOM_UDP_PORT] = linkageCtrlInfo.ThirdUdpPort; rows[0][CLOUD_ELEVATOR_COUNT] = linkageCtrlInfo.CloudElevatorCount; for (int i = 1; i <= 8; i++) { rows[0][string.Format(CLOUD_ELEVATOR_ITEM_IP, i)] = linkageCtrlInfo.CloudElevatorItems[i].DevIp; rows[0][string.Format(CLOUD_ELEVATOR_ITEM_PROP, i)] = CommonUtils.GetNameByCloudElevatorProperties(linkageCtrlInfo.CloudElevatorItems[i].CtrlProporties); } } finally { rows[0].EndEdit(); } } else { f_DevicesDataTable.Rows.Add(linkageCtrlInfo.DevId, linkageCtrlInfo.DevMac, linkageCtrlInfo.DevIp, linkageCtrlInfo.SubnetMask, linkageCtrlInfo.GateWay, linkageCtrlInfo.CloudUdpPort, linkageCtrlInfo.ThirdUdpPort, linkageCtrlInfo.CloudElevatorCount, linkageCtrlInfo.CloudElevatorItems[1].DevIp, CommonUtils.GetNameByCloudElevatorProperties(linkageCtrlInfo.CloudElevatorItems[1].CtrlProporties), linkageCtrlInfo.CloudElevatorItems[2].DevIp, CommonUtils.GetNameByCloudElevatorProperties(linkageCtrlInfo.CloudElevatorItems[2].CtrlProporties), linkageCtrlInfo.CloudElevatorItems[3].DevIp, CommonUtils.GetNameByCloudElevatorProperties(linkageCtrlInfo.CloudElevatorItems[3].CtrlProporties), linkageCtrlInfo.CloudElevatorItems[4].DevIp, CommonUtils.GetNameByCloudElevatorProperties(linkageCtrlInfo.CloudElevatorItems[4].CtrlProporties), linkageCtrlInfo.CloudElevatorItems[5].DevIp, CommonUtils.GetNameByCloudElevatorProperties(linkageCtrlInfo.CloudElevatorItems[5].CtrlProporties), linkageCtrlInfo.CloudElevatorItems[6].DevIp, CommonUtils.GetNameByCloudElevatorProperties(linkageCtrlInfo.CloudElevatorItems[6].CtrlProporties), linkageCtrlInfo.CloudElevatorItems[7].DevIp, CommonUtils.GetNameByCloudElevatorProperties(linkageCtrlInfo.CloudElevatorItems[7].CtrlProporties), linkageCtrlInfo.CloudElevatorItems[8].DevIp, CommonUtils.GetNameByCloudElevatorProperties(linkageCtrlInfo.CloudElevatorItems[8].CtrlProporties) ); } //排序 f_DevicesDataTable.DefaultView.Sort = string.Format("{0} {1}", DEV_ID, "ASC"); ControlUtilityTool.AdjustIndicatorWidth(this.gvDevices); }