void NewRequest(IRequestProgress obj)
        {
            Action<TransferProgress> onUpload = (progress) =>
            {
                ConsoleEx.WriteProgress(
                    obj.RequestUri.ToString(),
                    FormatUri(obj),
                    progress.Finished ? 100 : ToPercent(progress));
            };
            Action<TransferProgress> onDownload = (progress) =>
            {
                ConsoleEx.WriteProgress(
                    obj.RequestUri.ToString(),
                    FormatUri(obj),
                    progress.Finished ? 201 : 100 + ToPercent(progress));
            };

            obj.Upload += onUpload;
            obj.Download += onDownload;
        }
Example #2
0
 public void RaiseNewRequest(IRequestProgress newRequest)
 {
     var handler = NewRequest;
     if (handler != null)
         handler(newRequest);
 }
 static string FormatUri(IRequestProgress obj)
 {
     return obj.RequestUri.ToString();
 }