示例#1
0
        public static TSettings GetSettings <TSettings>(this ISettingsService settingsService, ComponentId componentId) where TSettings : IComponentSettings
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

            var uri = SettingsUriGenerator.From(componentId);

            return(settingsService.GetSettings <TSettings>(uri));
        }
示例#2
0
        public static void CreateSettingsMonitor <TSettings>(this ISettingsService settingsService, Action <TSettings> callback)
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

            var uri = SettingsUriGenerator.From(typeof(TSettings));

            settingsService.CreateSettingsMonitor(uri, callback);
        }
示例#3
0
        public static TSettings GetSettings <TSettings>(this ISettingsService settingsService)
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

            var uri = SettingsUriGenerator.From(typeof(TSettings));

            return(settingsService.GetSettings <TSettings>(uri));
        }
示例#4
0
        public static void CreateSettingsMonitor <TSettings>(this ISettingsService settingsService, AutomationId automationId, Action <TSettings> callback) where TSettings : IAutomationSettings
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

            var uri = SettingsUriGenerator.From(automationId);

            settingsService.CreateSettingsMonitor(uri, callback);
        }
示例#5
0
        public static void CreateSettingsMonitor <TSettings>(this ISettingsService settingsService, IAutomation automation, Action <SettingsChangedEventArgs <TSettings> > callback) where TSettings : AutomationSettings
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

            var uri = SettingsUriGenerator.FromAutomation(automation.Id);

            settingsService.CreateSettingsMonitor(uri, callback);
        }
示例#6
0
        public static void CreateSettingsMonitor(this ISettingsService settingsService, IArea area, Action <SettingsChangedEventArgs <AreaSettings> > callback)
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

            var uri = SettingsUriGenerator.FromArea(area.Id);

            settingsService.CreateSettingsMonitor(uri, callback);
        }
示例#7
0
        public static void SetSettings <TSettings>(this ISettingsService settingsService, AutomationId automationId, TSettings settings) where TSettings : IAutomationSettings
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (automationId == null)
            {
                throw new ArgumentNullException(nameof(automationId));
            }

            var uri = SettingsUriGenerator.From(automationId);

            settingsService.ImportSettings(uri, settings);
        }
示例#8
0
        public static TSettings GetSettings <TSettings>(this ISettingsService settingsService, AutomationId automationId) where TSettings : IAutomationSettings
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (automationId == null)
            {
                throw new ArgumentNullException(nameof(automationId));
            }

            var uri = SettingsUriGenerator.From(automationId);

            return(settingsService.GetSettings <TSettings>(uri));
        }
示例#9
0
        public static JObject GetRawSettings(this ISettingsService settingsService, AutomationId automationId)
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (automationId == null)
            {
                throw new ArgumentNullException(nameof(automationId));
            }

            var uri = SettingsUriGenerator.From(automationId);

            return(settingsService.GetSettings(uri));
        }
示例#10
0
        public static JObject GetRawSettings(this ISettingsService settingsService, IComponent component)
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (component == null)
            {
                throw new ArgumentNullException(nameof(component));
            }

            var uri = SettingsUriGenerator.FromComponent(component.Id);

            return(settingsService.GetSettings(uri));
        }
示例#11
0
        public static void SetSettings <TSettings>(this ISettingsService settingsService, IComponent component, TSettings settings) where TSettings : ComponentSettings
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (component == null)
            {
                throw new ArgumentNullException(nameof(component));
            }

            var uri = SettingsUriGenerator.FromComponent(component.Id);

            settingsService.ImportSettings(uri, settings);
        }
示例#12
0
        public static JObject GetRawSettings(this ISettingsService settingsService, IArea area)
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (area == null)
            {
                throw new ArgumentNullException(nameof(area));
            }

            var uri = SettingsUriGenerator.FromArea(area.Id);

            return(settingsService.GetSettings(uri));
        }