protected void btnGetWeather_Click(object sender, EventArgs e)
        {
            WeatherService.WeatherSoapClient client = new WeatherService.WeatherSoapClient("WeatherSoap");
            WeatherService.WeatherReturn result = client.GetCityWeatherByZIP(txtZip.Text);
            if (result.Success)
            {
                lblCity.Text = result.City;
                lblState.Text = result.State;
                lblTemperature.Text = result.Temperature;
                lblWeatherStationCity.Text = result.WeatherStationCity;
                lblWind.Text = result.Wind;
            }
            else
            {
                lblError.Text = result.ResponseText;
                lblCity.Text = string.Empty;
                lblState.Text = string.Empty;
                lblTemperature.Text = string.Empty;
                lblWeatherStationCity.Text = string.Empty;
                lblWind.Text = string.Empty;
            }

        }
Example #2
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());
            }
        }