コード例 #1
0
ファイル: WeatherDialog.cs プロジェクト: szaoudis/MamaBot
        private async Task <DialogTurnResult> WeatherResultStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var Intent  = stepContext.Result.ToString();
            var weather = await WeatherApi.GetWeather(Intent);

            var weatherOk = weather.ToString();
            await stepContext.Context.SendActivityAsync(weatherOk);


            return(await stepContext.EndDialogAsync(null, cancellationToken));
        }
コード例 #2
0
        async void GetWeather(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(cityIdEntry.Text))
            {
                Weather weather = await WeatherApi.GetWeather(cityIdEntry.Text);

                if (weather != null)
                {
                    this.BindingContext = weather;
                    getWeatherBtn.Text  = "Search Again";
                }
            }
        }
コード例 #3
0
        private async void loadWeather()
        {
            WeatherApi  weatherApi = new WeatherApi();
            WeatherInfo weather;
            var         city = settingsMgr.getStringSettings(SettingKey.CITY_NAME_KEY);

            if (city != null)
            {
                weather = await weatherApi.GetWeatherByCity(city);
            }
            else
            {
                weather = await weatherApi.GetWeather("30047");
            }

            if (weather != null)
            {
                weatherLbl.Text = weather.WeatherDisplayText;
                BitmapImage bitmap = new BitmapImage(new Uri(base.BaseUri, @"/Assets/" + weather.IconString + ".png"));
                weatherIcon.Source = bitmap;

                // "/Assets/" + weather.IconString + ".png";
            }
        }
コード例 #4
0
 public void DefineBackgroundWeather(WeatherApi api)
 {
     // Define which group images to use
     weather = api.GetWeather();
 }
コード例 #5
0
        public string Get()
        {
            weatherApi.GetWeather();

            return("OK");
        }