示例#1
0
 public int TransferProgressHandler(TransferProgress progress)
 {
     if (TransferProgressUpdate != null)
     {
         if (TransferProgressUpdatePolicy.UpdateNeeded(((double)progress.ReceivedObjects) / ((double)progress.TotalObjects)))
         {
             var ret = TransferProgressUpdate(progress);
             if (ret < 0)
             {
                 TransferCanceled = true;
             }
             return ret;
         }
     }
     return 0;
 }
示例#2
0
		public static void OnTransferProgress( TransferProgress progress ) {
			Debug.LogWarning( "FetchHelper - OnTransferProgress => " + progress );
		}
		static bool OnTransferProgress (TransferProgress tp, ProgressMonitor monitor, ref int progress)
		{
			if (progress == 0 && tp.ReceivedObjects == 0) {
				monitor.BeginTask ("Receiving and indexing objects", 2 * tp.TotalObjects);
				throttleWatch.Restart ();
			}

			int currentProgress = tp.ReceivedObjects + tp.IndexedObjects;
			int steps = currentProgress - progress;
			if (throttleWatch.ElapsedMilliseconds > progressThrottle) {
				monitor.Step (steps);
				throttleWatch.Restart ();
			}
			progress = currentProgress;

			if (tp.IndexedObjects >= tp.TotalObjects) {
				monitor.EndTask ();
				throttleWatch.Stop ();
			}

			return !monitor.CancellationToken.IsCancellationRequested;
		}
示例#4
0
		static bool OnTransferProgress (TransferProgress tp, IProgressMonitor monitor, ref int progress)
		{
			if (progress == 0 && tp.ReceivedObjects == 0)
				monitor.BeginTask ("Receiving and indexing objects", 2 * tp.TotalObjects);

			int currentProgress = tp.ReceivedObjects + tp.IndexedObjects;
			int steps = currentProgress - progress;
			monitor.Step (steps);
			progress = currentProgress;

			if (tp.IndexedObjects >= tp.TotalObjects)
				monitor.EndTask ();

			return !monitor.IsCancelRequested;
		}
		private void onTransferProgress( TransferProgress progress ) {
			progressInfo.Add( "Received bytes: " + progress.ReceivedBytes );
			scroll.y = int.MaxValue;
		}
 private int LogTransferProgressUpdate(TransferProgress progress)
 {
     LogEvent.TransferProgressInformation(progress.ReceivedBytes, progress.ReceivedObjects, progress.TotalObjects);
     return 0;
 }