| | |
| | | using LB_SmartVision.ProcessRun; |
| | | using LB_SmartVision.SQL; |
| | | using LB_SmartVision.Tool; |
| | | using LB_SmartVisionCameraDevice.PHM6000; |
| | | using LB_SmartVisionCommon; |
| | | using LB_SmartVisionLoginUI; |
| | | using LB_VisionProcesses; |
| | |
| | | LB_SmartVision.Tool.Tool.ReadStringConfig("User ID", out string User_ID); |
| | | LB_SmartVision.Tool.Tool.ReadStringConfig("Password", out string Password); |
| | | GlobalVar.strProductName = DateBaseName; |
| | | //加载LB相机参数 |
| | | if (LoadAllLBCameras(GlobalVar.allCamerasLBPath)) |
| | | { |
| | | LogInfo("LB3D相机配置文件加载成功!", LogInfoType.PASS); |
| | | } |
| | | else |
| | | { |
| | | LogInfo("LB3D相机配置文件加载失败", LogInfoType.ERROR); |
| | | } |
| | | //加载通讯 |
| | | foreach (BaseCommunicator com in GlobalVar.dicCommunicators.Values) |
| | | { |
| | |
| | | camera.isGrabbing = false; |
| | | } |
| | | } |
| | | |
| | | if (camera is LBCamera phmCamera) |
| | | { |
| | | if (GlobalVar.allLBCameras.ContainsKey(camera.SN)) |
| | | { |
| | | phmCamera.UpdateSensorConfig(GlobalVar.allLBCameras[camera.SN]); |
| | | } |
| | | } |
| | | GlobalVar.dicCameras.TryAdd(CameraConnectionString.Key, camera); |
| | | } |
| | | |
| | |
| | | catch { return false; } |
| | | } |
| | | |
| | | public bool LoadAllLBCameras(string allLBCamerasPath) |
| | | { |
| | | try |
| | | { |
| | | if (!File.Exists(allLBCamerasPath)) |
| | | { |
| | | Debug.WriteLine("文件不存在创建空文件"); |
| | | // 获取不带文件名的目录路径 |
| | | string directoryPath = Path.GetDirectoryName(allLBCamerasPath); |
| | | SaveAllLBCameras(); |
| | | return true; |
| | | } |
| | | GlobalVar.allLBCameras = ConfigManager<ConcurrentDictionary<string, PHM6000SensorConfig>>.LoadConfig<ConcurrentDictionary<string, PHM6000SensorConfig>>(GlobalVar.allCamerasLBPath); |
| | | } |
| | | catch |
| | | { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public bool SaveAllLBCameras() |
| | | { |
| | | try |
| | | { |
| | | if (GlobalVar.allLBCameras.Count >= 0) |
| | | { |
| | | ConfigManager<ConcurrentDictionary<string, PHM6000SensorConfig>>.SaveConfig<ConcurrentDictionary<string, PHM6000SensorConfig>>(GlobalVar.allLBCameras, GlobalVar.allCamerasLBPath); |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public bool LoadAllProcess(string allProcessConnectionStringPath) |
| | | { |
| | | try |