public Program() { RegisterCommand("exit", Exit, "exit", "exit the client"); RegisterCommand("help", Help, "help", "display this"); RegisterCommand("list-contracts", ListContracts, "list-contracts", "list all the contracts"); RegisterCommand("list-stations", ListStations, "list-stations CONTRACT [NAME_FILTERS...]", "list the stations filtered by name and its available bike for a contract"); client = new JCDecauxClient("IJCDecaux"); }
async void GetContracts() { GettingData(); contractList.Clear(); stationList.Clear(); JCDecauxClient client = new JCDecauxClient("IJCDecaux"); string[] contracts = await client.GetContractsAsync(); this.progress.Value = 66; List <string> l = contracts.ToList <string>(); l.Sort(); foreach (string s in l) { contractList.Add(s); } this.resultBox.Text = "Select a contract"; this.progress.Value = 100; }
async void GetStations(string contract) { GettingData(); stationList.Clear(); List <Station> l; JCDecauxClient client = new JCDecauxClient("IJCDecaux"); Station[] stations = await client.GetStationsAsync(contract, 60); l = stations.ToList <Station>(); this.progress.Value = 66; await Task.Run(() => { l.Sort(new StationComparer()); }); contractStations = l; foreach (Station s in l) { stationList.Add(s.Name); } this.resultBox.Text = "Select a station"; this.progress.Value = 100; }