public frm_OpticalProbeConfig(bool isSoftwareConfig, SmartLightConfigInfo lightConfigInfo)
            : this()
        {
            _lightConfigInfo  = lightConfigInfo;
            _isSoftwareConfig = isSoftwareConfig;

            if (_lightConfigInfo == null ||
                _lightConfigInfo.DispaySoftWareConfig == null ||
                _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting == null ||
                _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo == null)
            {
                return;
            }
            if (_isSoftwareConfig)
            {
                enableCheckBox.Checked = _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo.IsEnable;
                if (_lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue >= 0 ||
                    _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue <= 100)
                {
                    brightnessNumericUpDown.Value = _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue;
                }
            }
            else
            {
                enableCheckBox.Checked = _lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo.IsEnable;
                if (_lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue >= 0 ||
                    _lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue <= 100)
                {
                    brightnessNumericUpDown.Value = _lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue;
                }
            }
        }
        private void OnMsgControlConfig(string sn)
        {
            if (sn != MonitorAllConfig.Instance().ALLScreenName)
            {
                if (_screenConfigInfo != null && _screenConfigInfo.ScreenSN == sn)
                {
                    return;
                }
                SmartLightConfigInfo tmp = MonitorAllConfig.Instance().BrightnessConfigList.Find(a => a.ScreenSN == sn);

                _screenConfigInfo = new SmartLightConfigInfo();
                if (tmp == null)
                {
                    _screenConfigInfo.ScreenSN        = sn;
                    _screenConfigInfo.HwExecTypeValue = BrightnessHWExecType.DisHardWareControl;
                }
                else
                {
                    _screenConfigInfo = (SmartLightConfigInfo)(tmp.Clone());
                }
                _screenConfigInfobak = (SmartLightConfigInfo)_screenConfigInfo.Clone();
                _screenConfigInfobak.DisplayHardcareConfig = null;

                InitialControlConfig(sn, _screenConfigInfo.DispaySoftWareConfig);
            }
        }
        private void frmConfig_SensorTestEvent(bool isTest, List <PeripheralsLocation> sensorList)
        {
            if (isTest)
            {
                SmartLightConfigInfo smartTest = new SmartLightConfigInfo();
                smartTest.ScreenSN             = _currentSn;
                smartTest.DispaySoftWareConfig = new DisplaySmartBrightEasyConfig();
                smartTest.DispaySoftWareConfig.AutoAdjustPeriod      = 5;
                smartTest.DispaySoftWareConfig.AutoBrightReadLuxCnt  = 1;
                smartTest.DispaySoftWareConfig.DisplayUDID           = _currentSn;
                smartTest.DispaySoftWareConfig.IsSmartEnable         = true;
                smartTest.DispaySoftWareConfig.IsBrightGradualEnable = true;
                smartTest.DispaySoftWareConfig.OneDayConfigList      = new List <OneSmartBrightEasyConfig>();
                smartTest.DispaySoftWareConfig.OneDayConfigList.Add(new OneSmartBrightEasyConfig()
                {
                    IsConfigEnable      = true,
                    BrightPercent       = 0,
                    CustomDayCollection = new List <DayOfWeek>()
                    {
                        (DayOfWeek)0, (DayOfWeek)1, (DayOfWeek)2, (DayOfWeek)3, (DayOfWeek)4, (DayOfWeek)5, (DayOfWeek)6
                    },
                    ScheduleType = SmartBrightAdjustType.AutoBright,
                    StartTime    = new DateTime(2014, 1, 1, 0, 0, 0)
                });

                smartTest.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList = new List <DisplayAutoBrightMapping>()
                {
                    new DisplayAutoBrightMapping()
                    {
                        EnvironmentBright = 200, DisplayBright = 90
                    },
                    new DisplayAutoBrightMapping()
                    {
                        EnvironmentBright = 100, DisplayBright = 50
                    },
                    new DisplayAutoBrightMapping()
                    {
                        EnvironmentBright = 0, DisplayBright = 0
                    }
                };
                smartTest.DispaySoftWareConfig.AutoBrightSetting.UseLightSensorList = sensorList;
                MonitorAllConfig.Instance().SaveBrightnessConfig(smartTest, false);
            }
            else
            {
                MonitorAllConfig.Instance().SaveBrightnessConfig(_screenConfigInfobak, false);
            }
        }
 private void UC_BrightnessConfig_BrightnessChangedEvent(SmartLightConfigInfo obj)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new MethodInvoker(delegate { UC_BrightnessConfig_BrightnessChangedEvent(obj); }));
         return;
     }
     if (obj == null)
     {
         return;
     }
     if (_screenConfigInfo != null && _screenConfigInfo.ScreenSN == obj.ScreenSN)
     {
         _screenConfigInfo    = (SmartLightConfigInfo)(obj.Clone());
         _screenConfigInfobak = (SmartLightConfigInfo)_screenConfigInfo.Clone();
         _screenConfigInfobak.DisplayHardcareConfig = null;
         InitialControlConfig(obj.ScreenSN, (DisplaySmartBrightEasyConfigBase)obj.DispaySoftWareConfig);
     }
 }
        private void crystalButton_OK_Click(object sender, EventArgs e)
        {
            //if (!_brightnessVM.IsOK())
            //{
            //    if (_brightnessVM.AutoBrightData == null || _brightnessVM.AutoBrightData.AutoBrightMappingList == null || _brightnessVM.AutoBrightData.AutoBrightMappingList.Count == 0)
            //        ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_configlightprobe", "请为该显示屏配置光探头(自动亮度根据光探头调节列表调节显示屏亮度)!"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Error);
            //    else ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "msg_configlightprobe_lightlist", "请配置光探头调节列表(自动亮度根据光探头调节列表调节显示屏亮度)!"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Error);
            //    return;
            //}
            if (!SetBrightConfig())
            {
                return;
            }
            //_screenConfigInfo.DispaySoftWareConfig = (DisplaySmartBrightEasyConfig)_brightnessSoftwareConfig;
            //_screenConfigInfo.DisplayHardcareConfig = _brightnessHardwareConfig;

            if (SubmitEvent != null)
            {
                SubmitEvent(sender, e);
            }
            if (!MonitorAllConfig.Instance().SaveBrightnessConfig(_screenConfigInfo))
            {
                CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "savefailed", "保存失败"));
            }
            //ShowCustomMessageBox(CommonUI.GetCustomMessage(_langTable, "savefailed", "保存失败"), "", MessageBoxButtons.OK, Windows.Forms.MessageBoxIconType.Alert);
            else
            {
                if (CloseFormHandler != null)
                {
                    CloseFormHandler(true);
                }
                else
                {
                    _screenConfigInfobak = (SmartLightConfigInfo)_screenConfigInfo.Clone();
                    _screenConfigInfobak.DisplayHardcareConfig = null;
                    //MessageBox.Show(CommonUI.GetCustomMessage(_langTable, "savesuccess", "保存成功"));
                    CustomMessageBox.ShowCustomMessageBox(this.ParentForm, CommonUI.GetCustomMessage(_langTable, "savesuccess", "保存成功"));
                }
            }
        }