diff --git a/CompilePalX/Compiling/CompilingManager.cs b/CompilePalX/Compiling/CompilingManager.cs
index e70a0286..c142c401 100644
--- a/CompilePalX/Compiling/CompilingManager.cs
+++ b/CompilePalX/Compiling/CompilingManager.cs
@@ -5,6 +5,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -219,6 +220,11 @@ public static void CancelCompile()
postCompile(null);
}
+ public static Stopwatch GetTime()
+ {
+ return compileTimeStopwatch;
+ }
+
class MapErrors
{
public string MapName { get; set; }
diff --git a/CompilePalX/MainWindow.xaml b/CompilePalX/MainWindow.xaml
index ba97447b..4aed774b 100644
--- a/CompilePalX/MainWindow.xaml
+++ b/CompilePalX/MainWindow.xaml
@@ -220,6 +220,7 @@
+
diff --git a/CompilePalX/MainWindow.xaml.cs b/CompilePalX/MainWindow.xaml.cs
index 493734dd..f53ecdc2 100644
--- a/CompilePalX/MainWindow.xaml.cs
+++ b/CompilePalX/MainWindow.xaml.cs
@@ -38,6 +38,7 @@ public partial class MainWindow
public static Dispatcher ActiveDispatcher;
private ObservableCollection CompileProcessesSubList = new ObservableCollection();
private bool processModeEnabled;
+ private DispatcherTimer elapsedTimeDispatcherTimer;
public static MainWindow Instance { get; private set; }
public MainWindow()
@@ -88,6 +89,12 @@ public MainWindow()
RowDragHelper.RowSwitched += RowDragHelperOnRowSwitched;
+ elapsedTimeDispatcherTimer = new DispatcherTimer(new TimeSpan(0, 0, 0, 1), DispatcherPriority.Background,
+ this.TickElapsedTimer, Dispatcher.CurrentDispatcher)
+ {
+ IsEnabled = false
+ };
+
HandleArgs();
}
@@ -283,6 +290,14 @@ private void CompilingManager_OnStart()
AddMapButton.IsEnabled = false;
RemoveMapButton.IsEnabled = false;
+
+ // hide update link so elapsed time can be shown
+ UpdateLabel.Visibility = Visibility.Collapsed;
+ TimeElapsedLabel.Visibility = Visibility.Visible;
+ // Tick elapsed timer to display the default string
+ TickElapsedTimer(null, null);
+
+ elapsedTimeDispatcherTimer.IsEnabled = true;
}
private void CompilingManager_OnFinish()
@@ -307,6 +322,9 @@ private void CompilingManager_OnFinish()
AddMapButton.IsEnabled = true;
RemoveMapButton.IsEnabled = true;
+ TimeElapsedLabel.Visibility = Visibility.Collapsed;
+ elapsedTimeDispatcherTimer.IsEnabled = false;
+
string logName = DateTime.Now.ToString("s").Replace(":", "-") + ".txt";
string textLog = new TextRange(CompileOutputTextbox.Document.ContentStart, CompileOutputTextbox.Document.ContentEnd).Text;
@@ -774,6 +792,11 @@ private void BugReportButton_OnClick(object sender, RoutedEventArgs e)
Process.Start(new ProcessStartInfo("https://github.com/ruarai/CompilePal/issues/"));
e.Handled = true;
}
+
+ private void TickElapsedTimer(object sender, EventArgs e)
+ {
+ TimeElapsedLabel.Content = $"Time Elapsed: {CompilingManager.GetTime().Elapsed.ToString(@"hh\:mm\:ss")}";
+ }
}
public static class ObservableCollectionExtension
diff --git a/CompilePalX/version_prerelease.txt b/CompilePalX/version_prerelease.txt
index 593efc8a..5402cf64 100644
--- a/CompilePalX/version_prerelease.txt
+++ b/CompilePalX/version_prerelease.txt
@@ -1 +1 @@
-027.12
\ No newline at end of file
+027.13
\ No newline at end of file