Esempio n. 1
0
        static async Task Main(string[] args)
        {
            RealTimeCityBikeDataFetcher fetcher = new RealTimeCityBikeDataFetcher();
            int arvo = 0;

            arvo = await fetcher.GetBikeCountInStation("Lammasrinne");

            Console.WriteLine(arvo);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            bool realtime = true;

            if (args.Length >= 2)
            {
                if (args[1] == "realtime")
                {
                    realtime = true;
                }
                else if (args[1] == "offline")
                {
                    realtime = false;
                }
            }
            else if (args.Length == 0)
            {
                return;
            }

            Console.WriteLine(args[0]);

            string input = args[0];
            int    count = 0;

            ICityBikeDataFetcher fetchy;

            if (realtime)
            {
                fetchy = new RealTimeCityBikeDataFetcher();
            }
            else
            {
                fetchy = new OfflineCityBikeDataFetcher();
            }

            Task <int> task = fetchy.GetBikeCountInStation(input);

            task.Wait();
            count = task.Result;
            Console.WriteLine("The Bikeys: " + count.ToString());
        }