コード例 #1
0
 public ImageProvider(Setting setting, string solutionConfigFile, ImageBackgroundType providerType)
 {
     Setting = setting;
     Setting.OnChanged.AddEventHandler(OnSettingChanged);
     SolutionConfigFile = solutionConfigFile;
     ProviderType       = providerType;
 }
コード例 #2
0
        public ImageProvider ChangeActive(ImageBackgroundType newType, string solution)
        {
            Providers.ForEach(x => x.IsActive = false);
            var ret = Providers.FirstOrDefault(x => x.SolutionConfigFile == solution && x.ProviderType == newType);

            if (!string.IsNullOrEmpty(solution))
            {
                ret = Providers.FirstOrDefault(x => x.SolutionConfigFile == solution);
                if (ret == null)
                {
                    ret = Providers.FirstOrDefault(x =>
                                                   x.SolutionConfigFile == null && x.ProviderType == newType);
                }
            }
            else
            {
                ret = Providers.FirstOrDefault(x =>
                                               x.SolutionConfigFile == null && x.ProviderType == newType);
            }
            ret.IsActive = true;
            return(ret);
        }