Пример #1
0
        public object Clone()
        {
            BrightnessConfigInfo info = new BrightnessConfigInfo();

            info.IsConfigEnable = _isConfigEnable;
            info.Time           = _time;
            info.Type           = _type;
            info.ExecutionCycle = _executionCycle;
            info.DayList        = _dayList;
            info.Brightness     = _brightness;
            return(info);
        }
Пример #2
0
        public void Initialize(string sn, DisplaySmartBrightEasyConfigBase cfg)
        {
            _sn = sn;
            _brightnessConfigList.Clear();
            if (cfg == null)
            {
                return;
            }
            BrightnessConfigInfo brightConfig;

            _autoBrightData = cfg.AutoBrightSetting;
            if (cfg.OneDayConfigList != null)
            {
                foreach (var item in cfg.OneDayConfigList)
                {
                    brightConfig                = new BrightnessConfigInfo();
                    brightConfig.Type           = item.ScheduleType;
                    brightConfig.Time           = item.StartTime;
                    brightConfig.IsConfigEnable = item.IsConfigEnable;
                    brightConfig.DayList        = item.CustomDayCollection;
                    brightConfig.Brightness     = item.BrightPercent;
                    if (brightConfig.DayList.Count == 7)
                    {
                        brightConfig.ExecutionCycle = CycleType.everyday;
                    }
                    else if (brightConfig.DayList.FindAll(a => (a == DayOfWeek.Saturday) || a == DayOfWeek.Sunday).Count > 0)
                    {
                        brightConfig.ExecutionCycle = CycleType.userDefined;
                    }
                    else
                    {
                        if (brightConfig.DayList.FindAll(a => (a == DayOfWeek.Monday) ||
                                                         (a == DayOfWeek.Tuesday) ||
                                                         (a == DayOfWeek.Wednesday) ||
                                                         (a == DayOfWeek.Thursday) ||
                                                         (a == DayOfWeek.Friday)
                                                         ).Count == 5)
                        {
                            brightConfig.ExecutionCycle = CycleType.workday;
                        }
                        else
                        {
                            brightConfig.ExecutionCycle = CycleType.userDefined;
                        }
                    }
                    _brightnessConfigList.Add(brightConfig);
                }
            }
        }