From b6d643ff8209cc11944b599c8a2da1d9726f8e31 Mon Sep 17 00:00:00 2001 From: Scalpel_cp <165da7fc5536ee16440a98f161bfa866a8b94595G55xazV5> Date: Fri, 18 Jul 2008 20:29:32 +0000 Subject: [PATCH] Added build time calculation --- .../Cosmos.Build.Windows/BuildWindow.xaml.cs | 4 +-- .../OptionsWindow.xaml.cs | 35 +++++++++++-------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/source/Cosmos.Build.Windows/BuildWindow.xaml.cs b/source/Cosmos.Build.Windows/BuildWindow.xaml.cs index 85f3154c3..4c008d624 100644 --- a/source/Cosmos.Build.Windows/BuildWindow.xaml.cs +++ b/source/Cosmos.Build.Windows/BuildWindow.xaml.cs @@ -94,8 +94,8 @@ namespace Cosmos.Build.Windows { long remaining = ((xBuildTimer.ElapsedMilliseconds) / percentComplete) * (100 - percentComplete); - if (completedCount == 10 || completedCount == 780) - MessageBox.Show("One percent takes " + xBuildTimer.ElapsedMilliseconds / percentComplete); + //if (completedCount == 10 || completedCount == 780) + // MessageBox.Show("One percent takes " + xBuildTimer.ElapsedMilliseconds / percentComplete); return new TimeSpan(remaining * 1000 * 10); } diff --git a/source/Cosmos.Build.Windows/OptionsWindow.xaml.cs b/source/Cosmos.Build.Windows/OptionsWindow.xaml.cs index 701e0b750..7c6372384 100644 --- a/source/Cosmos.Build.Windows/OptionsWindow.xaml.cs +++ b/source/Cosmos.Build.Windows/OptionsWindow.xaml.cs @@ -196,21 +196,26 @@ namespace Cosmos.Build.Windows { mBuilder.DebugLog += xBuildWindow.DoDebugMessage; mBuilder.ProgressChanged += delegate(int aMax, - int aCurrent) { - xBuildWindow.progressText.Content = String.Format("Processing method {0:d} of {1:d}", - aCurrent, - aMax); - xBuildWindow.ProgressMax = aMax; - xBuildWindow.ProgressCurrent = aCurrent; - var xFrame = new DispatcherFrame(); - Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, - new DispatcherOperationCallback(delegate(object aParam) { - xFrame.Continue = false; - return null; - }), - null); - Dispatcher.PushFrame(xFrame); - }; + int aCurrent) + { + 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, + aMax, Environment.NewLine, xRemainingTime); + xBuildWindow.ProgressMax = aMax; + xBuildWindow.ProgressCurrent = aCurrent; + var xFrame = new DispatcherFrame(); + Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Input, + new DispatcherOperationCallback(delegate(object aParam) + { + xFrame.Continue = false; + return null; + }), + null); + Dispatcher.PushFrame(xFrame); + }; xBuildWindow.Show(); try { mBuilder.Compile(mDebugMode,