예제 #1
0
        public static async Task Main(string[] args)
        {
            var coinManager = new AsyncCoinManager();
            var coinTask    = coinManager.AcquireAsyncCoinAsync();

            Console.WriteLine("from main: I am not blocked");
            await coinTask;

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            var coinManager = new AsyncCoinManager();

            coinManager.AcquireAsyncCoinAsync();
            var savedColor = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine($"MAIN: Continue Execution at {DateTime.Now}");
            Console.ForegroundColor = savedColor;
            Console.ReadLine();
        }
예제 #3
0
        static async Task Main(string[] args)
        {
            var manager = new AsyncCoinManager();

            Console.WriteLine("Enter the number of coins you wish to aquire...");
            var input = Console.ReadLine();
            int amount;

            if (int.TryParse(input, out amount))
            {
                await manager.AcquireAsyncCoinAsync(amount);
            }
            else
            {
                Console.WriteLine("Could not parse your int!");
            }
            Console.ReadKey();
            return;
        }