Update progress bars

This commit is contained in:
Timothy Baldridge 2021-12-31 16:44:36 -07:00
parent 7443a0b3f3
commit b9e44101aa
2 changed files with 27 additions and 0 deletions

View File

@ -54,6 +54,13 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
private const string LastLoadedModlist = "last-loaded-modlist";
private const string InstallSettingsPrefix = "install-settings-";
[Reactive]
public Percent StatusProgress { get; set; }
[Reactive]
public string StatusText { get; set; }
[Reactive]
public ModList ModList { get; set; }
@ -195,6 +202,8 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
ModList = await StandardInstaller.LoadFromFile(_dtos, path);
ModListImage = BitmapFrame.Create(await StandardInstaller.ModListImageStream(path));
StatusText = $"Install configuration for {ModList.Name}";
var hex = (await ModListLocation.TargetPath.ToString().Hash()).ToHex();
var prevSettings = await _settingsManager.Load<SavedInstallSettings>(InstallSettingsPrefix + hex);
@ -243,6 +252,13 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
GameFolder = _gameLocator.GameLocation(ModList.GameType)
});
installer.OnStatusUpdate = update =>
{
StatusText = update.StatusText;
StatusProgress = update.StepsProgress;
};
await installer.Begin(CancellationToken.None);
InstallState = InstallState.Success;
@ -254,6 +270,7 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
}
class SavedInstallSettings
{
public AbsolutePath ModListLocation { get; set; }

View File

@ -58,6 +58,16 @@ namespace Wabbajack
ViewModel.WhenAnyValue(vm => vm.BeginCommand)
.BindToStrict(this, view => view.InstallationConfigurationView.BeginButton.Command)
.DisposeWith(disposables);
// Status
ViewModel.WhenAnyValue(vm => vm.StatusText)
.BindToStrict(this, view => view.TopProgressBar.Title)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.StatusProgress)
.Select(p => p.Value)
.BindToStrict(this, view => view.TopProgressBar.ProgressPercent)
.DisposeWith(disposables);
// Slideshow
ViewModel.WhenAnyValue(vm => vm.SlideShowTitle)