Пример #1
0
        public formWeather()
        {
            InitializeComponent();
            BasicHttpBinding binding = new BasicHttpBinding();

            binding.MaxReceivedMessageSize = 20000000;

            EndpointAddress address = new EndpointAddress("http://www.webservicex.com/globalweather.asmx");

            GlobalWeatherSoapClient gwsc = new GlobalWeatherSoapClient(binding, address);

            var           cities = gwsc.GetCitiesByCountry("");
            XmlSerializer result = new XmlSerializer(typeof(Cities.NewDataSet));

            cn = (Cities.NewDataSet)result.Deserialize(new StringReader(cities));

            var Countries = cn.Table.Select(m => m.Country).Distinct();

            comboBoxCountries.Items.AddRange(Countries.ToArray());
        }
Пример #2
0
        public formWeather()
        {
            InitializeComponent();
            binding.MaxReceivedMessageSize = 2000000;

            GlobalWeatherSoapClient gwsc = new GlobalWeatherSoapClient(binding, address);

            var cities = gwsc.GetCitiesByCountry("");

            XmlSerializer result = new XmlSerializer(typeof(Cities.NewDataSet));

            cn = (Cities.NewDataSet)result.Deserialize(new StringReader(cities));

            var Countries = cn.Table.Select(x => x.Country).Distinct();

            comboBoxCountries.Items.AddRange(Countries.ToArray());
            var Cities = cn.Table.Select(x => x.City).Distinct();

            comboBoxCities.Items.AddRange(Cities.ToArray());
        }