Ejemplo n.º 1
0
        public Task <decimal> GetAmountOwedToCreditCardAsync(int employeeId)
        {
            TaskCompletionSource <decimal> tcs = new TaskCompletionSource <decimal>();

            WcfExpenseService.ExpenseServiceClient client = this.CreateExpenseServiceClient();

            client.GetAmountOwedToCreditCardCompleted +=
                (_, e) =>
            {
                if (this.VerifyResult(e, tcs))
                {
                    tcs.TrySetResult(e.Result);
                }
            };
            client.GetAmountOwedToCreditCardAsync(employeeId);

            return(tcs.Task);
        }