/// <summary> /// Attaches a BackgroundDownloadCompletedEventAdapter to the given BackgroundTransferRequest. /// This is to convert a BackgroundTransferRequest's status changes to a LiveOperationResult. /// </summary> /// <param name="request">Request to attach to.</param> /// <returns>A Task<LiveOperationResult> converted over from a BackgroundTransferEventArgs.</returns> public Task<LiveOperationResult> ConvertTransferStatusChangedToTask(BackgroundTransferRequest request) { Debug.Assert(request != null); var completedEventAdapter = new BackgroundDownloadCompletedEventAdapter(this.backgroundTransferService, this.tcs); completedEventAdapter.BackgroundTransferRequestCompleted += this.OnBackgroundTransferRequestCompletedEventAdapter; return completedEventAdapter.ConvertTransferStatusChangedToTask(request); }
/// <summary> /// Attaches a BackgroundDownloadCompletedEventAdapter to the given BackgroundTransferRequest. /// This is to convert a BackgroundTransferRequest's status changes to a LiveOperationResult. /// </summary> /// <param name="request">Request to attach to.</param> /// <returns>A Task<LiveOperationResult> converted over from a BackgroundTransferEventArgs.</returns> public Task <LiveOperationResult> ConvertTransferStatusChangedToTask(BackgroundTransferRequest request) { Debug.Assert(request != null); var completedEventAdapter = new BackgroundDownloadCompletedEventAdapter(this.backgroundTransferService, this.tcs); completedEventAdapter.BackgroundTransferRequestCompleted += this.OnBackgroundTransferRequestCompletedEventAdapter; return(completedEventAdapter.ConvertTransferStatusChangedToTask(request)); }