Exemple #1
0
        private void SearchBike_Click(object sender, EventArgs e)
        {
            string station      = stationBox.Text;
            string bikeResponse = client.searchBikeNum(cityBox.Text, stationName.Text);

            if (bikeResponse == "-1")
            {
                Form2 form = new Form2();
                form.Show();
                form.errorText("No such station!");
            }
            else
            {
                bikeNum.Text = bikeResponse;
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            VelibServiceClient client = new VelibServiceClient();
            string             help   = "This application is for searching the velib information of each city. "
                                        + "\nInput the name of a city you'll get all the stations of this city"
                                        + "\nInput the name of a station in this city you'll get the number of available bikes of this station";

            do
            {
                Console.WriteLine(help);
            } while (String.Compare(Console.ReadLine(), "help", true) == 0);

            string cities = client.getCities();

            Console.WriteLine("There are those contracts: " + cities);

            Console.WriteLine("\n\nInput the city:");
            string city            = Console.ReadLine();
            string stationResponse = client.searchStations(city);

            if (stationResponse == "-1")
            {
                Console.WriteLine("No such city.");
            }
            else
            {
                Console.WriteLine(stationResponse.Length);
                Console.WriteLine("The stations of " + city + " are: " + stationResponse);
            }

            Console.WriteLine("\n\nInput the station: ");
            string station      = Console.ReadLine();
            string bikeResponse = client.searchBikeNum(city, station);

            if (bikeResponse == "-1")
            {
                Console.WriteLine("No such station.");
            }
            else
            {
                Console.WriteLine("The number of available bike is: " + bikeResponse);
            }
            Console.ReadLine();
        }