Beispiel #1
0
 /// <summary>
 ///     Create a new <see cref="ProgressHandler"/>.
 /// </summary>
 /// <param name="nextHandler">
 ///     The next handler in the chain (if any).
 /// </param>
 /// <param name="progressTypes">
 ///     The type(s) of progress that will be reported by the handler.
 /// </param>
 /// <param name="bufferSize">
 ///     An optional buffer size to use when transferring content.
 ///
 ///     If not specified, the default buffer size is used.
 /// </param>
 public ProgressHandler(HttpMessageHandler nextHandler, HttpProgressTypes progressTypes = HttpProgressTypes.Both, int?bufferSize = null)
     : base(nextHandler)
 {
     _progressTypes = progressTypes;
     _bufferSize    = bufferSize;
 }
Beispiel #2
0
 /// <summary>
 ///     Create a new <see cref="ProgressHandler"/> linked to an <see cref="HttpClientHandler"/>.
 /// </summary>
 /// <param name="progressTypes">
 ///     The types of progress to report.
 /// </param>
 /// <param name="bufferSize">
 ///     The buffer size to use when copying data.
 /// </param>
 /// <returns>
 ///     The configured <see cref="ProgressHandler"/>.
 /// </returns>
 public static ProgressHandler Create(HttpProgressTypes progressTypes = HttpProgressTypes.Both, int?bufferSize = null)
 {
     return(new ProgressHandler(new HttpClientHandler(), progressTypes, bufferSize));
 }
Beispiel #3
0
 /// <summary>
 ///     Create a new <see cref="ProgressHandler"/>.
 /// </summary>
 /// <param name="progressTypes">
 ///     The type(s) of progress that will be reported by the handler.
 /// </param>
 /// <param name="bufferSize">
 ///     An optional buffer size to use when transferring content.
 ///
 ///     If not specified, the default buffer size is used.
 /// </param>
 public ProgressHandler(HttpProgressTypes progressTypes = HttpProgressTypes.Both, int?bufferSize = null)
 {
     _progressTypes = progressTypes;
     _bufferSize    = bufferSize;
 }
Beispiel #4
0
 /// <summary>
 ///     Determine whether the specified type of progress reporting is enabled.
 /// </summary>
 /// <param name="progressType">
 ///     The progress type to test.
 /// </param>
 /// <returns>
 ///     <c>true</c>, if the progress type is enabled; otherwise, <c>false</c>.
 /// </returns>
 bool IsProgressEnabled(HttpProgressTypes progressType)
 {
     return((_progressTypes & progressType) == progressType);
 }