예제 #1
0
        private void SearchWorker(FlightSearchParams searchParams, ISupplier supplier, AsyncOperation asyncOperation)
        {
            Exception exception = null;
            List<AirItinerary> itineraries = null;
            // Check that the task is still active.
            // The operation may have been canceled before
            // the thread was scheduled.
            if (!TaskCanceled(asyncOperation.UserSuppliedState))
            {
                try
                {
                    //DOWORK
                    itineraries = supplier.Search(searchParams);
                }
                catch (Exception ex)
                {
                    exception = ex;
                }

            }

            IsBusy = false;
            CompletionMethod(
                itineraries,
                supplier,
                exception,
                TaskCanceled(asyncOperation.UserSuppliedState),
                asyncOperation);
        }