Exemplo n.º 1
0
        public async Task <bool> InitAsync(SunConfiguration configuration)
        {
            try
            {
                _logger.LogInformation("Initiating WeatherService");

                _configuration = configuration;

                _sunDevice = new SunDevice(
                    id: "Sun_Device",
                    title: "Sol",
                    parentService: this
                    );

                var data = await RetrieveSunData(DateTime.Now);

                UpdateDeviceValues(data);

                ScheduleUpdates();

                return(true);
            }
            catch (Exception e)
            {
                _logger.LogCritical(e, "Failed to initiate WeatherService!");
                throw e;
            }
        }
Exemplo n.º 2
0
 public SunDeviceViewModel(SunDevice device) : base(device)
 {
     sunRise = device.SunRise.ToUnixTimeStamp();
     sunSet  = device.SunSet.ToUnixTimeStamp();
 }