mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Use a help page URL instead of doing things in-app
This commit is contained in:
1 parent
949106e470
commit
2b15657f8d
17 files changed
+46
-367
No files matched your search
@@ -23,7 +23,6 @@ namespace Artemis.UI.Screens.Plugins.Features;
|
||||
public class PluginFeatureViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly ICoreService _coreService;
|
||||
private readonly INotificationService _notificationService;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly IWindowService _windowService;
|
||||
private bool _enabling;
|
||||
@@ -32,12 +31,10 @@ public class PluginFeatureViewModel : ActivatableViewModelBase
|
||||
bool showShield,
|
||||
ICoreService coreService,
|
||||
IWindowService windowService,
|
||||
INotificationService notificationService,
|
||||
IPluginManagementService pluginManagementService)
|
||||
{
|
||||
_coreService = coreService;
|
||||
_windowService = windowService;
|
||||
_notificationService = notificationService;
|
||||
_pluginManagementService = pluginManagementService;
|
||||
|
||||
FeatureInfo = pluginFeatureInfo;
|
||||
@@ -176,11 +173,7 @@ public class PluginFeatureViewModel : ActivatableViewModelBase
|
||||
if (FeatureInfo.Instance == null)
|
||||
{
|
||||
this.RaisePropertyChanged(nameof(IsEnabled));
|
||||
_notificationService.CreateNotification()
|
||||
.WithMessage($"Feature '{FeatureInfo.Name}' is in a broken state and cannot enable.")
|
||||
.HavingButton(b => b.WithText("View logs").WithCommand(ShowLogsFolder))
|
||||
.WithSeverity(NotificationSeverity.Error)
|
||||
.Show();
|
||||
await ShowFailureDialog($"Failed to enable '{FeatureInfo.Name}'", $"Feature '{FeatureInfo.Name}' is in a broken state and cannot enable.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -215,11 +208,7 @@ public class PluginFeatureViewModel : ActivatableViewModelBase
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_notificationService.CreateNotification()
|
||||
.WithMessage($"Failed to enable '{FeatureInfo.Name}'.\r\n{e.Message}")
|
||||
.HavingButton(b => b.WithText("View logs").WithCommand(ShowLogsFolder))
|
||||
.WithSeverity(NotificationSeverity.Error)
|
||||
.Show();
|
||||
await ShowFailureDialog($"Failed to enable '{FeatureInfo.Name}'", e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -254,4 +243,17 @@ public class PluginFeatureViewModel : ActivatableViewModelBase
|
||||
{
|
||||
this.RaisePropertyChanged(nameof(CanToggleEnabled));
|
||||
}
|
||||
|
||||
private async Task ShowFailureDialog(string action, string message)
|
||||
{
|
||||
ContentDialogBuilder builder = _windowService.CreateContentDialog()
|
||||
.WithTitle(action)
|
||||
.WithContent(message)
|
||||
.HavingPrimaryButton(b => b.WithText("View logs").WithCommand(ShowLogsFolder));
|
||||
// If available, add a secondary button pointing to the support page
|
||||
if (FeatureInfo.Plugin.Info.HelpPage != null)
|
||||
builder = builder.HavingSecondaryButton(b => b.WithText("Open support page").WithAction(() => Utilities.OpenUrl(FeatureInfo.Plugin.Info.HelpPage.ToString())));
|
||||
|
||||
await builder.ShowAsync();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user