コード例 #1
0
        public async Task Invoke(HttpContext context, GetWeatherHttpClient customHttpClient)
        {
            var weatherJson = await customHttpClient.GetLocationWeatherInfo();

            context.Response.ContentType = "application/json;utf-8";
            await context.Response.WriteAsync(weatherJson);   // 输出天气json

            //await this._next(context);
        }
コード例 #2
0
 /// <summary>
 /// 可注入其它服务,以获取外部配置
 /// </summary>
 public ConfigureWeatherOptions(GetWeatherHttpClient customHttpClient)
 {
     this._customHttpClient = customHttpClient;
 }
コード例 #3
0
 public WeatherViewComponent(GetWeatherHttpClient httpClient)
 {
     this._weatherHttpClient = httpClient;
 }
コード例 #4
0
 public GetWeatherHttpClientJob(ILogger <GetWeatherHttpClientJob> logger, GetWeatherHttpClient client)
 {
     this._client = client;
     this._logger = logger;
 }