Example #1
0
        protected void ButtonResult_Click(object sender, EventArgs e)
        {
            var client = new WeatherSoapClient("WeatherSoap");

            WeatherReturn result = client.GetCityWeatherByZIP(TextBox1.Text);

            if (result.Success)
            {
                LabelCity.Text        = result.City;
                LabelState.Text       = result.State;
                LabelTemperature.Text = result.Temperature;
                LabelWind.Text        = result.Wind;
            }
            else
            {
                LabelCity.Text        = "Couldn´t be retrieved";
                LabelState.Text       = "Couldn´t be retrieved";
                LabelTemperature.Text = "Couldn´t be retrieved";
                LabelWind.Text        = "Couldn´t be retrieved";
            }
        }
Example #2
0
 private static WeatherData CreateWeatherData(WeatherReturn weatherFromService)
 {
     return(new WeatherData(
                new Temperature(int.Parse(weatherFromService.Temperature)),
                new Humidity(int.Parse(weatherFromService.RelativeHumidity))));
 }
Example #3
0
        void getWeatherByZip(string zipCode)
        {
            try
            {

                WeatherService.WeatherSoapClient client = new WeatherService.WeatherSoapClient();
                client.Open();

                WeatherReturn  ret = new WeatherReturn ();

                ret  =  client.GetCityWeatherByZIP(zipCode);

                rtxtResults.Text =  "City:        " + ret.City + Environment.NewLine
                                 + "State:       " + ret.State  + Environment.NewLine
                                 +  "Skies:       "  + ret.Description + Environment.NewLine
                                 +  "Pressure:    " + ret.Pressure + Environment.NewLine
                                 +  "Humidity:    " + ret.RelativeHumidity + Environment.NewLine
                                 +  "Temperature: " + ret.Temperature + Environment.NewLine
                                 +  "Wind:        " + ret.Wind + Environment.NewLine;

            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }