Improved exceptions display.

This commit is contained in:
SpoinkyNL committed 2016-02-28 17:29:44 +01:00
1 parent 7f45d76052
commit edae16f232
2 files changed
+13 -4

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@
<!-- Accent and AppTheme setting --> <!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Teal.xaml" /> <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Teal.xaml" />
<ResourceDictionary <ResourceDictionary
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" /> Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
<ResourceDictionary Source="/Resources/Icons.xaml" /> <ResourceDictionary Source="/Resources/Icons.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
+12 -3
View File
@@ -1,5 +1,4 @@
using System; using System.ComponentModel;
using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@@ -30,8 +29,12 @@ namespace Artemis.Managers
_fps = 25; _fps = 25;
UpdateWorker = new BackgroundWorker {WorkerSupportsCancellation = true}; UpdateWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
_processWorker = new BackgroundWorker(); _processWorker = new BackgroundWorker();
UpdateWorker.DoWork += UpdateWorker_DoWork; UpdateWorker.DoWork += UpdateWorker_DoWork;
UpdateWorker.RunWorkerCompleted += BackgroundWorkerExceptionCatcher;
_processWorker.DoWork += ProcessWorker_DoWork; _processWorker.DoWork += ProcessWorker_DoWork;
_processWorker.RunWorkerCompleted += BackgroundWorkerExceptionCatcher;
// Process worker will always run (and just do nothing when ProgramEnabled is false) // Process worker will always run (and just do nothing when ProgramEnabled is false)
_processWorker.RunWorkerAsync(); _processWorker.RunWorkerAsync();
@@ -156,7 +159,7 @@ namespace Artemis.Managers
if (_paused) if (_paused)
{ {
PauseCallback?.Invoke(); PauseCallback?.Invoke();
Thread.Sleep(1000 / _fps); Thread.Sleep(1000/_fps);
continue; continue;
} }
@@ -210,6 +213,12 @@ namespace Artemis.Managers
} }
} }
private void BackgroundWorkerExceptionCatcher(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error != null)
throw e.Error;
}
private void ProcessWorker_DoWork(object sender, DoWorkEventArgs e) private void ProcessWorker_DoWork(object sender, DoWorkEventArgs e)
{ {
while (true) while (true)