diff --git a/src/Artemis.UI/Routing/Routes.cs b/src/Artemis.UI/Routing/Routes.cs index 11cf16abf..d0f043e2c 100644 --- a/src/Artemis.UI/Routing/Routes.cs +++ b/src/Artemis.UI/Routing/Routes.cs @@ -50,7 +50,8 @@ namespace Artemis.UI.Routing new RouteRegistration("submissions"), new RouteRegistration("submissions/{entryId:long}", [ new RouteRegistration("releases/{releaseId:long}") - ]) + ]), + new RouteRegistration("recently-updated") ]) ]), new RouteRegistration("surface-editor"), diff --git a/src/Artemis.UI/Screens/Plugins/PluginView.axaml b/src/Artemis.UI/Screens/Plugins/PluginView.axaml index 0ce55c49f..551215cc1 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginView.axaml @@ -92,6 +92,12 @@ ToolTip.Tip="Open settings"> + + + ? reload, IWindowService windowService, IPluginInteractionService pluginInteractionService) + public PluginViewModel(PluginInfo pluginInfo, ReactiveCommand? reload, IWindowService windowService, IPluginInteractionService pluginInteractionService, + IWorkshopService workshopService) { PluginInfo = pluginInfo; Plugin = pluginInfo?.Plugin; _windowService = windowService; _pluginInteractionService = pluginInteractionService; + _workshopService = workshopService; Platforms = []; if (PluginInfo.Platforms != null) @@ -51,12 +57,8 @@ public partial class PluginViewModel : ActivatableViewModelBase Reload = reload; OpenSettings = ReactiveCommand.Create(ExecuteOpenSettings, this.WhenAnyValue(vm => vm.IsEnabled, e => e && Plugin?.ConfigurationDialog != null)); - RemoveSettings = ReactiveCommand.CreateFromTask(ExecuteRemoveSettings); - Remove = ReactiveCommand.CreateFromTask(ExecuteRemove); InstallPrerequisites = ReactiveCommand.CreateFromTask(ExecuteInstallPrerequisites, this.WhenAnyValue(x => x.CanInstallPrerequisites)); RemovePrerequisites = ReactiveCommand.CreateFromTask(ExecuteRemovePrerequisites, this.WhenAnyValue(x => x.CanRemovePrerequisites)); - ShowLogsFolder = ReactiveCommand.Create(ExecuteShowLogsFolder); - OpenPluginDirectory = ReactiveCommand.Create(ExecuteOpenPluginDirectory); this.WhenActivated(d => { @@ -65,6 +67,7 @@ public partial class PluginViewModel : ActivatableViewModelBase Plugin.Enabled += OnPluginToggled; Plugin.Disabled += OnPluginToggled; + WorkshopEntry = _workshopService.GetInstalledEntryByPlugin(Plugin); Disposable.Create(() => { @@ -77,12 +80,8 @@ public partial class PluginViewModel : ActivatableViewModelBase public ReactiveCommand? Reload { get; } public ReactiveCommand OpenSettings { get; } - public ReactiveCommand RemoveSettings { get; } - public ReactiveCommand Remove { get; } public ReactiveCommand InstallPrerequisites { get; } public ReactiveCommand RemovePrerequisites { get; } - public ReactiveCommand ShowLogsFolder { get; } - public ReactiveCommand OpenPluginDirectory { get; } public ObservableCollection Platforms { get; } public bool IsEnabled => Plugin != null && Plugin.IsEnabled; @@ -121,6 +120,68 @@ public partial class PluginViewModel : ActivatableViewModelBase }); } + public void OpenPluginDirectory() + { + try + { + if (Plugin != null) + Utilities.OpenFolder(Plugin.Directory.FullName); + } + catch (Exception e) + { + _windowService.ShowExceptionDialog("Welp, we couldn't open the device's plugin folder for you", e); + } + } + + public async Task RemoveSettings() + { + if (Plugin == null) + return; + + await _pluginInteractionService.RemovePluginSettings(Plugin); + } + + public async Task Remove() + { + if (Plugin == null) + return; + + await _pluginInteractionService.RemovePlugin(Plugin); + } + + public async Task AutoEnable() + { + if (IsEnabled) + return; + + await UpdateEnabled(true); + + // If enabling failed, don't offer to show the settings + if (!IsEnabled || Plugin?.ConfigurationDialog == null) + return; + + if (await _windowService.ShowConfirmContentDialog("Open plugin settings", "This plugin has settings, would you like to view them?", "Yes", "No")) + ExecuteOpenSettings(); + } + + public async Task ViewEntry() + { + if (WorkshopEntry != null) + await _workshopService.NavigateToEntry(WorkshopEntry.Id, WorkshopEntry.EntryType); + } + + public async Task ExecuteRemovePrerequisites(bool forPluginRemoval = false) + { + if (Plugin == null) + return; + + List subjects = [PluginInfo]; + subjects.AddRange(!forPluginRemoval ? Plugin.Features.Where(f => f.AlwaysEnabled) : Plugin.Features); + + if (subjects.Any(s => s.PlatformPrerequisites.Any(p => p.UninstallActions.Any()))) + await PluginPrerequisitesUninstallDialogViewModel.Show(_windowService, subjects, forPluginRemoval ? "Skip, remove plugin" : "Cancel"); + } + private void ExecuteOpenSettings() { if (Plugin?.ConfigurationDialog == null) @@ -148,19 +209,6 @@ public partial class PluginViewModel : ActivatableViewModelBase } } - private void ExecuteOpenPluginDirectory() - { - try - { - if (Plugin != null) - Utilities.OpenFolder(Plugin.Directory.FullName); - } - catch (Exception e) - { - _windowService.ShowExceptionDialog("Welp, we couldn't open the device's plugin folder for you", e); - } - } - private async Task ExecuteInstallPrerequisites() { if (Plugin == null) @@ -173,46 +221,6 @@ public partial class PluginViewModel : ActivatableViewModelBase await PluginPrerequisitesInstallDialogViewModel.Show(_windowService, subjects); } - public async Task ExecuteRemovePrerequisites(bool forPluginRemoval = false) - { - if (Plugin == null) - return; - - List subjects = [PluginInfo]; - subjects.AddRange(!forPluginRemoval ? Plugin.Features.Where(f => f.AlwaysEnabled) : Plugin.Features); - - if (subjects.Any(s => s.PlatformPrerequisites.Any(p => p.UninstallActions.Any()))) - await PluginPrerequisitesUninstallDialogViewModel.Show(_windowService, subjects, forPluginRemoval ? "Skip, remove plugin" : "Cancel"); - } - - private async Task ExecuteRemoveSettings() - { - if (Plugin == null) - return; - - await _pluginInteractionService.RemovePluginSettings(Plugin); - } - - private async Task ExecuteRemove() - { - if (Plugin == null) - return; - - await _pluginInteractionService.RemovePlugin(Plugin); - } - - private void ExecuteShowLogsFolder() - { - try - { - Utilities.OpenFolder(Constants.LogsFolder); - } - catch (Exception e) - { - _windowService.ShowExceptionDialog("Welp, we couldn\'t open the logs folder for you", e); - } - } - private void OnPluginToggled(object? sender, EventArgs e) { Dispatcher.UIThread.Post(() => @@ -222,19 +230,4 @@ public partial class PluginViewModel : ActivatableViewModelBase _settingsWindow?.Close(); }); } - - public async Task AutoEnable() - { - if (IsEnabled) - return; - - await UpdateEnabled(true); - - // If enabling failed, don't offer to show the settings - if (!IsEnabled || Plugin?.ConfigurationDialog == null) - return; - - if (await _windowService.ShowConfirmContentDialog("Open plugin settings", "This plugin has settings, would you like to view them?", "Yes", "No")) - ExecuteOpenSettings(); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml b/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml index 943b2c696..632ecf9db 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml +++ b/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedItemView.axaml b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedItemView.axaml new file mode 100644 index 000000000..105eba36f --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedItemView.axaml @@ -0,0 +1,10 @@ + + Welcome to Avalonia! + diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedItemView.axaml.cs b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedItemView.axaml.cs new file mode 100644 index 000000000..2896638d6 --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedItemView.axaml.cs @@ -0,0 +1,11 @@ +using ReactiveUI.Avalonia; + +namespace Artemis.UI.Screens.Workshop.Library.Tabs; + +public partial class RecentlyUpdatedItemView : ReactiveUserControl +{ + public RecentlyUpdatedItemView() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedItemViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedItemViewModel.cs new file mode 100644 index 000000000..1df0f3311 --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedItemViewModel.cs @@ -0,0 +1,8 @@ +using Artemis.UI.Shared; + +namespace Artemis.UI.Screens.Workshop.Library.Tabs; + +public partial class RecentlyUpdatedItemViewModel : ActivatableViewModelBase +{ + +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedView.axaml b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedView.axaml new file mode 100644 index 000000000..a4bab6833 --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedView.axaml @@ -0,0 +1,10 @@ + + Welcome to Avalonia! + diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedView.axaml.cs b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedView.axaml.cs new file mode 100644 index 000000000..6d90ae6ff --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedView.axaml.cs @@ -0,0 +1,11 @@ +using ReactiveUI.Avalonia; + +namespace Artemis.UI.Screens.Workshop.Library.Tabs; + +public partial class RecentlyUpdatedView : ReactiveUserControl +{ + public RecentlyUpdatedView() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedViewModel.cs new file mode 100644 index 000000000..1a056dd8b --- /dev/null +++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/RecentlyUpdatedViewModel.cs @@ -0,0 +1,8 @@ +using Artemis.UI.Shared.Routing; + +namespace Artemis.UI.Screens.Workshop.Library.Tabs; + +public partial class RecentlyUpdatedViewModel : RoutableScreen +{ + +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/Library/WorkshopLibraryViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/WorkshopLibraryViewModel.cs index e0bbbdf45..4e90e260f 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/WorkshopLibraryViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Library/WorkshopLibraryViewModel.cs @@ -26,7 +26,8 @@ public partial class WorkshopLibraryViewModel : RoutableHostScreen