static void Main(string[] args) { Console.WriteLine(args[0]); RealTimeCityBikeDataFetcher fetchiBoi = new RealTimeCityBikeDataFetcher(); Task <int> task = fetchiBoi.GetBikeCountInStation(args[0]); task.Wait(); int bikes = task.Result; Console.WriteLine("Bikes awailable: " + bikes.ToString()); }
static void Main(string[] args) { bool online = true; if (args[0] != null) { Console.WriteLine(args[0]); if (args[0] == "offline") { online = false; } else if (args[0] == "online") { online = true; } } else { Console.WriteLine("No arguments given! Trying to use online sources\n"); } ICityBikeDataFethcer fetcher; if (online) { fetcher = new RealTimeCityBikeDataFetcher(); } else { fetcher = new OfflineCityBikeDataFetcher(); } Console.WriteLine("Minkä aseman haluat tarkistaa? "); string name = Console.ReadLine(); //ks. launch.json, ei toimi internalConsolella // Console.WriteLine("Trying with: " + name); var task = fetcher.GetBikeCountInStation(name); task.Wait(); int result = task.Result; Console.WriteLine(result); Console.ReadKey(); }