mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 13:28:33 +00:00
Startup wizard - Correctly remember wizard was compelted
Settings - Fix double navigation occuring when opening settings Settings - Fix double navigation occuring when opening releases
This commit is contained in:
parent
ff74376ca2
commit
3367280576
@ -2,6 +2,7 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.Routing;
|
||||
@ -42,14 +43,11 @@ public partial class SettingsViewModel : RoutableHostScreen<RoutableScreen>, IMa
|
||||
public ViewModelBase? TitleBarViewModel => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override async Task OnNavigating(NavigationArguments args, CancellationToken cancellationToken)
|
||||
public override Task OnNavigating(NavigationArguments args, CancellationToken cancellationToken)
|
||||
{
|
||||
// Display tab change on navigate
|
||||
SelectedTab = SettingTabs.FirstOrDefault(t => t.Matches(args.Path));
|
||||
|
||||
// Always show a tab, if there is none forward to the first
|
||||
if (SelectedTab == null)
|
||||
await _router.Navigate(SettingTabs.First().Path);
|
||||
// Display tab change on navigate, if there is none forward to the first
|
||||
SelectedTab = SettingTabs.FirstOrDefault(t => t.Matches(args.Path)) ?? SettingTabs.FirstOrDefault();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void GoBack()
|
||||
|
||||
@ -62,7 +62,7 @@ public partial class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsVie
|
||||
|
||||
public ReadOnlyObservableCollection<ReleaseViewModel> ReleaseViewModels { get; }
|
||||
public string Channel { get; }
|
||||
|
||||
|
||||
public async Task GetReleases(CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
@ -97,7 +97,7 @@ public partial class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsVie
|
||||
Loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override async Task OnNavigating(NavigationArguments args, CancellationToken cancellationToken)
|
||||
{
|
||||
@ -109,10 +109,6 @@ public partial class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsVie
|
||||
SelectedReleaseViewModel = ReleaseViewModels.FirstOrDefault(vm => vm.Release.Id == releaseId);
|
||||
// Otherwise forward to the last release
|
||||
else
|
||||
{
|
||||
ReleaseViewModel? lastRelease = ReleaseViewModels.FirstOrDefault(r => r.IsCurrentVersion) ?? ReleaseViewModels.FirstOrDefault();
|
||||
if (lastRelease != null)
|
||||
await _router.Navigate($"settings/releases/{lastRelease.Release.Id}");
|
||||
}
|
||||
SelectedReleaseViewModel = ReleaseViewModels.FirstOrDefault(r => r.IsCurrentVersion) ?? ReleaseViewModels.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Screens.StartupWizard.Steps;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
@ -11,11 +12,13 @@ namespace Artemis.UI.Screens.StartupWizard;
|
||||
public partial class StartupWizardViewModel : DialogViewModelBase<bool>
|
||||
{
|
||||
private readonly IContainer _container;
|
||||
private readonly ISettingsService _settingsService;
|
||||
[Notify] private WizardStepViewModel _screen;
|
||||
|
||||
public StartupWizardViewModel(IContainer container, IWindowService windowService)
|
||||
public StartupWizardViewModel(IContainer container, IWindowService windowService, ISettingsService settingsService)
|
||||
{
|
||||
_container = container;
|
||||
_settingsService = settingsService;
|
||||
_screen = _container.Resolve<WelcomeStepViewModel>();
|
||||
_screen.Wizard = this;
|
||||
|
||||
@ -41,6 +44,10 @@ public partial class StartupWizardViewModel : DialogViewModelBase<bool>
|
||||
|
||||
public void SkipOrFinishWizard()
|
||||
{
|
||||
PluginSetting<bool> setting = _settingsService.GetSetting("UI.SetupWizardCompleted", false);
|
||||
setting.Value = true;
|
||||
setting.Save();
|
||||
|
||||
Close(true);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user