DRAG DROP
You need to recommend which code must be implemented to meet the requirements for resuming
the video tour downloads.
Develop the solution by selecting and ordering the required code snippets. You may not need all of
the code snippets.
Answer: See the explanation.
Explanation:
Note:
* GetCurrentDownloadsAsync
Returns a collection of pending downloads that are not associated with a group.
* await Task.WhenAny
By using Task.WhenAny, you can start multiple tasks at the same time and process them one by one
as they’re completed rather than process them in the order in which they’re started.
* From scenario:
/When a customer clicks the details of a listing, the app must start downloading the video tour in the
background.
/ When the app starts, the app must verify whether there are any pending downloads, and resume
any paused downloads.
/ When downloading the video tours, the app must remain responsive, and each download must be
processed on a separate thread.
Incorrect:
* Not: await Task.WhenAll (need separate threads)
You apply the Task.WhenAll method to a collection of tasks. The application of WhenAll returns a
single task that isn’t complete until every task in the collection is completed. The tasks appear to run
in parallel, but no additional threads are created. The tasks can complete in any order.
* Not: RequestUnconstrainedDownloadsAsync
Used to request an unconstrained download operation. When this method is called the user is
provided with a UI prompt that they can use to indicate their consent for an unconstrained
operation.
An unconstrained transfer operation will run without the resource restrictions normally associated
with background network operations while a device is running on battery.