public async Task UpdateAsync()
        {
            await UpdateWeatherCurrentAsync();
            await UpdateWeatherForecastsAsync();

            WeatherUpdated?.Invoke(this, EventArgs.Empty);
        }
        public override Result DoWork()
        {
            if (AwakeHelper.GetAwakeStatus() == AwakeStatus.Sleeping || AwakeHelper.GetAwakeStatus() == AwakeStatus.SleepingWithDeviceMotionEnabled)
            {
                return(Result.InvokeSuccess()); //We want to keep the job running but don't do the job itself while Awake is sleeping.
            }

            ConfigurationManager configurationManager = new ConfigurationManager(AppPreferences.Weather);

            string city    = configurationManager.RetrieveAValue(ConfigurationParameters.WeatherCity, "New York");
            string country = configurationManager.RetrieveAValue(ConfigurationParameters.WeatherCountryCode, "us");
            string unit    = configurationManager.RetrieveAValue(ConfigurationParameters.WeatherTemperatureMeasureUnit, "metric");

            var result = OpenWeatherMapClient.GetWeather(city, country, unit);

            if (result != null)
            {
                Log.Info("LiveDisplay", "Job Result Sucess");
                WeatherUpdated?.Invoke(null, true);
                return(Result.InvokeSuccess());
            }
            else
            {
                Log.Info("LiveDisplay", "Job Result Not Sucess");
                WeatherUpdated?.Invoke(null, false);
                return(Result.InvokeRetry());
            }
        }
        public WeatherApiReaderService(IApiHelperService <WeatherModel> apiService)
        {
            _apiService = apiService;

            Task.Run(() =>
            {
                while (WeatherUpdated == null)
                {
                    Thread.Sleep(TimeSpan.FromSeconds(3));
                }

                while (!Disposed)
                {
                    getWeather();

                    if (_currentWeather != null && _currentWeather.IsCorrect)
                    {
                        //Fire event
                        if (WeatherUpdated != null)
                        {
                            WeatherUpdated.DynamicInvoke();
                        }

                        Thread.Sleep(TimeSpan.FromMinutes(5));
                    }
                    else
                    {
                        Thread.Sleep(TimeSpan.FromSeconds(30));
                    }
                }
                ;
            });
        }