当前位置: 首页>>代码示例>>C#>>正文


C# ISettingsService.CreateSettingsMonitor方法代码示例

本文整理汇总了C#中ISettingsService.CreateSettingsMonitor方法的典型用法代码示例。如果您正苦于以下问题:C# ISettingsService.CreateSettingsMonitor方法的具体用法?C# ISettingsService.CreateSettingsMonitor怎么用?C# ISettingsService.CreateSettingsMonitor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISettingsService的用法示例。


在下文中一共展示了ISettingsService.CreateSettingsMonitor方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Window

        public Window(ComponentId id, ISettingsService settingsService)
            : base(id)
        {
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));

            settingsService.CreateSettingsMonitor<ComponentSettings>(Id, s => Settings = s);
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:7,代码来源:Window.cs

示例2: OpenWeatherMapService

        public OpenWeatherMapService(
            IOutdoorTemperatureService outdoorTemperatureService,
            IOutdoorHumidityService outdoorHumidityService,
            IDaylightService daylightService,
            IWeatherService weatherService,
            IDateTimeService dateTimeService, 
            ISchedulerService schedulerService, 
            ISystemInformationService systemInformationService,
            ISettingsService settingsService, 
            IStorageService storageService)
        {
            if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService));
            if (outdoorHumidityService == null) throw new ArgumentNullException(nameof(outdoorHumidityService));
            if (daylightService == null) throw new ArgumentNullException(nameof(daylightService));
            if (weatherService == null) throw new ArgumentNullException(nameof(weatherService));
            if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService));
            if (systemInformationService == null) throw new ArgumentNullException(nameof(systemInformationService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));
            if (storageService == null) throw new ArgumentNullException(nameof(storageService));

            _outdoorTemperatureService = outdoorTemperatureService;
            _outdoorHumidityService = outdoorHumidityService;
            _daylightService = daylightService;
            _weatherService = weatherService;
            _dateTimeService = dateTimeService;
            _systemInformationService = systemInformationService;
            _storageService = storageService;

            settingsService.CreateSettingsMonitor<OpenWeatherMapServiceSettings>(s => Settings = s);

            LoadPersistedData();

            schedulerService.RegisterSchedule("OpenWeatherMapServiceUpdater", TimeSpan.FromMinutes(5), Refresh);
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:34,代码来源:OpenWeatherMapService.cs

示例3: ControllerSlaveService

        public ControllerSlaveService(
            ISettingsService settingsService,
            ISchedulerService scheduler,
            IDateTimeService dateTimeService,
            IOutdoorTemperatureService outdoorTemperatureService,
            IOutdoorHumidityService outdoorHumidityService,
            IDaylightService daylightService,
            IWeatherService weatherService)
        {
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));
            if (scheduler == null) throw new ArgumentNullException(nameof(scheduler));
            if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService));
            if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService));
            if (outdoorHumidityService == null) throw new ArgumentNullException(nameof(outdoorHumidityService));
            if (daylightService == null) throw new ArgumentNullException(nameof(daylightService));
            if (weatherService == null) throw new ArgumentNullException(nameof(weatherService));

            _dateTimeService = dateTimeService;
            _outdoorTemperatureService = outdoorTemperatureService;
            _outdoorHumidityService = outdoorHumidityService;
            _daylightService = daylightService;
            _weatherService = weatherService;

            settingsService.CreateSettingsMonitor<ControllerSlaveServiceSettings>(s => Settings = s);

            scheduler.RegisterSchedule("ControllerSlavePolling", TimeSpan.FromMinutes(5), PullValues);
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:27,代码来源:ControllerSlaveService.cs

示例4: NotificationService

        public NotificationService(
            IDateTimeService dateTimeService, 
            IApiService apiService, 
            ISchedulerService schedulerService, 
            ISettingsService settingsService,
            IStorageService storageService,
            IResourceService resourceService)
        {
            if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService));
            if (apiService == null) throw new ArgumentNullException(nameof(apiService));
            if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));
            if (storageService == null) throw new ArgumentNullException(nameof(storageService));
            if (resourceService == null) throw new ArgumentNullException(nameof(resourceService));

            _dateTimeService = dateTimeService;
            _storageService = storageService;
            _resourceService = resourceService;

            settingsService.CreateSettingsMonitor<NotificationServiceSettings>(s => Settings = s);

            apiService.StatusRequested += HandleApiStatusRequest;

            schedulerService.RegisterSchedule("NotificationCleanup", TimeSpan.FromMinutes(15), Cleanup);
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:25,代码来源:NotificationService.cs

示例5: RollerShutter

        public RollerShutter(
            ComponentId id, 
            IRollerShutterEndpoint endpoint,
            ITimerService timerService,
            ISchedulerService schedulerService,
            ISettingsService settingsService)
            : base(id)
        {
            if (id == null) throw new ArgumentNullException(nameof(id));
            if (endpoint == null) throw new ArgumentNullException(nameof(endpoint));
            if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));

            _endpoint = endpoint;
            _schedulerService = schedulerService;

            settingsService.CreateSettingsMonitor<RollerShutterSettings>(Id, s => Settings = s);

            timerService.Tick += (s, e) => UpdatePosition(e);

            _startMoveUpAction = new Action(() => SetState(RollerShutterStateId.MovingUp));
            _turnOffAction = new Action(() => SetState(RollerShutterStateId.Off));
            _startMoveDownAction = new Action(() => SetState(RollerShutterStateId.MovingDown));

            endpoint.Stop(HardwareParameter.ForceUpdateState);
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:26,代码来源:RollerShutter.cs

示例6: TelegramBotService

        public TelegramBotService(ISettingsService settingsService, IPersonalAgentService personalAgentService)
        {
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));
            if (personalAgentService == null) throw new ArgumentNullException(nameof(personalAgentService));

            _personalAgentService = personalAgentService;

            settingsService.CreateSettingsMonitor<TelegramBotServiceSettings>(s => Settings = s);

            Log.WarningLogged += (s, e) =>
            {
                EnqueueMessageForAdministrators($"{Emoji.WarningSign} {e.Message}\r\n{e.Exception}", TelegramMessageFormat.PlainText);
            };

            Log.ErrorLogged += (s, e) =>
            {
                if (e.Message.StartsWith("Sending Telegram message failed"))
                {
                    // Prevent recursive send of sending failures.
                    return;
                }

                EnqueueMessageForAdministrators($"{Emoji.HeavyExclamationMark} {e.Message}\r\n{e.Exception}", TelegramMessageFormat.PlainText);
            };
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:25,代码来源:TelegramBotService.cs

示例7: BathroomFanAutomation

        public BathroomFanAutomation(AutomationId id, ISchedulerService schedulerService, ISettingsService settingsService)
            : base(id)
        {
            if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));

            _schedulerService = schedulerService;

            settingsService.CreateSettingsMonitor<BathroomFanAutomationSettings>(Id, s => Settings = s);
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:10,代码来源:BathroomFanAutomation.cs

示例8: TurnOnAndOffAutomation

        public TurnOnAndOffAutomation(AutomationId id, IDateTimeService dateTimeService, ISchedulerService schedulerService, ISettingsService settingsService, IDaylightService daylightService)
            : base(id)
        {
            if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService));
            if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));
            if (daylightService == null) throw new ArgumentNullException(nameof(daylightService));

            _dateTimeService = dateTimeService;
            _schedulerService = schedulerService;
            _daylightService = daylightService;

            settingsService.CreateSettingsMonitor<TurnOnAndOffAutomationSettings>(Id, s => Settings = s);
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:14,代码来源:TurnOnAndOffAutomation.cs

示例9: Button

        public Button(ComponentId id, IButtonEndpoint endpoint, ITimerService timerService, ISettingsService settingsService)
            : base(id)
        {
            if (id == null) throw new ArgumentNullException(nameof(id));
            if (endpoint == null) throw new ArgumentNullException(nameof(endpoint));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));

            settingsService.CreateSettingsMonitor<ButtonSettings>(Id, s => Settings = s);

            SetState(ButtonStateId.Released);

            timerService.Tick += CheckForTimeout;

            endpoint.Pressed += (s, e) => HandleInputStateChanged(ButtonStateId.Pressed);
            endpoint.Released += (s, e) => HandleInputStateChanged(ButtonStateId.Released);
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:16,代码来源:Button.cs

示例10: HumiditySensor

        public HumiditySensor(ComponentId id, ISettingsService settingsService, INumericValueSensorEndpoint endpoint)
            : base(id)
        {
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));
            if (endpoint == null) throw new ArgumentNullException(nameof(endpoint));

            settingsService.CreateSettingsMonitor<SingleValueSensorSettings>(Id, s => Settings = s);

            SetState(new ComponentState(0));

            endpoint.ValueChanged += (s, e) =>
            {
                if (!GetDifferenceIsLargeEnough(e.NewValue))
                {
                    return;
                }

                SetState(new ComponentState(e.NewValue));
            };
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:20,代码来源:HumiditySensor.cs

示例11: RollerShutterAutomation

        public RollerShutterAutomation(
            AutomationId id, 
            INotificationService notificationService,
            ISchedulerService schedulerService,
            IDateTimeService dateTimeService,
            IDaylightService daylightService,
            IOutdoorTemperatureService outdoorTemperatureService,
            IComponentService componentService,
            ISettingsService settingsService,
            IResourceService resourceService)
            : base(id)
        {
            if (notificationService == null) throw new ArgumentNullException(nameof(notificationService));
            if (dateTimeService == null) throw new ArgumentNullException(nameof(dateTimeService));
            if (daylightService == null) throw new ArgumentNullException(nameof(daylightService));
            if (outdoorTemperatureService == null) throw new ArgumentNullException(nameof(outdoorTemperatureService));
            if (componentService == null) throw new ArgumentNullException(nameof(componentService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));
            if (resourceService == null) throw new ArgumentNullException(nameof(resourceService));

            _notificationService = notificationService;
            _dateTimeService = dateTimeService;
            _daylightService = daylightService;
            _outdoorTemperatureService = outdoorTemperatureService;
            _componentService = componentService;
            _settingsService = settingsService;
            _componentService = componentService;

            resourceService.RegisterText(
                RollerShutterAutomationNotification.AutoClosingDueToHighOutsideTemperature,
                "Closing roller shutter because outside temperature reaches {AutoCloseIfTooHotTemperaure}°C.");

            settingsService.CreateSettingsMonitor<RollerShutterAutomationSettings>(Id, s => Settings = s);

            // TODO: Consider timer service here.
            schedulerService.RegisterSchedule("RollerShutterAutomation-" + Guid.NewGuid(), TimeSpan.FromMinutes(1), PerformPendingActions);
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:37,代码来源:RollerShutterAutomation.cs

示例12: MotionDetector

        public MotionDetector(ComponentId id, IMotionDetectorEndpoint endpoint, ISchedulerService schedulerService, ISettingsService settingsService)
            : base(id)
        {
            if (endpoint == null) throw new ArgumentNullException(nameof(endpoint));
            if (schedulerService == null) throw new ArgumentNullException(nameof(schedulerService));
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));

            _schedulerService = schedulerService;

            settingsService.CreateSettingsMonitor<MotionDetectorSettings>(Id, s => Settings = s);

            SetState(MotionDetectorStateId.Idle);

            endpoint.MotionDetected += (s, e) => UpdateState(MotionDetectorStateId.MotionDetected);
            endpoint.DetectionCompleted += (s, e) => UpdateState(MotionDetectorStateId.Idle);

            Settings.ValueChanged += (s, e) =>
            {
                if (e.SettingName == nameof(Settings.IsEnabled))
                {
                    HandleIsEnabledStateChanged();
                }
            };
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:24,代码来源:MotionDetector.cs

示例13: TwitterClientService

        public TwitterClientService(ISettingsService settingsService)
        {
            if (settingsService == null) throw new ArgumentNullException(nameof(settingsService));

            settingsService.CreateSettingsMonitor<TwitterClientServiceSettings>(s => Settings = s);
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:6,代码来源:TwitterClientService.cs


注:本文中的ISettingsService.CreateSettingsMonitor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。