コード例 #1
0
            public SettingsInfo(Lazy <IBackgroundImageOptionDefinition, IBackgroundImageOptionDefinitionMetadata> lazy)
            {
                Lazy = lazy;
                var defaultSettings = lazy.Value.GetDefaultImageSettings();

                RawSettings             = defaultSettings is null ? new RawSettings(lazy.Value.Id) : new RawSettings(lazy.Value.Id, defaultSettings);
                BackgroundImageSettings = new BackgroundImageSettings(RawSettings);
            }
コード例 #2
0
 public BackgroundImageSettings(RawSettings rawSettings)
 {
     if (rawSettings == null)
     {
         throw new ArgumentNullException(nameof(rawSettings));
     }
     this.rawSettings = rawSettings;
 }
コード例 #3
0
        BackgroundImageSettingsService(ISettingsService settingsService, IBackgroundImageOptionDefinitionService backgroundImageOptionDefinitionService)
        {
            this.settingsService = settingsService;
            settingsInfos        = new Dictionary <string, SettingsInfo>(backgroundImageOptionDefinitionService.AllSettings.Length, StringComparer.Ordinal);

            foreach (var lazy in backgroundImageOptionDefinitionService.AllSettings)
            {
                if (settingsInfos.ContainsKey(lazy.Value.Id))
                {
                    continue;
                }
                settingsInfos[lazy.Value.Id] = new SettingsInfo(lazy);
            }

            var allSettingsIds = new HashSet <string>(backgroundImageOptionDefinitionService.AllSettings.Select(a => a.Value.Id), StringComparer.Ordinal);
            var rootSection    = settingsService.GetOrCreateSection(SETTINGS_GUID);

            foreach (var section in rootSection.SectionsWithName(SettingsName))
            {
                var rawSettings = new RawSettings(section);
                if (!rawSettings.IsValid)
                {
                    continue;
                }
                Debug2.Assert(rawSettings.Id is not null);
                if (!settingsInfos.TryGetValue(rawSettings.Id, out var info))
                {
                    continue;
                }
                if (!allSettingsIds.Contains(rawSettings.Id))
                {
                    continue;
                }
                allSettingsIds.Remove(rawSettings.Id);
                if (info.Lazy.Value.UserVisible)
                {
                    info.SettingsSection = section;
                    info.RawSettings.CopyFrom(rawSettings);
                }
            }
        }
コード例 #4
0
 public ImageSettingsInfo(Lazy <IBackgroundImageOptionDefinition, IBackgroundImageOptionDefinitionMetadata> lazy, RawSettings rawSettings)
 {
     Lazy        = lazy;
     RawSettings = rawSettings;
 }
コード例 #5
0
 public BackgroundImageSettings(RawSettings rawSettings) => this.rawSettings = rawSettings ?? throw new ArgumentNullException(nameof(rawSettings));