protected void Page_Load(object sender, EventArgs e)
 {
     GlobalWeather gw = new GlobalWeather();
     Label1.Text = gw.GetWeather("lucknow", "india");
     DropDownList1.DataSource = gw.GetCitiesByCountry("india");
     DropDownList1.DataBind();
     GridView1.DataSource = gw.GetCitiesByCountry("pakistan");
     GridView1.DataBind();
 }
Ejemplo n.º 2
0
        protected void ddlPays_SelectedIndexChanged(object sender, EventArgs e)
        {
            GlobalWeather service = new GlobalWeather();

            string Data = service.GetCitiesByCountry(ddlPays.Text);

            //XmlReader xtr = new XmlTextReader(new System.IO.StringReader(Data));

            XElement city = XElement.Load(new System.IO.StringReader(Data));

            ddlVilles.Items.Clear();

            foreach (XElement name in city.Elements("Table").Elements("City"))
            {
                ddlVilles.Items.Add(name.Value);
            }
        }
Ejemplo n.º 3
0
    public static void Main(string[] args)
    {
        // Create instance of the GlobalWeather.dll.
        GlobalWeather Weather = new GlobalWeather();

        // Get input from user.
        // NOTE: An input value of "France" does work (as of 23/10/2016).
        Console.Write("Enter Country: ");
        string Country = Console.ReadLine();

        string Data = Weather.GetCitiesByCountry(Country);

        Console.WriteLine(Data);

        //converting the string Respsonse to XML
        //XmlTextReader xtr = new XmlTextReader(new System.IO.StringReader(Data));
        //DataSet ds = new DataSet();
        //ds.ReadXml(xtr);
        //Console.Write(ds.GetXml());
    }