2021-09-27 12:42:46 +00:00
|
|
|
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;
|
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
namespace Wabbajack.App.Views;
|
|
|
|
|
2021-11-04 13:01:48 +00:00
|
|
|
public partial class InstallConfigurationView : ScreenBase<InstallConfigurationViewModel>, IScreenView
|
2021-09-27 12:42:46 +00:00
|
|
|
{
|
2021-11-04 13:01:48 +00:00
|
|
|
public InstallConfigurationView() : base("Install Configuration")
|
2021-09-27 12:42:46 +00:00
|
|
|
{
|
2021-10-23 16:51:17 +00:00
|
|
|
InitializeComponent();
|
|
|
|
DataContext = App.Services.GetService<InstallConfigurationViewModel>()!;
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
this.WhenActivated(disposables =>
|
|
|
|
{
|
2021-11-04 05:13:25 +00:00
|
|
|
ViewModel.WhenAnyValue(vm => vm.ModListPath)
|
|
|
|
.Subscribe(path => ModListFile.Load(path))
|
2021-10-23 16:51:17 +00:00
|
|
|
.DisposeWith(disposables);
|
2021-11-08 23:17:33 +00:00
|
|
|
|
2021-11-04 05:13:25 +00:00
|
|
|
ViewModel.WhenAnyValue(vm => vm.Download)
|
|
|
|
.Subscribe(path => DownloadPath.Load(path))
|
|
|
|
.DisposeWith(disposables);
|
|
|
|
|
|
|
|
ViewModel.WhenAnyValue(vm => vm.Install)
|
|
|
|
.Subscribe(path => InstallPath.Load(path))
|
2021-10-23 16:51:17 +00:00
|
|
|
.DisposeWith(disposables);
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-11-04 05:13:25 +00:00
|
|
|
this.WhenAnyValue(view => view.ModListFile.SelectedPath)
|
|
|
|
.BindTo(ViewModel, vm => vm.ModListPath)
|
2021-10-23 16:51:17 +00:00
|
|
|
.DisposeWith(disposables);
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-11-04 05:13:25 +00:00
|
|
|
this.WhenAnyValue(view => view.DownloadPath.SelectedPath)
|
|
|
|
.BindTo(ViewModel, vm => vm.Download)
|
2021-10-23 16:51:17 +00:00
|
|
|
.DisposeWith(disposables);
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-11-04 05:13:25 +00:00
|
|
|
this.WhenAnyValue(view => view.InstallPath.SelectedPath)
|
|
|
|
.BindTo(ViewModel, vm => vm.Install)
|
2021-10-23 16:51:17 +00:00
|
|
|
.DisposeWith(disposables);
|
2021-11-04 13:01:48 +00:00
|
|
|
|
2021-11-08 23:17:33 +00:00
|
|
|
this.OneWayBind(ViewModel, vm => vm.ModListImage, view => view.ModListImage.Source)
|
|
|
|
.DisposeWith(disposables);
|
|
|
|
|
2021-11-04 13:01:48 +00:00
|
|
|
this.BindCommand(ViewModel, vm => vm.BeginCommand, view => view.BeginInstall.Button)
|
|
|
|
.DisposeWith(disposables);
|
2021-10-23 16:51:17 +00:00
|
|
|
});
|
2021-09-27 12:42:46 +00:00
|
|
|
}
|
2021-10-23 16:51:17 +00:00
|
|
|
|
|
|
|
public Type ViewModelType => typeof(InstallConfigurationViewModel);
|
2021-09-27 12:42:46 +00:00
|
|
|
}
|