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,21 +196,26 @@ 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}", {
aCurrent, string xRemainingTime = String.Format(System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat,
aMax); "{0:T}", new DateTime(xBuildWindow.CalculateRemainingTime(aCurrent, aMax).Ticks));
xBuildWindow.ProgressMax = aMax;
xBuildWindow.ProgressCurrent = aCurrent; xBuildWindow.progressText.Content = String.Format("Processing method {0:d} of {1:d}{2}({3} remaining)",
var xFrame = new DispatcherFrame(); aCurrent,
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, aMax, Environment.NewLine, xRemainingTime);
new DispatcherOperationCallback(delegate(object aParam) { xBuildWindow.ProgressMax = aMax;
xFrame.Continue = false; xBuildWindow.ProgressCurrent = aCurrent;
return null; var xFrame = new DispatcherFrame();
}), Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input,
null); new DispatcherOperationCallback(delegate(object aParam)
Dispatcher.PushFrame(xFrame); {
}; xFrame.Continue = false;
return null;
}),
null);
Dispatcher.PushFrame(xFrame);
};
xBuildWindow.Show(); xBuildWindow.Show();
try { try {
mBuilder.Compile(mDebugMode, mBuilder.Compile(mDebugMode,