public MainWindow()
        {
            observableContracts = new MTObservableCollection <Contract>();
            observableStations  = new MTObservableCollection <Station>();
            InitializeComponent();

            comboBox.ItemsSource     = observableContracts;
            comboStation.ItemsSource = observableStations;
            Client = new VelibServiceClient();
            Client.GetContractsListAsync(true).ContinueWith(c => contratLoaded(c.Result));
        }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     client = new VelibServiceClient();
     city   = Request.QueryString["var1"];
     getResAsync(city);
     names = res.Split('\n').ToList();
     names.Sort();
     Console.WriteLine(names.Count);
     for (int i = 0; i < names.Count; i++)
     {
         ListBox1.Items.Add(names[i]);
     }
 }
Beispiel #3
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();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            VelibServiceClient client = new VelibServiceClient("service1");

            init(client);
            Console.WriteLine("Welcome to velib.");
            while (true)
            {
                Console.WriteLine("\nWhat do you want to do:\n1. List all stations of a city;\n" +
                                  "2. Search for a station by name;\n3. Help;\n4. Quit");
                string choice = Console.ReadLine();
                if (choice == "1")
                {
                    Console.WriteLine("Please input a city:");
                    client.GetStationsOfACityAsync(Console.ReadLine());
                    Console.ReadLine();
                }
                else if (choice == "2")
                {
                    Console.WriteLine("Please input a city:");
                    string city = Console.ReadLine();
                    Console.WriteLine("Please input a station:");
                    string station = Console.ReadLine();
                    client.GetStationInfoAsync(city, station);
                    Console.ReadLine();
                }
                else if (choice == "3")
                {
                    client.GetHelpAsync();
                    Console.ReadLine();
                }
                else if (choice == "4")
                {
                    Console.WriteLine("See you later");
                    break;
                }
                else
                {
                    Console.WriteLine("Please choose from 1 to 4.");
                }
            }
        }
Beispiel #5
0
 private void InitClient()
 {
     client = new VelibServiceClient("service1");
     client.GetStationsOfACityCompleted += delegate(object sender, GetStationsOfACityCompletedEventArgs args)
     {
         result  = args.Result;
         result += "\n\n\n\n\n\n\n\n\n\n\n\n";
         CreateResultPanel();
     };
     client.GetStationInfoCompleted += delegate(object sender, GetStationInfoCompletedEventArgs args)
     {
         result = args.Result;
         CreateResultPanel();
     };
     client.GetHelpCompleted += delegate(object sender, GetHelpCompletedEventArgs args)
     {
         result = args.Result;
         CreateResultPanel();
     };
 }
Beispiel #6
0
 private static void init(VelibServiceClient client)
 {
     client.GetStationsOfACityCompleted += delegate(object sender, GetStationsOfACityCompletedEventArgs args)
     {
         result = args.Result;
         Console.WriteLine("\n" + result);
         Console.WriteLine("\nPress any key to continue...");
     };
     client.GetStationInfoCompleted += delegate(object sender, GetStationInfoCompletedEventArgs args)
     {
         result = args.Result;
         Console.WriteLine("\n" + result);
         Console.WriteLine("\nPress any key to continue...");
     };
     client.GetHelpCompleted += delegate(object sender, GetHelpCompletedEventArgs args)
     {
         result = args.Result;
         Console.WriteLine("\n" + result);
         Console.WriteLine("\nPress any key to continue...");
     };
 }
Beispiel #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     VelibServiceClient client = new VelibServiceClient();
 }