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