Compartilhar via


CoreWebView2DownloadOperation.StateChanged Event

Definition

Event raised when the state of the download changes. Use @CoreWebView2DownloadOperation$.State to get the current state, and @CoreWebView2DownloadOperation$.InterruptReason to get the reason if the download is interrupted.

public event EventHandler<object> StateChanged;
member this.StateChanged : EventHandler<obj> 
Public Custom Event StateChanged As EventHandler(Of Object) 

Event Type

Examples

download.StateChanged += delegate (object sender, Object e)
{
    switch (download.State)
    {
        case CoreWebView2DownloadState.InProgress:
            break;
        case CoreWebView2DownloadState.Interrupted:
            // Here developer can take different actions based on `download.InterruptReason`.
            // For example, show an error message to the end user.
            break;
        case CoreWebView2DownloadState.Completed:
            break;
    }
};

Remarks

Use State to get the current state, and InterruptReason to get the reason if the download is interrupted.

Applies to