public WeatherService(HttpClient client, IHttpContextAccessor context, IWeatherProvider provider, ILogger <WeatherService> logger) { _client = client; _context = context; _provider = provider; _logger = logger; }
public WeatherForecastController( ILogger <WeatherForecastController> logger, IWeatherProvider weatherProvider) { this.logger = logger; this.weatherProvider = weatherProvider; }
public WeatherModule(IWeatherProvider weatherProvider) { Get("/", args => "/current/{zip}"); Get("/current/{zip}", args => { var zip = args["zip"]; try { var serializedWeather = JsonConvert.SerializeObject(weatherProvider.GetCurrent(zip)); var weatherBytes = Encoding.UTF8.GetBytes(serializedWeather); return(new Response { StatusCode = HttpStatusCode.OK, ContentType = "application/json", Contents = s => s.Write(weatherBytes, 0, weatherBytes.Length) }); } catch (CommunicationException e) { var exceptionMessageBytes = Encoding.UTF8.GetBytes(e.Message); return(new Response { StatusCode = HttpStatusCode.ServiceUnavailable, ContentType = "application/json", Contents = s => s.Write(exceptionMessageBytes, 0, exceptionMessageBytes.Length) }); } }); }
public AveragetemperatureDisplay(IWeatherProvider wd) { weatherData = wd; temperatures = new List<float>(); humidities = new List<float>(); pressures = new List<float>(); }
public LightManager(ITelldus telldus, IWeatherProvider weatherProvider) { _telldus = telldus; _weatherProvider = weatherProvider; _sections = new Collection <LampSection>(); SetupSections(); }
public CurrentConditionsDisplay(IWeatherProvider wd) { weatherData = wd; tempurature = 0.0F; humidity = 0.0F; pressure = 0.0F; }
public void Add(IWeatherProvider provider) { if (!_providersList.Contains(provider)) { _providersList.Add(provider); } }
public TenDaysWeatherProvider( ICityInfoProvider cityInfoProvider, IWeatherProvider weatherProvider) { _cityInfoProvider = cityInfoProvider; _weatherProvider = weatherProvider; }
private async void BeginInitialize() { // Setup the database. db = new DatabaseHelper(this); // Use the intent values to bind to a specific network ID. long networkID = Intent.GetLongExtra(EXTRA_NETWORK_ID, -1); if (networkID != -1) { solarNetwork = await db.SolarNetworks.SelectByIdAsync(networkID); SupportActionBar.Title = solarNetwork.Name; } else { throw new InvalidProgramException(); } // Get the weather service. weatherProvider = ServiceManager.Resolve <IWeatherProvider>(); // Get the calculator service. powerCalculator = ServiceManager.Resolve <IPowerCalculator>(); // Initialize the PVWatts Client. pvWattsApiClient = new PVWattsV5ApiClient(apiKey: Secrets.PVWattsApiKey); // Setup the network card InitializeCards(); }
/// <summary> /// Sends Weather. /// </summary> private static void Weather(Action <Packet> sender, IWeatherProvider provider) { var packet = new Packet(Op.Weather, MabiId.Broadcast); packet.PutByte(0); packet.PutInt(provider.RegionId); if (provider is IWeatherProviderTable) { var table = (IWeatherProviderTable)provider; packet.PutByte(0); packet.PutInt(table.GroupId); packet.PutByte(2); packet.PutByte(1); packet.PutString("table"); packet.PutString(table.Name); packet.PutLong(0); packet.PutByte(0); } else if (provider is IWeatherProviderConstant) { var constant = (IWeatherProviderConstant)provider; // Packet structure is guessed, even though it works, // based on constant_smooth. packet.PutByte(2); packet.PutByte(0); packet.PutByte(1); packet.PutString("constant"); packet.PutFloat(constant.Weather); packet.PutLong(0); packet.PutByte(0); } else if (provider is IWeatherProviderConstantSmooth) { var constantSmooth = (IWeatherProviderConstantSmooth)provider; packet.PutByte(2); packet.PutByte(0); packet.PutByte(1); packet.PutString("constant_smooth"); packet.PutFloat(constantSmooth.Weather); packet.PutLong(DateTime.Now); // Start packet.PutLong(DateTime.MinValue); // End packet.PutFloat(constantSmooth.WeatherBefore); packet.PutFloat(constantSmooth.WeatherBefore); packet.PutLong(constantSmooth.TransitionTime); packet.PutByte(false); // bool? Is table appended? byte? Appended type? packet.PutLong(DateTime.MinValue); // End packet.PutInt(2); // Append a table packet here to go back to that after end packet.PutByte(0); } sender(packet); }
public WeatherService(ILogger <WeatherService> logger, WeatherServiceSettings settings, IWeatherProvider weatherProvider) { _logger = logger; _settings = settings; _weatherProvider = weatherProvider; }
public IEnumerable <WeatherForecast> GetForeCast(string location, IWeatherProvider weatherProvider) { if (weatherProvider == null) { throw new ArgumentNullException(nameof(weatherProvider)); } return(weatherProvider.GetForecastOfLocation(location)); }
public WeatherController(ILogger logger, IStorage storage, IWeatherProvider provider, IWeatherDisplayer displayer) { _logger = logger; _storage = storage; _provider = provider; _displayer = displayer; _storage.DataSaved += _displayer.Display; }
/// <summary> // Gets the Weather Information for given cityId /// </summary> /// <param name="cityId"></param> /// <returns>WheatheInfo</returns> public async Task <WeatherInfo> Get(string cityId) { var WeatherProvider = new WeatherProvider(); IWeatherProvider Weather = WeatherProvider.FactoryMethod(_WeatherInfoProvider); WeatherInfo WeatherInfo = await Weather.GetWeatherInfo(cityId); return(WeatherInfo); }
public InputParserEntryPoint(IInteractionStrategy sender, DatabaseWorkerProxy proxy, string owmToken) { sender.Incoming += Incoming; _database = proxy; _parser = new InputParser(); _directSender = new OutcomingSender(); _weather = new OpenWeatherMap(owmToken); }
public WeatherFinder( [Dependency("Bbc")]IWeatherProvider bbcWeatherProvider, [Dependency("Accu")]IWeatherProvider accuWeatherProvider ) { _bbcWeatherProvider = bbcWeatherProvider; _accuWeatherProvider = accuWeatherProvider; }
public WeatherFinder( [Dependency("Bbc")] IWeatherProvider bbcWeatherProvider, [Dependency("Accu")] IWeatherProvider accuWeatherProvider ) { _bbcWeatherProvider = bbcWeatherProvider; _accuWeatherProvider = accuWeatherProvider; }
/// <summary> /// Sends Weather. /// </summary> private static void Weather(Action<Packet> sender, IWeatherProvider provider) { var packet = new Packet(Op.Weather, MabiId.Broadcast); packet.PutByte(0); packet.PutInt(provider.RegionId); if (provider is IWeatherProviderTable) { var table = (IWeatherProviderTable)provider; packet.PutByte(0); packet.PutInt(table.GroupId); packet.PutByte(2); packet.PutByte(1); packet.PutString("table"); packet.PutString(table.Name); packet.PutLong(0); packet.PutByte(0); } else if (provider is IWeatherProviderConstant) { var constant = (IWeatherProviderConstant)provider; // Packet structure is guessed, even though it works, // based on constant_smooth. packet.PutByte(2); packet.PutByte(0); packet.PutByte(1); packet.PutString("constant"); packet.PutFloat(constant.Weather); packet.PutLong(0); packet.PutByte(0); } else if (provider is IWeatherProviderConstantSmooth) { var constantSmooth = (IWeatherProviderConstantSmooth)provider; packet.PutByte(2); packet.PutByte(0); packet.PutByte(1); packet.PutString("constant_smooth"); packet.PutFloat(constantSmooth.Weather); packet.PutLong(DateTime.Now); // Start packet.PutLong(DateTime.MinValue); // End packet.PutFloat(constantSmooth.WeatherBefore); packet.PutFloat(constantSmooth.WeatherBefore); packet.PutLong(constantSmooth.TransitionTime); packet.PutByte(false); // bool? Is table appended? byte? Appended type? packet.PutLong(DateTime.MinValue); // End packet.PutInt(2); // Append a table packet here to go back to that after end packet.PutByte(0); } sender(packet); }
public WeatherForecastController( IForecastProvider forecastProvider, IWeatherProvider weatherProvider, IOptions <WeatherForecastProviderSettings> weatherForecastProviderSettingsAccessor) { _forecastProvider = forecastProvider; _weatherProvider = weatherProvider; _weatherForecastProviderSettings = weatherForecastProviderSettingsAccessor.Value; }
public WeatherSkypnetModule(IWeatherProvider weatherProvider) { if (weatherProvider == null) { throw new ArgumentNullException("weatherProvider"); } this.weatherProvider = weatherProvider; }
public PVOutput(IAppSettings appSettings, ILogger logger, IWeatherProvider weatherProvider) { apiKey = appSettings.PVOutputApiKey; systemId = appSettings.PVOutputSystemId; this.logger = logger; this.weatherProvider = weatherProvider; logger.WriteLine($"Use PVOutput: {systemId}"); }
public static IWeatherProvider get() { if (_self == null) { _self = new WeatherProviderNGS(); } _refcounter++; return(_self); }
public static IWeatherProvider get(IWeatherReader reader = null) { if (_self == null) { _self = new WeatherProviderYandex(reader); } _refcounter++; return(_self); }
public async Task <IEnumerable <DailyWeatherBE> > GetWeatherForecasts(WeatherProviderType providerType, WeatherParamsData model) { IWeatherProvider provider = _providers.FirstOrDefault(x => x.ProviderType == providerType); if (provider == null) { throw new NotSupportedException(nameof(providerType)); } return(await provider.GetWeatherForecasts(model)); }
public CachedWeatherProvider( ILogger <IWeatherProvider> logger, IWeatherProviderFactory weatherProviderFactory, IMemoryCache memoryCache, IOptions <CachedWeatherProviderSettings> settings) { _internalProvider = weatherProviderFactory.GetWeatherProvider(settings.Value.InternalType); _logger = logger; _memoryCache = memoryCache; _settings = settings; }
public JsonResult Get(string provider, decimal latitude, decimal longitude) { var weatherDashboardModel = new WeatherDashboardModel(); weatherProvider = DependencyConfig.Container.GetInstance <IWeatherProvider>(provider); weatherDashboardModel = weatherProvider.GetForecast(latitude, longitude); var model = mapper.Map(weatherDashboardModel); return(Json(model, JsonRequestBehavior.AllowGet)); }
public ModifyWeatherController(IWeatherProvider provider) { _provider = provider; HighTextControl = new TextControl(); var conditions = provider.GetCurrentWeatherConditions(); _currentConditions = conditions; Condition = conditions.Condition; HighTextControl.Text = conditions.High.ToString(); Low = conditions.Low; }
public DashboardController( ILogger <HomeController> logger, IPhotoProvider photoProvider, IWeatherProvider weatherProvider, IQuoteRepository quoteRepository, UserManager <ApplicationUser> userManager) { _logger = logger; _photoProvider = photoProvider; _weatherProvider = weatherProvider; _quoteRepository = quoteRepository; _userManager = userManager; }
public WeatherService(IWeatherProvider weatherProvider) { _weatherProvider = weatherProvider; _weatherIdsMap = new Dictionary <int, Weather>() { { 200, Weather.ThunderStorm }, { 300, Weather.Drizzle }, { 500, Weather.Rain }, { 600, Weather.Snow }, { 800, Weather.Sunny }, { 802, Weather.Cloudy } }; }
private void update_Humidity(IWeatherProvider provider, WeatherPeriod period) { double hum; if (provider.get_humidity(period, out hum)) { Humidity = hum; Weather_Status_Humidity = true; } else { Weather_Status_Humidity = false; } }
private void update_Pressure(IWeatherProvider provider, WeatherPeriod period) { double press; if (provider.get_pressure(period, out press)) { Pressure = press; Weather_Status_Pressure = true; } else { Weather_Status_Pressure = false; } }
private static void SetupServices() { weatherProvider = new WeatherProvider(new List <IApiService> { new BbcWeather() { Location = LocationInput }, new AccWeather() { Where = LocationInput } }); }
public void Init() { apis = new List <IApiService> { new AccWeather { TemperatureFahrenheit = 68, WindSpeedMph = 10 }, new BbcWeather { TemperatureCelsius = 10, WindSpeedKph = 8 } }; apiServices = new WeatherProvider(apis); }
/// <summary> /// Gets the Weather Information for all the cities from master city.json file /// </summary> /// <returns></returns> public async Task <HttpResponseMessage> GetAll() { var WeatherProvider = new WeatherProvider(); IWeatherProvider Weather = WeatherProvider.FactoryMethod(_WeatherInfoProvider); bool success = await Weather.GetBulkWeatherInfo(); if (success) { return(new HttpResponseMessage(System.Net.HttpStatusCode.OK)); } else { return(new HttpResponseMessage(System.Net.HttpStatusCode.InternalServerError)); } }
public void Initialize() { this.weatherProvider = new GismeteoProvider(new HtmlWeb()); }
public HomeController(IRepository repository, IWeatherProvider weatherProvider, IUnitConverter unitConverter) { _repository = repository; _weatherProvider = weatherProvider; _unitConverter = unitConverter; }
/// <summary> /// Sends Weather to creature's client. /// </summary> public static void Weather(Creature creature, IWeatherProvider provider) { Send.Weather(creature.Client.Send, provider); }
/// <summary> /// Sets provider for region and updates clients in it. /// </summary> /// <param name="regionId"></param> /// <param name="provider"></param> public void SetProviderAndUpdate(int regionId, IWeatherProvider provider) { _providers[regionId] = provider; this.Update(provider.RegionId); }
/// <summary> /// Broadcasts Weather in region. /// </summary> public static void Weather(Region region, IWeatherProvider provider) { Send.Weather(region.Broadcast, provider); }
public void OnInitialize() { WeatherProvider = new FF14AnglerWeatherProvider(); }
public void OnShutdown() { WeatherProvider = null; }
/// <summary> /// Creates a new <see cref="WeatherRegionForecast"/> instance using an /// explicit weather provider. /// </summary> /// <param name="weatherProvider">Override the default Weather provider.</param> public WeatherRegionForecast(IWeatherProvider weatherProvider) { this._weatherProvider = weatherProvider; }
public void Initialize() { this.weatherProvider = new SinoptikProvider(new HtmlWeb()); }
/// <summary> /// Initializes a new instance of the <see cref="WeatherModule" /> class. /// </summary> /// <param name="ircClient">The irc client.</param> /// <param name="weatherProvider">The weather provider.</param> public WeatherModule(IIrcClient ircClient, IWeatherProvider weatherProvider) : base(ircClient) { this.weatherProvider = weatherProvider; }
/// <summary> /// Creates a new <see cref="WeatherRegionForecast"/> instance using an /// explicit weather provider. /// </summary> /// <param name="weatherProvider">Weather provider.</param> /// <param name="locationID">Location ID.</param> /// <param name="description">Description.</param> public WeatherRegionForecast(IWeatherProvider weatherProvider, string locationID, string description) : this(_defaultWeatherProvider) { this.LocationId = locationID; this.Description = description; }