コード例 #1
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));
        }
コード例 #2
0
        public static void CreateSettingsMonitor <TSettings>(this ISettingsService settingsService, IComponent component, Action <SettingsChangedEventArgs <TSettings> > callback) where TSettings : ComponentSettings
        {
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }

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

            settingsService.CreateSettingsMonitor(uri, callback);
        }
コード例 #3
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));
        }
コード例 #4
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);
        }