コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceControl"/> class.
        /// </summary>
        internal ServiceControl()
        {
            _logger         = LogManager.GetCurrentClassLogger();
            _monitoringTask = new MonitoringTask(MonitoringConfig.ReadFromAppSettings());

            _logger.Info(Const.Messages.ServiceInitialized);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MonitoringTask"/> from the provided <see cref="MonitoringConfig"/>.
        /// </summary>
        /// <param name="configuration">The current monitoring configuration.</param>
        public MonitoringTask(MonitoringConfig configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            _logger         = LogManager.GetCurrentClassLogger();
            _batteryWrapper = new BatteryWrapper(configuration.MinimumLevel, configuration.MinimumRunTime);
            _checkInterval  = configuration.CheckInterval;
        }