예제 #1
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);
        }
예제 #2
0
        public static TSettings GetComponentSettings <TSettings>(this ISettingsService settingsService, string componentId) where TSettings : ComponentSettings
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

            var uri = SettingsUriGenerator.FromComponent(componentId);

            return(settingsService.GetSettings <TSettings>(uri));
        }
예제 #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(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);
        }
예제 #5
0
        public static TSettings GetSettings <TSettings>(this ISettingsService settingsService, IAutomation automation) where TSettings : AutomationSettings
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (automation == null)
            {
                throw new ArgumentNullException(nameof(automation));
            }

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

            return(settingsService.GetSettings <TSettings>(uri));
        }
예제 #6
0
        public static JObject GetRawSettings(this ISettingsService settingsService, IAutomation automation)
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (automation == null)
            {
                throw new ArgumentNullException(nameof(automation));
            }

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

            return(settingsService.GetSettings(uri));
        }
예제 #7
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));
        }
예제 #8
0
        public static void SetSettings <TSettings>(this ISettingsService settingsService, IAutomation automation, TSettings settings) where TSettings : AutomationSettings
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (automation == null)
            {
                throw new ArgumentNullException(nameof(automation));
            }

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

            settingsService.ImportSettings(uri, settings);
        }
예제 #9
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);
        }