Exemplo n.º 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);
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
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);
        }