public PeripheralsSettingParam GetPeripheralsSettingParam() { PeripheralsSettingParam param = new PeripheralsSettingParam(); List<DisplayAutoBrightMapping> mapList = new List<DisplayAutoBrightMapping>(); foreach (DisplayAutoBrightMapping map in EnvirAndDisplayBrightCollection) { mapList.Add((DisplayAutoBrightMapping)map.Clone()); } List<PeripheralsLocation> peripheralList = new List<PeripheralsLocation>(); foreach (PeripheralUIData periUIData in PeripheralList) { if (periUIData.IsSelected) { peripheralList.Add((PeripheralsLocation)periUIData.Location.Clone()); } } param.ExtendData = new AutoBrightExtendData() { CalcType = AutoBrightCalcType.AllAverage, AutoBrightMappingList= mapList, UseLightSensorList = peripheralList }; return param; }
private void UpdateUI(PeripheralsSettingParam param) { Application.Current.Dispatcher.Invoke(new Action(() => { if (param != null && param.ExtendData != null && param.ExtendData.AutoBrightMappingList != null) { for (int i = 0; i < param.ExtendData.AutoBrightMappingList.Count; i++) { DisplayAutoBrightMapping map = param.ExtendData.AutoBrightMappingList[i]; EnvirAndDisplayBrightCollection.Add((DisplayAutoBrightMapping)map.Clone()); } } if (param != null && param.ExtendData != null && param.ExtendData.UseLightSensorList != null) { for (int i = 0; i < param.ExtendData.UseLightSensorList.Count; i++) { PeripheralsLocation location = param.ExtendData.UseLightSensorList[i]; for (int j = 0; j < PeripheralList.Count; j++) { if (location.Equals(PeripheralList[j].Location)) { PeripheralList[j].IsSelected = true; } } } } })); }
private void OnPeripheralsSettingCallback(PeripheralsSettingParam param) { _sensorConfig.ExtendData = param.ExtendData; }
private void OnCmdStartFindPeripherals(PeripheralsSettingParam data) { _oldData = data; _peripheralFinder.ReadAllPeripheralsOnSenderOrPortFuncCard(OnReadPeripheralsCallback, null); string msg = ""; CommonStaticMethod.GetLanguageString("正在搜索接入系统的光探测器,请稍后...", "Lang_Bright_ReadAllPeripherals", out msg); ShowGlobalProcessBegin(msg); }
public Window_PeripheralsConfig(PeripheralsSettingParam cfg) { InitializeComponent(); _vm = (Window_PeripheralsConfig_VM)FindResource("Window_PeripheralsConfig_VMDataSource"); _vm.CmdStartFindPeripherals.Execute(cfg); }