public AddEquipForm(T_PathIdentifyEquip equip) { InitializeComponent(); InitUI(); ResultEquip = equip; this.Text = "修改设备-" + equip.EquipName; txtEquipName.Text = equip.EquipName; //if (equip.ParentId != -1) //{ // cmbParentEquip.SelectedValue = equip.ParentId; //} txtGroupId.Text = equip.ParentId.ToString(); txtIP.Text = equip.Ip; nudPort.Value = equip.Port ?? 0; txtUserName.Text = equip.LoginUserName; txtPwd.Text = equip.LoginPwd; cmbDriverType.SelectedValue = equip.ProtocolId; txtMile.Text = equip.Mile; if (equip.EquipType == 0) { rbRecognizer.Checked = true; } else { rbCamera.Checked = true; } }
private void btnReadHistoryData_Click(object sender, EventArgs e) { AppendText("【获取历史数据】开始"); Thread t = new Thread(() => { T_ReceiveData[] datas = DAL_ReceiveData.GetAllDatas(); this.Invoke((MethodInvoker) delegate { DataReceiveLogGrid.Rows.Clear(); }); foreach (T_ReceiveData item in datas) { T_PathIdentifyEquip equip = Cache.PathIdEquips.Where(it => it.Id == item.EquipId).FirstOrDefault(); this.Invoke((MethodInvoker) delegate { int rowIndex = DataReceiveLogGrid.Rows.Add(); DataGridViewRow row = DataReceiveLogGrid.Rows[rowIndex]; row.Cells["colId"].Value = item.EquipId; row.Cells["colImageFullPath"].Value = item.ImageAllPath; row.Cells["colImageNear"].Value = item.ImageNearPath; row.Cells["colVehiclePlate"].Value = item.ImagePlateNoPath; row.Cells["colBinVehiclePlate"].Value = item.ImageBinPlateNoPath; row.Cells["colEquipName"].Value = equip == null ? "未知设备" : equip.EquipName; row.Cells["colVehPlateNo"].Value = item.VehPlateNo; row.Cells["colVehPlateColor"].Value = item.VehPlateColor; row.Cells["colReachTime"].Value = item.ReachTime.ToString(); row.Cells["colVehSpeed"].Value = item.VehicleSpeed; }); } AppendText("【获取历史数据】完成"); }); t.IsBackground = true; t.Start(); }
public AddEquipForm() { InitializeComponent(); InitUI(); this.Text = "添加设备"; ResultEquip = new T_PathIdentifyEquip(); }
private void OnVehicleInfoReceived(object sender, PathIdEquipVehicleInfoChangedEventArgs args) { if (VehicleInfoReceiveHandler != null) { T_PathIdentifyEquip equip = CurrentEquipList.Where(it => it.Id == args.VehicleInfo.equipId).FirstOrDefault(); if (equip == null) { throw new Exception("汉王驱动在回调车辆通行数据时发生错误:未能找到目标设备,EQUIPID=" + args.VehicleInfo.equipId.ToString()); } VehicleInfoReceiveEventArgs receiveInfo = new VehicleInfoReceiveEventArgs(); receiveInfo.CloseShotPhoto = args.VehicleInfo.imageNear; receiveInfo.Device = equip; receiveInfo.PanoramaPhoto = args.VehicleInfo.imageAll; receiveInfo.ReachTime = args.VehicleInfo.reachTime; receiveInfo.VehicleLength = args.VehicleInfo.vehicleLength; receiveInfo.VehiclePlateBinPhoto = args.VehicleInfo.imageBin; if (VehiclePlateColorDict.NameColorDict.Keys.Contains(args.VehicleInfo.vehicleColor)) { receiveInfo.VehiclePlateColor = args.VehicleInfo.vehicleColor; } receiveInfo.VehiclePlateNo = args.VehicleInfo.vehicleNo; receiveInfo.VehiclePlatePhoto = args.VehicleInfo.imagePlate; receiveInfo.VehicleSpeed = args.VehicleInfo.vehicleSpeed; VehicleInfoReceiveHandler.Invoke(this, receiveInfo); } }
public bool SetRetransferTime(int equipId, DateTime StartTime, DateTime EndTime) { T_PathIdentifyEquip equip = CurrentEquipList.Where(it => it.Id == equipId).FirstOrDefault(); innerDriver.DisConnect(equip.ParentId); return(innerDriver.SetEquipReTranTime(equipId, StartTime, EndTime)); }
public static bool SetRetransData(int equipId, DateTime startTime, DateTime endTime) { T_PathIdentifyEquip equip = Cache.PathIdEquips.Where(it => it.Id == equipId).FirstOrDefault(); int protocolId = equip.ProtocolId; if (DriverDict.Keys.Contains(protocolId)) { return(DriverDict[protocolId].SetRetransferTime(equip.Id, startTime, endTime)); } else { throw new Exception(string.Format("设置重传时未能发现正确的驱动类型。EquipId={0},ProtocolId={1}", equipId, protocolId)); } }
private void OnEquipStatusChanged(object sender, PathIdEquipStatusChangedEventArgs args) { if (DeviceStatusNotifyHandler != null) { T_PathIdentifyEquip equip = CurrentEquipList.Where(it => it.Id == args.StatusInfo.equipId).FirstOrDefault(); if (equip == null) { throw new Exception("汉王驱动在回调设备状态时发生错误:未能找到目标设备,EQUIPID=" + args.StatusInfo.equipId.ToString()); } DeviceStatus statusInfo = new DeviceStatus(); statusInfo.Device = equip; statusInfo.GatherTime = args.StatusInfo.currentDateTime; statusInfo.Status = args.StatusInfo.status; statusInfo.StatusDesc = args.StatusInfo.statusDes; DeviceStatusNotifyHandler.Invoke(this, statusInfo); } }
private void EquipTreeContextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { switch (e.ClickedItem.Name) { case "AddEquipToolStripMenuItem": { AddEquipForm form = new AddEquipForm(); if (form.ShowDialog() == DialogResult.OK) { InitEquipTree(); } } break; case "ModifyEquipToolStripMenuItem": { if (EquipTreeView.SelectedNode != null && EquipTreeView.SelectedNode.Tag != null) { T_PathIdentifyEquip equip = (T_PathIdentifyEquip)EquipTreeView.SelectedNode.Tag; AddEquipForm form = new AddEquipForm(equip); if (form.ShowDialog() == DialogResult.OK) { InitEquipTree(); } } } break; case "DelEquipToolStripMenuItem": { if (EquipTreeView.SelectedNode != null) { if (EquipTreeView.SelectedNode.GetNodeCount(true) > 0) { if (MessageBox.Show("确定删除此节点设备及其下属所有设备?", "删除设备组", MessageBoxButtons.OKCancel , MessageBoxIcon.Question) == DialogResult.OK) { foreach (TreeNode node in EquipTreeView.SelectedNode.Nodes) { T_PathIdentifyEquip equip = (T_PathIdentifyEquip)node.Tag; Cache.RemoveEquip(equip); node.Remove(); } T_PathIdentifyEquip selectedEquip = (T_PathIdentifyEquip)EquipTreeView.SelectedNode.Tag; Cache.RemoveEquip(selectedEquip); EquipTreeView.SelectedNode.Remove(); } } else { if (MessageBox.Show("确定删除此节点设备设备?", "删除设备", MessageBoxButtons.OKCancel , MessageBoxIcon.Question) == DialogResult.OK) { T_PathIdentifyEquip selectedEquip = (T_PathIdentifyEquip)EquipTreeView.SelectedNode.Tag; Cache.RemoveEquip(selectedEquip); EquipTreeView.SelectedNode.Remove(); } } InitEquipTree(); } } break; case "ProofTimeToolStripMenuItem": { AppendText("设备校时开始"); if (EquipTreeView.SelectedNode != null) { T_PathIdentifyEquip selectedEquip = (T_PathIdentifyEquip)EquipTreeView.SelectedNode.Tag; bool rel = DriverWrapper.ProofTime(selectedEquip.Id); if (rel) { AppendText(string.Format("设备-{0}校时成功。", selectedEquip.EquipName)); } else { AppendText(string.Format("设备-{0}校时失败。", selectedEquip.EquipName)); } } else { AppendText("设备树上未选择有效的设备"); } AppendText("设备校时结束"); } break; case "RetransDataToolStripMenuItem": { AppendText("设置重传..."); if (EquipTreeView.SelectedNode != null) { T_PathIdentifyEquip selectedEquip = (T_PathIdentifyEquip)EquipTreeView.SelectedNode.Tag; RetransDataForm form = new RetransDataForm(); if (form.ShowDialog() == DialogResult.OK) { bool rel = DriverWrapper.SetRetransData(selectedEquip.Id, form.StartTime, form.EndTime); if (rel) { AppendText(string.Format("设备-{0}设置重传成功。StartTime:{1}-EndTime:{2}" , selectedEquip.EquipName, form.StartTime, form.EndTime)); } else { AppendText(string.Format("设备-{0}设置重传失败。StartTime:{1}-EndTime:{2}" , selectedEquip.EquipName, form.StartTime, form.EndTime)); } } else { AppendText("设置重传取消"); } } else { AppendText("设备树上未选择有效的设备"); } AppendText("设置重传完成"); } break; case "AllExpendToolStripMenuItem": { EquipTreeView.ExpandAll(); } break; case "AllCollapseToolStripMenuItem": { EquipTreeView.CollapseAll(); } break; } }