Exemple #1
0
        private void list_SelectedIndexChanged(object sender, EventArgs e)
        {
            string text = list.GetItemText(list.SelectedItem);
            string num  = text.Split('-')[0].Replace(" ", "");
            string tmp  = client.GetInfomationsOfStationByName(_ville, num);

            if (tmp != "Not Found!")
            {
                result = tmp;
                List <string> res = new List <string>();
                res = result.Split('\n').ToList();
                numOfStation.Text     = res[0];
                bikeStands.Text       = res[2];
                available_bikes.Text  = res[4];
                available_stands.Text = res[3];
                if (res[5] == "true")
                {
                    bank.Text = "Availble";
                }
                else
                {
                    bank.Text = "Not availble";
                }
                numStation.Text = res[1].Split('-')[1];
                table.Visible   = true;
            }
            else
            {
                Console.WriteLine("DoSomething!");
            }
        }
Exemple #2
0
    protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string text = ListBox1.SelectedItem.ToString();

        TextBox1.Text = text;
        string num = text.Split('-')[0].Replace(" ", "");

        if (num.Equals("0"))
        {
            num = "555";
        }
        string tmp = client.GetInfomationsOfStationByName(city, num);

        if (tmp != "Not Found!")
        {
            result        = tmp;
            TextBox1.Text = result;
            List <string> res = new List <string>();
            res           = result.Split('\n').ToList();
            TextBox2.Text = res[2];
            TextBox4.Text = res[4];
            TextBox3.Text = res[3];
            if (res[5] == "true")
            {
                TextBox5.Text = "Availble";
            }
            else
            {
                TextBox5.Text = "Not availble";
            }

            if (num.Equals("555")) //if n. station is 555, the name needs to be traited differently.
                                   //coz it is "0-555 - ATELIER VELO"
            {
                TextBox1.Text = res[1].Split('-')[2];
            }
            else
            {
                TextBox1.Text = res[1].Split('-')[1];
            }
        }
        else
        {
            TextBox1.Text = "okkkkkk";
            Console.WriteLine("DoSomething!");
        }
    }