public static bool IsCompleted(this HttpTransferState status) { switch (status) { case HttpTransferState.Completed: case HttpTransferState.Error: case HttpTransferState.Canceled: return(true); default: return(false); } }
public static bool IsPaused(this HttpTransferState status) { switch (status) { case HttpTransferState.Paused: case HttpTransferState.PausedByCostedNetwork: case HttpTransferState.PausedByNoNetwork: return(true); default: return(false); } }
public HttpTransfer(string identifier, string uri, string localFilePath, bool isUpload, bool useMeteredConnection, Exception?exception, long fileSize, long bytesTransferred, HttpTransferState status) { if (identifier == null) { throw new ArgumentNullException(nameof(identifier)); } if (uri == null) { throw new ArgumentNullException(nameof(uri)); } this.Identifier = identifier; this.Uri = uri; this.LocalFilePath = localFilePath; this.IsUpload = isUpload; this.UseMeteredConnection = useMeteredConnection; this.Exception = exception; this.FileSize = fileSize; this.BytesTransferred = bytesTransferred; this.Status = exception == null ? status : HttpTransferState.Error; }