Class CoreWebView2DownloadOperation
Represents a download operation. Gives access to a download's metadata and supports a user canceling, pausing, or resuming a download.
public class CoreWebView2DownloadOperation
- Inheritance
-
CoreWebView2DownloadOperation
- Inherited Members
Properties
BytesReceived
The number of bytes that have been written to the download file.
public long BytesReceived { get; }
Property Value
Examples
CanResume
Returns true if an interrupted download can be resumed.
public bool CanResume { get; }
Property Value
Remarks
Downloads with the following interrupt reasons may automatically resume without you calling any methods: ServerNoRange, FileHashMismatch, FileTooShort. In these cases progress may be restarted with BytesReceived set to 0.
ContentDisposition
The Content-Disposition header value from the download's HTTP response. If none, the value is an empty string.
public string ContentDisposition { get; }
Property Value
EstimatedEndTime
The estimated end time of the download.
public DateTime EstimatedEndTime { get; }
Property Value
InterruptReason
The reason why connection with file host was broken.
public CoreWebView2DownloadInterruptReason InterruptReason { get; }
Property Value
Remarks
See CoreWebView2DownloadInterruptReason for descriptions of reasons.
MimeType
MIME type of the downloaded content.
public string MimeType { get; }
Property Value
ResultFilePath
The absolute path to the download file, including file name.
public string ResultFilePath { get; }
Property Value
Remarks
Host can change this from ResultFilePath.
State
The state of the download. A download can be in progress, interrupted, or completed.
public CoreWebView2DownloadState State { get; }
Property Value
Remarks
See CoreWebView2DownloadState for descriptions of states.
TotalBytesToReceive
The total bytes to receive count.
public ulong? TotalBytesToReceive { get; }
Property Value
Uri
The URI of the download.
public string Uri { get; }
Property Value
Methods
Cancel()
Cancels the download.
public void Cancel()
Remarks
If canceled, the default download dialog shows that the download was canceled. Host should use Cancel if download should be canceled without displaying the default download dialog.
Pause()
Pauses the download.
public void Pause()
Remarks
If paused, the default download dialog shows that the download is paused. No effect if download is already paused. Pausing a download changes the state from in progress to interrupted, with interrupt reason set to UserCanceled.
Resume()
Resumes a paused download. May also resume a download that was interrupted for another reason if CanResume returns true.
public void Resume()
Remarks
Resuming a download changes the state from interrupted to in progress.
Events
BytesReceivedChanged
Event raised when the bytes received count is updated.
public event EventHandler<object> BytesReceivedChanged
Event Type
EstimatedEndTimeChanged
Event raised when the estimated end time changes.
public event EventHandler<object> EstimatedEndTimeChanged
Event Type
StateChanged
Event raised when the state of the download changes.
public event EventHandler<object> StateChanged
Event Type
Examples
Remarks
Use State to get the current state, and InterruptReason to get the reason if the download is interrupted.