Show / Hide Table of Contents

Class FileDownloadTask

Task for helping managing large downloads that can be paused and resumed across application sessions.

Inheritance
object
FileDownloadTask
Implements
IDisposable
IJsonOnDeserialized
Namespace: Esri.ArcGISRuntime.Toolkit
Assembly: Esri.ArcGISRuntime.Toolkit.Maui.dll
Syntax
public sealed class FileDownloadTask : IDisposable, IJsonOnDeserialized
Remarks

Once a download has started, you should call ToJson() to serialize the task to a string. This allows you to resume the download later if the app closes for whatever reason before the download completes.

Properties

Name Description
BufferSize

Gets or sets the buffer size used for downloading the file. The default is 65535 bytes.

BytesDownloaded

The number of bytes downloaded so far.

DownloadSpeed

Gets the current download speed as bytes per second based on a moving average calculation

Exception

Gets the the exception of the download if it failed.

IsResumable

Gets a value indicating whether the download can be resumed from the last position, or will start over on resume.

MaxConcurrentDownloads

Gets or sets the maximum number of downloads that can be in progress at the same time before getting queued. The default is 3.

Priority

Gets or sets the download priority if multiple items are queued. The higher the number, the higher the priority of the download.

Status

Gets the current download status of the download.

TotalLength

The total length of the file being downloaded. This is only available if the server provides the content length.

Methods

Name Description
BeginDownloadAsync(string, Uri, HttpMessageHandler?, CancellationToken)

Initiates a download to the specified file from the specified URL

CancelAsync()

Aborts the running download and deletes the partial download.

ClearQueue()

Clears any downloads still in the download queue. This will pause all downloads that are queued, and remove them from the queue.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

~FileDownloadTask()
FromJson(string, HttpMessageHandler?)

Restores a previously serialized FileDownloadTask from a JSON string.

PauseAsync()

Pauses the active download.

RestartAsync(CancellationToken)

Restarts the download from the beginning.

ResumeAsync(CancellationToken)

Resumes the download from the last position.

ToJson()

Serializes the current FileDownloadTask to a JSON string for later resuming downloads.

Events

Name Description
Completed

Event raised when the download is completed successfully.

Error

Event raised when an error occurs during the download.

Progress

Event raised as the download progresses.

StatusChanged

Event triggered when the Status property changes.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX