Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
BaseOnboardingStepViewModel.cs
1using System.Threading.Tasks;
2using CommunityToolkit.Mvvm.Input;
3
5{
6 public abstract partial class BaseOnboardingStepViewModel : BaseViewModel
7 {
8 private static readonly AsyncRelayCommand disabledAsyncCommand = new(async () => await Task.CompletedTask);
9
11 {
12 this.Step = step;
13 }
14
15 internal void AttachCoordinator(OnboardingViewModel coordinator)
16 {
17 this.Coordinator = coordinator;
18 this.OnPropertyChanged(nameof(this.NextCommand));
19 this.OnPropertyChanged(nameof(this.BackCommand));
20 this.OnPropertyChanged(nameof(this.GoToStepCommand));
21 this.OnPropertyChanged(nameof(this.CoordinatorViewModel));
22 }
23
24 public OnboardingStep Step { get; }
25
26 protected OnboardingViewModel Coordinator { get; private set; } = null!;
27
28 public OnboardingViewModel? CoordinatorViewModel => this.Coordinator;
29
30 public IAsyncRelayCommand NextCommand => this.Coordinator?.GoToNextCommand ?? disabledAsyncCommand;
31
32 public IAsyncRelayCommand BackCommand => this.Coordinator?.GoBackCommand ?? disabledAsyncCommand;
33
34 public IAsyncRelayCommand<OnboardingStep> GoToStepCommand => this.Coordinator?.GoToStepCommand ?? new AsyncRelayCommand<OnboardingStep>(_ => Task.CompletedTask);
35
36 public virtual string Title => this.Step.ToString();
37
38 public virtual string Description => string.Empty;
39
40 public virtual string NextButtonText => "Continue";
41
42 public virtual string BackButtonText => "Back";
43
44 internal virtual Task<bool> OnNextAsync()
45 {
46 return Task.FromResult(true);
47 }
48
49 internal virtual Task OnActivatedAsync()
50 {
51 return Task.CompletedTask;
52 }
53
54 internal virtual Task OnBackAsync()
55 {
56 return Task.CompletedTask;
57 }
58 }
59}
A base class for all view models, inheriting from the BindableObject. NOTE: using this class requir...
Definition: ImplTypes.g.cs:58
OnboardingStep
Unified onboarding steps matching the registration journey.