public MainWindow() { velibClient = new ServiceVelib.VelibIntermediaryClient(); InitializeComponent(); GetCities(); CityName.SelectionChanged += GetSations; StationName.TextChanged += (sender, args) => { StationView.ItemsSource = stations.FindAll(station => station.Name.ToLowerInvariant().Contains(StationName.Text.ToLowerInvariant())); }; }
private static async void getCommand(string command, VelibIntermediaryClient client) { switch (command) { case nameof(client.GetStations): Console.Write("City name: "); var city = Console.ReadLine(); var stations = await client.GetStationsAsync(city); foreach (var station in stations) { Console.WriteLine($"{station.Name} available bikes: {station.available_bikes}"); } break; case nameof(client.GetContracts): var contracts = await client.GetContractsAsync(); foreach (var contract in contracts) { Console.WriteLine(contract.name); } Console.WriteLine(contracts); break; case "exit": System.Environment.Exit(0); break; default: { Console.WriteLine("The commands are"); Console.WriteLine(nameof(client.GetContracts)); Console.WriteLine(nameof(client.GetStations)); Console.WriteLine("exit"); Console.WriteLine("help"); break; } } }