1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Improved exceptions display.

This commit is contained in:
SpoinkyNL 2016-02-28 17:29:44 +01:00
parent 3b0558b4ff
commit 0584b8a943
3 changed files with 14 additions and 5 deletions

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>

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)

View File

@ -92,7 +92,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
} }
public override void Update() public override void Update()
{ {
// Start filling the model // Start filling the model
_generating = true; _generating = true;