コード例 #1
0
        public async void SendOrder(List <SaleItem> saleItems)
        {
            PointOfSaleBackEnd backEnd = new PointOfSaleBackEnd();

            Console.WriteLine("FrontEnd: Started Async Work");
            Task <VerifiedOrder> orderTask = backEnd.PlaceOrderAsync(saleItems);

            Console.WriteLine("FrontEnd: Doing Other Work");
            Thread.Sleep(1000);
            Console.WriteLine("FronEnd: Retrieving Async Work");

            VerifiedOrder orderInformation = await orderTask;

            if (orderInformation != null)
            {
                Console.WriteLine($"Order Verfied: ID {orderInformation.OrderId}");
                Console.WriteLine($"Order Verfied: Total ${orderInformation.OrderTotal}");
            }
            else
            {
                Console.WriteLine("Error Placing Order With Service");
            }
        }
コード例 #2
0
 public PointOfSaleFrontEnd()
 {
     _backEnd = new PointOfSaleBackEnd();
 }