wabbajack/Wabbajack.App/Views/InstallConfigurationView.axaml.cs
Timothy Baldridge 47e01dcc34 More styling
2021-11-04 07:01:48 -06:00

55 lines
2.0 KiB
C#

using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Avalonia.ReactiveUI;
using Microsoft.Extensions.DependencyInjection;
using ReactiveUI;
using Wabbajack.App.Interfaces;
using Wabbajack.App.ViewModels;
namespace Wabbajack.App.Views;
public partial class InstallConfigurationView : ScreenBase<InstallConfigurationViewModel>, IScreenView
{
public InstallConfigurationView() : base("Install Configuration")
{
InitializeComponent();
DataContext = App.Services.GetService<InstallConfigurationViewModel>()!;
this.WhenActivated(disposables =>
{
ViewModel.WhenAnyValue(vm => vm.ModListPath)
.Subscribe(path => ModListFile.Load(path))
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.ModListPath)
.Subscribe(path => ModListFile.Load(path))
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.Download)
.Subscribe(path => DownloadPath.Load(path))
.DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.Install)
.Subscribe(path => InstallPath.Load(path))
.DisposeWith(disposables);
this.WhenAnyValue(view => view.ModListFile.SelectedPath)
.BindTo(ViewModel, vm => vm.ModListPath)
.DisposeWith(disposables);
this.WhenAnyValue(view => view.DownloadPath.SelectedPath)
.BindTo(ViewModel, vm => vm.Download)
.DisposeWith(disposables);
this.WhenAnyValue(view => view.InstallPath.SelectedPath)
.BindTo(ViewModel, vm => vm.Install)
.DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.BeginCommand, view => view.BeginInstall.Button)
.DisposeWith(disposables);
});
}
public Type ViewModelType => typeof(InstallConfigurationViewModel);
}