mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Plugins - Don't load incompatible plugins
This commit is contained in:
1 parent
dc17253518
commit
73a80ef476
4 files changed
+23
-11
No files matched your search
@@ -13,7 +13,7 @@ namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginSettingsViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private Plugin _plugin;
|
||||
private readonly Plugin _plugin;
|
||||
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly INotificationService _notificationService;
|
||||
@@ -41,10 +41,13 @@ public class PluginSettingsViewModel : ActivatableViewModelBase
|
||||
bool wasEnabled = _plugin.IsEnabled;
|
||||
await Task.Run(() => _pluginManagementService.UnloadPlugin(_plugin));
|
||||
|
||||
_plugin = _pluginManagementService.LoadPlugin(_plugin.Directory);
|
||||
if (wasEnabled)
|
||||
await Task.Run(() => _pluginManagementService.EnablePlugin(_plugin, true, true));
|
||||
|
||||
_notificationService.CreateNotification().WithTitle("Reloaded plugin.").Show();
|
||||
Plugin? plugin = _pluginManagementService.LoadPlugin(_plugin.Directory);
|
||||
if (plugin != null && wasEnabled)
|
||||
{
|
||||
await Task.Run(() => _pluginManagementService.EnablePlugin(plugin, true, true));
|
||||
_notificationService.CreateNotification().WithTitle("Reloaded plugin.").Show();
|
||||
}
|
||||
else if (plugin == null)
|
||||
_notificationService.CreateNotification().WithTitle("Failed to load plugin after unloading it.").Show();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user