mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Snackbar - Tweaked parameters
Plugins - Show exception message in snackbar
This commit is contained in:
1 parent
8215440fac
commit
594d333832
4 files changed
+22
-12
No files matched your search
@@ -47,6 +47,8 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
||||
|
||||
public bool Enabling { get; set; }
|
||||
|
||||
public bool DisplayLoadFailed => !Enabling && !PluginInfo.LastEnableSuccessful;
|
||||
|
||||
public async Task OpenSettings()
|
||||
{
|
||||
try
|
||||
@@ -106,7 +108,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
||||
{
|
||||
if (PluginInfo.Enabled == enable)
|
||||
{
|
||||
NotifyOfPropertyChange(() => IsEnabled);
|
||||
NotifyOfPropertyChange(nameof(IsEnabled));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -118,7 +120,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
||||
);
|
||||
if (!confirm)
|
||||
{
|
||||
NotifyOfPropertyChange(() => IsEnabled);
|
||||
NotifyOfPropertyChange(nameof(IsEnabled));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -126,25 +128,28 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
|
||||
if (enable)
|
||||
{
|
||||
Enabling = true;
|
||||
NotifyOfPropertyChange(nameof(DisplayLoadFailed));
|
||||
|
||||
try
|
||||
{
|
||||
_pluginService.EnablePlugin(Plugin);
|
||||
_snackbarMessageQueue.Enqueue($"Enabled plugin {PluginInfo.Name}");
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbarMessageQueue.Enqueue($"Failed to enable plugin {PluginInfo.Name}", "VIEW LOGS", async () => await ShowLogsFolder());
|
||||
_snackbarMessageQueue.Enqueue($"Failed to enable plugin {PluginInfo.Name}\r\n{e.Message}", "VIEW LOGS", async () => await ShowLogsFolder());
|
||||
}
|
||||
finally
|
||||
{
|
||||
Enabling = false;
|
||||
NotifyOfPropertyChange(() => IsEnabled);
|
||||
NotifyOfPropertyChange(nameof(IsEnabled));
|
||||
NotifyOfPropertyChange(nameof(DisplayLoadFailed));
|
||||
}
|
||||
}
|
||||
else
|
||||
_pluginService.DisablePlugin(Plugin);
|
||||
|
||||
NotifyOfPropertyChange(() => IsEnabled);
|
||||
NotifyOfPropertyChange(nameof(IsEnabled));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user