| | |
| | | using LB_SmartVision.Forms.Pages.SettingPage; |
| | | using LB_SmartVision.Forms.Pages.UserManagementPage; |
| | | using LB_SmartVision.ProcessRun; |
| | | using LB_SmartVision.SQL; |
| | | using LB_SmartVision.Tool; |
| | | using LB_SmartVisionCommon; |
| | | using LB_SmartVisionLoginUI; |
| | |
| | | { |
| | | LogInfo("全局变量加载失败", LogInfoType.ERROR); |
| | | } |
| | | |
| | | GlobalVar.dicMotionControlData.Clear(); |
| | | if (LoadMotionControlDatas(GlobalVar.allMotionControlDataPath)) |
| | | { |
| | | LogInfo("运动控制参数加载成功", LogInfoType.PASS); |
| | | } |
| | | else |
| | | { |
| | | LogInfo("运动控制参数加载失败", LogInfoType.ERROR); |
| | | } |
| | | //加载流程 |
| | | GlobalVar.dicProcesses.Clear(); |
| | | if (LoadAllProcess(GlobalVar.allProcessConnectionStringPath)) |
| | |
| | | com_ProductName.Items.Add("新增"); |
| | | com_ProductName.Text = GlobalVar.strProductName; |
| | | this.WindowState = FormWindowState.Maximized; |
| | | DatabaseRecordProductDataHelper.InitializeDatabase(); |
| | | } |
| | | |
| | | public void SaveAllSetting() |
| | |
| | | SaveAllProcessSetting(); |
| | | SaveAllLayout(); |
| | | SaveAllCsv(); |
| | | SaveMotionControlDatas(); |
| | | } |
| | | public bool LoadMotionControlDatas(string alMotionControlDataPath) |
| | | { |
| | | try |
| | | { |
| | | GlobalVar.dicMotionControlData = ConfigManager<ConcurrentDictionary<string, ConcurrentDictionary<string, RecordMotionControlData>>>.LoadConfig<ConcurrentDictionary<string, ConcurrentDictionary<string, RecordMotionControlData>>>(alMotionControlDataPath); |
| | | } |
| | | catch |
| | | { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | public bool SaveMotionControlDatas() |
| | | { |
| | | try |
| | | { |
| | | ConcurrentDictionary<string, List<string>> removeCameraSN = new ConcurrentDictionary<string, List<string>>(); |
| | | foreach (var item in GlobalVar.dicMotionControlData.Keys) |
| | | { |
| | | List<string> list = new List<string>(); |
| | | foreach (var itemSN in GlobalVar.dicMotionControlData[item].Keys) |
| | | { |
| | | if (!GlobalVar.dicCameras.Keys.Contains(itemSN)) |
| | | { |
| | | list.Add(itemSN); |
| | | } |
| | | } |
| | | if (list.Count > 0) |
| | | { |
| | | removeCameraSN.TryAdd(item, list); |
| | | } |
| | | } |
| | | foreach (var item in removeCameraSN.Keys) |
| | | { |
| | | foreach (var itemSN in removeCameraSN[item]) |
| | | { |
| | | GlobalVar.dicMotionControlData[item].Keys.Remove(itemSN); |
| | | } |
| | | } |
| | | ConfigManager<ConcurrentDictionary<string, ConcurrentDictionary<string, RecordMotionControlData>>>.SaveConfig<ConcurrentDictionary<string, ConcurrentDictionary<string, RecordMotionControlData>>>(GlobalVar.dicMotionControlData, GlobalVar.allMotionControlDataPath); |
| | | } |
| | | catch |
| | | { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public bool LoadAllCameras(string allCamerasConnectionStringPath) |
| | |
| | | GlobalVar.strProductName = com_ProductName.SelectedItem?.ToString(); |
| | | foreach (BaseCamera camera in GlobalVar.dicCameras.Values) |
| | | { |
| | | camera.TriggerRunMessageReceived -= TriggerRunMessageReceived; |
| | | camera.Dispose(); |
| | | } |
| | | GlobalVar.dicCameras.Clear(); |