コード例 #1
0
 internal virtual void Update(BatchingProgressMonitor pm, int completed)
 {
     lastWork += completed;
     if (totalWork == UNKNOWN)
     {
         // Only display once per second, as the alarm fires.
         if (display)
         {
             pm.OnUpdate(taskName, lastWork);
             output = true;
             RestartTimer();
         }
     }
     else
     {
         // Display once per second or when 1% is done.
         int currPercent = lastWork * 100 / totalWork;
         if (display)
         {
             pm.OnUpdate(taskName, lastWork, totalWork, currPercent);
             output = true;
             RestartTimer();
             lastPercent = currPercent;
         }
         else
         {
             if (currPercent != lastPercent)
             {
                 pm.OnUpdate(taskName, lastWork, totalWork, currPercent);
                 output      = true;
                 lastPercent = currPercent;
             }
         }
     }
 }
コード例 #2
0
 internal virtual void End(BatchingProgressMonitor pm)
 {
     if (output)
     {
         if (totalWork == UNKNOWN)
         {
             pm.OnEndTask(taskName, lastWork);
         }
         else
         {
             int pDone = lastWork * 100 / totalWork;
             pm.OnEndTask(taskName, lastWork, totalWork, pDone);
         }
     }
     if (timerFuture != null)
     {
         timerFuture.Cancel(false);
     }
 }
コード例 #3
0
			internal virtual void End(BatchingProgressMonitor pm)
			{
				if (output)
				{
					if (totalWork == UNKNOWN)
					{
						pm.OnEndTask(taskName, lastWork);
					}
					else
					{
						int pDone = lastWork * 100 / totalWork;
						pm.OnEndTask(taskName, lastWork, totalWork, pDone);
					}
				}
				if (timerFuture != null)
				{
					timerFuture.Cancel(false);
				}
			}
コード例 #4
0
			internal virtual void Update(BatchingProgressMonitor pm, int completed)
			{
				lastWork += completed;
				if (totalWork == UNKNOWN)
				{
					// Only display once per second, as the alarm fires.
					if (display)
					{
						pm.OnUpdate(taskName, lastWork);
						output = true;
						RestartTimer();
					}
				}
				else
				{
					// Display once per second or when 1% is done.
					int currPercent = lastWork * 100 / totalWork;
					if (display)
					{
						pm.OnUpdate(taskName, lastWork, totalWork, currPercent);
						output = true;
						RestartTimer();
						lastPercent = currPercent;
					}
					else
					{
						if (currPercent != lastPercent)
						{
							pm.OnUpdate(taskName, lastWork, totalWork, currPercent);
							output = true;
							lastPercent = currPercent;
						}
					}
				}
			}