diff --git a/src/Artemis.Core/Services/RgbService.cs b/src/Artemis.Core/Services/RgbService.cs index 26c66ed54..b794930af 100644 --- a/src/Artemis.Core/Services/RgbService.cs +++ b/src/Artemis.Core/Services/RgbService.cs @@ -148,8 +148,23 @@ namespace Artemis.Core.Services foreach (ArtemisDevice device in toRemove) RemoveDevice(device); - deviceProvider.Initialize(RGBDeviceType.All, true); + List providerExceptions = new(); + void DeviceProviderOnException(object? sender, ExceptionEventArgs e) + { + if (e.IsCritical) + providerExceptions.Add(e.Exception); + else + _logger.Warning(e.Exception, "Device provider {deviceProvider} threw non-critical exception", deviceProvider.GetType().Name); + } + + deviceProvider.Exception += DeviceProviderOnException; + deviceProvider.Initialize(); Surface.Attach(deviceProvider.Devices); + deviceProvider.Exception -= DeviceProviderOnException; + if (providerExceptions.Count == 1) + throw new ArtemisPluginException("RGB.NET threw exception: " + providerExceptions.First().Message, providerExceptions.First()); + if (providerExceptions.Count > 1) + throw new ArtemisPluginException("RGB.NET threw multiple exceptions", new AggregateException(providerExceptions)); if (!deviceProvider.Devices.Any()) { diff --git a/src/Artemis.Core/Stores/LogStore.cs b/src/Artemis.Core/Stores/LogStore.cs index 856ecd6fe..24079b98e 100644 --- a/src/Artemis.Core/Stores/LogStore.cs +++ b/src/Artemis.Core/Stores/LogStore.cs @@ -25,7 +25,7 @@ namespace Artemis.Core internal static void Emit(LogEvent logEvent) { LinkedList.AddLast(logEvent); - if (LinkedList.Count > 500) + while (LinkedList.Count > 500) LinkedList.RemoveFirst(); OnEventAdded(new LogEventEventArgs(logEvent)); diff --git a/src/Artemis.UI/Screens/RootViewModel.cs b/src/Artemis.UI/Screens/RootViewModel.cs index 18706d496..cb726d024 100644 --- a/src/Artemis.UI/Screens/RootViewModel.cs +++ b/src/Artemis.UI/Screens/RootViewModel.cs @@ -178,21 +178,17 @@ namespace Artemis.UI.Screens if (!PinSidebar.Value) _sidebarViewModel.IsSidebarOpen = false; - // Don't do a fade when selecting a module because the editor is so bulky the animation slows things down - if (!(_sidebarViewModel.SelectedItem is ModuleRootViewModel)) - ActiveItemReady = false; + ActiveItemReady = false; // Allow the menu to close, it's slower but feels more responsive, funny how that works right - Execute.PostToUIThreadAsync(async () => + Execute.PostToUIThread(async () => { - if (PinSidebar.Value) - await Task.Delay(200); - else - await Task.Delay(400); - + await Task.Delay(400); ActiveItem = _sidebarViewModel.SelectedItem; + await Task.Delay(200); ActiveItemReady = true; }); + } } @@ -296,7 +292,7 @@ namespace Artemis.UI.Screens PluginSetting setupWizardCompleted = _settingsService.GetSetting("UI.SetupWizardCompleted", false); if (!setupWizardCompleted.Value) ShowSetupWizard(); - + base.OnInitialActivate(); } diff --git a/src/Artemis.UI/Screens/Settings/Debug/Tabs/DataModelDebugView.xaml b/src/Artemis.UI/Screens/Settings/Debug/Tabs/DataModelDebugView.xaml index f2c0b8995..f178ca853 100644 --- a/src/Artemis.UI/Screens/Settings/Debug/Tabs/DataModelDebugView.xaml +++ b/src/Artemis.UI/Screens/Settings/Debug/Tabs/DataModelDebugView.xaml @@ -69,8 +69,7 @@ + VirtualizingStackPanel.IsVirtualizing="True">