Esempio n. 1
0
        /// <summary>
        /// Gets list of City based on Country
        /// </summary>
        /// <param name="Country"></param>
        /// <returns></returns>
        private List <string> getList(string Country)
        {
            XmlNodeList xmlNodes = weather.GetCountryAndCityData().GetElementsByTagName("Country");

            List <string> cityList = new List <string>();

            foreach (XmlNode node in xmlNodes)
            {
                if (node.InnerText == Country)
                {
                    if (!cityList.Contains(node.NextSibling.InnerText))
                    {
                        //Loop through the country names and put them in to a list object
                        cityList.Add(node.NextSibling.InnerText);
                    }
                }
            }
            cityList.Sort();
            return(cityList);
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();
            CountryDropDownList.DropDownStyle = ComboBoxStyle.DropDownList;
            CityDropDownList.DropDownStyle = ComboBoxStyle.DropDownList;

            weather = new WeatherService.WeatherModel();

            XmlNodeList xmlNodes = weather.GetCountryAndCityData().GetElementsByTagName("Country");
            List<string> countryList = new List<string>();
            foreach (XmlNode node in xmlNodes)
            {
                if (!countryList.Contains(node.InnerText))
                {
                    //Loop through the country names and put them in to a list object
                    countryList.Add(node.InnerText);
                }
            }
            countryList.Sort();

            //Bind the CountryDropDownList control.
            this.CountryDropDownList.DataSource = countryList;
        }
Esempio n. 3
0
        public Form1()
        {
            InitializeComponent();
            CountryDropDownList.DropDownStyle = ComboBoxStyle.DropDownList;
            CityDropDownList.DropDownStyle    = ComboBoxStyle.DropDownList;

            weather = new WeatherService.WeatherModel();

            XmlNodeList   xmlNodes    = weather.GetCountryAndCityData().GetElementsByTagName("Country");
            List <string> countryList = new List <string>();

            foreach (XmlNode node in xmlNodes)
            {
                if (!countryList.Contains(node.InnerText))
                {
                    //Loop through the country names and put them in to a list object
                    countryList.Add(node.InnerText);
                }
            }
            countryList.Sort();

            //Bind the CountryDropDownList control.
            this.CountryDropDownList.DataSource = countryList;
        }