wabbajack/Wabbajack.App.Wpf/Views/Installers/InstallationView.xaml.cs

104 lines
4.7 KiB
C#
Raw Normal View History

using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Windows.Controls;
using ReactiveUI;
using System.Windows;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for InstallationView.xaml
/// </summary>
public partial class InstallationView : ReactiveUserControl<InstallerVM>
{
public InstallationView()
{
InitializeComponent();
this.WhenActivated(disposables =>
{
//MidInstallDisplayGrid.Visibility = Visibility.Collapsed;
//LogView.Visibility = Visibility.Collapsed;
//CpuView.Visibility = Visibility.Collapsed;
ViewModel.WhenAnyValue(vm => vm.InstallState)
.Select(v => v != InstallState.Configuration ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, view => view.MidInstallDisplayGrid.Visibility)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.InstallState)
.Select(v => v == InstallState.Configuration ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, view => view.BottomButtonInputGrid.Visibility)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.InstallState)
2022-05-16 23:02:40 +00:00
.Select(es => es is InstallState.Success or InstallState.Failure ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, view => view.InstallComplete.Visibility)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.BackCommand)
.BindToStrict(this, view => view.BackButton.Command)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.OpenReadmeCommand)
.BindToStrict(this, view => view.OpenReadmePreInstallButton.Command)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.OpenDiscordButton)
.BindToStrict(this, view => view.OpenDiscordPreInstallButton.Command)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.VisitModListWebsiteCommand)
.BindToStrict(this, view => view.OpenWebsite.Command)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.VisitModListWebsiteCommand)
.BindToStrict(this, view => view.VisitWebsitePreInstallButton.Command)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.ShowManifestCommand)
.BindToStrict(this, view => view.ShowManifestPreInstallButton.Command)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.LoadingLock.IsLoading)
.Select(loading => loading ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, view => view.ModlistLoadingRing.Visibility)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.BeginCommand)
.BindToStrict(this, view => view.InstallationConfigurationView.BeginButton.Command)
.DisposeWith(disposables);
// Status
ViewModel.WhenAnyValue(vm => vm.StatusText)
2022-08-19 23:59:29 +00:00
.ObserveOnGuiThread()
.BindToStrict(this, view => view.TopProgressBar.Title)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.StatusProgress)
2022-08-19 23:59:29 +00:00
.ObserveOnGuiThread()
.Select(p => p.Value)
.BindToStrict(this, view => view.TopProgressBar.ProgressPercent)
.DisposeWith(disposables);
2022-07-11 20:55:54 +00:00
// Slideshow
ViewModel.WhenAnyValue(vm => vm.SlideShowTitle)
.Select(f => f)
.BindToStrict(this, view => view.DetailImage.Title)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.SlideShowAuthor)
.BindToStrict(this, view => view.DetailImage.Author)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.SlideShowDescription)
.BindToStrict(this, view => view.DetailImage.Description)
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.SlideShowImage)
.BindToStrict(this, view => view.DetailImage.Image)
.DisposeWith(disposables);
});
}
}
}