Files
@ e9358d0228ac
Branch filter:
Location: ATITD-Tools/Desert-Paint-Codex/ViewModels/WelcomeViewModel.cs - annotation
e9358d0228ac
1.6 KiB
text/x-csharp
Now recalculating recipe (and thus hypothetical color) after a Clear. Also,
clip status now clears when doing a white extrapolation.
clip status now clears when doing a white extrapolation.
40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 7117d2e703c8 7117d2e703c8 7117d2e703c8 7117d2e703c8 7117d2e703c8 7117d2e703c8 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 7117d2e703c8 7117d2e703c8 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 | using System;
using System.Reactive;
using System.Reactive.Linq;
using DesertPaintCodex.Services;
using ReactiveUI;
namespace DesertPaintCodex.ViewModels
{
public class WelcomeViewModel : ViewModelBase
{
private SelectProfileViewModel? _selectProfileVM;
private CreateProfileViewModel? _createProfileVM;
private ViewModelBase? _profileActivity;
public ViewModelBase? ProfileActivity { get => _profileActivity; private set => this.RaiseAndSetIfChanged(ref _profileActivity, value); }
public WelcomeViewModel()
{
FinishWelcome = ReactiveCommand.Create(() => { });
if (ProfileManager.HasProfiles())
{
ShowSelectProfile();
}
else
{
ShowCreateProfile();
}
}
private void ShowSelectProfile()
{
_selectProfileVM = new SelectProfileViewModel();
_selectProfileVM.NewProfile.Subscribe(_ => ShowCreateProfile());
Observable.Merge(_selectProfileVM.Ok, _selectProfileVM.Cancel)
.Take(1)
.InvokeCommand(FinishWelcome);
ProfileActivity = _selectProfileVM;
}
private void ShowCreateProfile()
{
_createProfileVM = new CreateProfileViewModel();
Observable.Merge(_createProfileVM.Ok, _createProfileVM.Cancel).Subscribe(_ => ShowSelectProfile());
ProfileActivity = _createProfileVM;
}
public ReactiveCommand<Unit, Unit> FinishWelcome { get; }
}
}
|