MainWindowVM

This commit is contained in:
Justin Swanson 2019-10-21 21:12:55 -05:00
parent 4f8167555d
commit 4f6c8b4aae
4 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,23 @@
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wabbajack.Lib;
namespace Wabbajack
{
public class MainWindowVM : ViewModel
{
public AppState AppState { get; }
private ViewModel _ActivePane;
public ViewModel ActivePane { get => _ActivePane; set => this.RaiseAndSetIfChanged(ref _ActivePane, value); }
public MainWindowVM(RunMode mode)
{
this.AppState = new AppState(mode);
}
}
}

View File

@ -16,7 +16,7 @@
Style="{StaticResource {x:Type Window}}"
WindowStyle="ToolWindow"
mc:Ignorable="d">
<Viewbox Stretch="Uniform">
<Viewbox Stretch="Uniform" DataContext="{Binding AppState}">
<Grid Margin="4,0,4,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />

View File

@ -23,10 +23,11 @@ namespace Wabbajack
InitializeComponent();
var context = new AppState(mode);
var mainVM = new MainWindowVM(mode);
var context = mainVM.AppState;
context.LogMsg($"Wabbajack Build - {ThisAssembly.Git.Sha}");
SetupHandlers(context);
DataContext = context;
DataContext = mainVM;
Utils.SetLoggerFn(s => context.LogMsg(s));
Utils.SetStatusFn((msg, progress) => WorkQueue.Report(msg, progress));

View File

@ -227,6 +227,7 @@
<Compile Include="Converters\IsNotNullVisibilityConverter.cs" />
<Compile Include="Enums\RunMode.cs" />
<Compile Include="Extensions\ReactiveUIExt.cs" />
<Compile Include="View Models\MainWindowVM.cs" />
<Compile Include="Views\SlideshowView.xaml.cs">
<DependentUpon>SlideshowView.xaml</DependentUpon>
</Compile>