public BluffWeatherAirline(BluffWeather bluffWeather)
 {
     NameOfCity  = bluffWeather.NameOfCity;
     Country     = bluffWeather.Country;
     Temperature = bluffWeather.Temperature;
     Clouds      = bluffWeather.Clouds;
 }
示例#2
0
        public async Task RunAsync()
        {
            Console.WriteLine("Starting WeatherEnricher");
            BluffWeather lastUpdate = null;

            while (true)
            {
                // Calling open weather map
                var openWeatherModel = await GetCurrentWeather();

                // Translating to local model and filtering excess data.
                var localModel = TranslateToLocalModel(openWeatherModel);

                // Check if data has been changed since last update
                // Could be expanded to affect wait time.
                if (lastUpdate == null || !lastUpdate.Equals(localModel))
                {
                    //Send update to system
                    ProduceUpdate(localModel);
                    lastUpdate = localModel;
                    Console.WriteLine("Updates produced.");
                }
                else
                {
                    Console.WriteLine("Data was the same as last update. No Updates produced.");
                }
                //ProduceUpdate(localModel);
                Thread.Sleep(2000);
            }
        }
示例#3
0
 public BluffWeatherAIC(BluffWeather bluffWeather)
 {
     NameOfCity  = bluffWeather.NameOfCity;
     Country     = bluffWeather.Country;
     Temperature = bluffWeather.Temperature;
     Sunrise     = bluffWeather.Sunrise;
     Sunset      = bluffWeather.Sunset;
 }
示例#4
0
 public BluffWeatherATCC(BluffWeather bluffWeather)
 {
     NameOfCity  = bluffWeather.NameOfCity;
     Lat         = bluffWeather.Lat;
     Lon         = bluffWeather.Lon;
     Country     = bluffWeather.Country;
     Temperature = bluffWeather.Temperature;
     Pressure    = bluffWeather.Pressure;
     Humidity    = bluffWeather.Humidity;
     WindSpeed   = bluffWeather.WindSpeed;
     WindDeg     = bluffWeather.WindDeg;
     Clouds      = bluffWeather.Clouds;
     Visibility  = bluffWeather.Visibility;
 }
示例#5
0
 private void ProduceUpdate(BluffWeather bluffWeather)
 {
     _fanoutChannel.BasicPublish(_channelName + "Exchange", "", null, Encoding.ASCII.GetBytes(JsonSerializer.Serialize(bluffWeather)));
 }