Added build time calculation

This commit is contained in:
Scalpel_cp 2008-07-18 20:29:32 +00:00
parent 1dbf890b13
commit b6d643ff82
2 changed files with 22 additions and 17 deletions

View file

@ -94,8 +94,8 @@ namespace Cosmos.Build.Windows {
long remaining = ((xBuildTimer.ElapsedMilliseconds) / percentComplete) * (100 - percentComplete); long remaining = ((xBuildTimer.ElapsedMilliseconds) / percentComplete) * (100 - percentComplete);
if (completedCount == 10 || completedCount == 780) //if (completedCount == 10 || completedCount == 780)
MessageBox.Show("One percent takes " + xBuildTimer.ElapsedMilliseconds / percentComplete); // MessageBox.Show("One percent takes " + xBuildTimer.ElapsedMilliseconds / percentComplete);
return new TimeSpan(remaining * 1000 * 10); return new TimeSpan(remaining * 1000 * 10);
} }

View file

@ -196,15 +196,20 @@ namespace Cosmos.Build.Windows {
mBuilder.DebugLog += xBuildWindow.DoDebugMessage; mBuilder.DebugLog += xBuildWindow.DoDebugMessage;
mBuilder.ProgressChanged += delegate(int aMax, mBuilder.ProgressChanged += delegate(int aMax,
int aCurrent) { int aCurrent)
xBuildWindow.progressText.Content = String.Format("Processing method {0:d} of {1:d}", {
string xRemainingTime = String.Format(System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat,
"{0:T}", new DateTime(xBuildWindow.CalculateRemainingTime(aCurrent, aMax).Ticks));
xBuildWindow.progressText.Content = String.Format("Processing method {0:d} of {1:d}{2}({3} remaining)",
aCurrent, aCurrent,
aMax); aMax, Environment.NewLine, xRemainingTime);
xBuildWindow.ProgressMax = aMax; xBuildWindow.ProgressMax = aMax;
xBuildWindow.ProgressCurrent = aCurrent; xBuildWindow.ProgressCurrent = aCurrent;
var xFrame = new DispatcherFrame(); var xFrame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input,
new DispatcherOperationCallback(delegate(object aParam) { new DispatcherOperationCallback(delegate(object aParam)
{
xFrame.Continue = false; xFrame.Continue = false;
return null; return null;
}), }),