Created basic ManifestView, Window and VM

This commit is contained in:
erri120 2020-02-01 14:42:31 +01:00
parent 5b5678363f
commit 7b66aee5a8
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135
6 changed files with 107 additions and 1 deletions

View File

@ -308,7 +308,10 @@ namespace Wabbajack
.ToGuiProperty(this, nameof(ModListName));
// Define commands
//ShowManifestCommand = ReactiveCommand.Create(ShowReport);
ShowManifestCommand = ReactiveCommand.Create(() =>
{
new ManifestWindow(ModList.SourceModList).Show();
});
OpenReadmeCommand = ReactiveCommand.Create(
execute: () => this.ModList?.OpenReadmeWindow(),
canExecute: this.WhenAny(x => x.ModList)

View File

@ -0,0 +1,14 @@
using Wabbajack.Lib;
namespace Wabbajack.View_Models
{
public class ManifestVM : ViewModel
{
public readonly Manifest Manifest;
public ManifestVM(ModList modlist)
{
Manifest = new Manifest(modlist);
}
}
}

View File

@ -0,0 +1,37 @@
<reactiveUi:ReactiveUserControl x:TypeArguments="viewModels:ManifestVM" x:Class="Wabbajack.ManifestView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wabbajack"
xmlns:reactiveUi="http://reactiveui.net"
xmlns:viewModels="clr-namespace:Wabbajack.View_Models"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<ScrollViewer>
<Grid Margin="8">
<TextBlock x:Name="Name" FontSize="20"/>
</Grid>
<!--<ItemsControl Margin="8" x:Name="ManifestItemsControl">
<ItemsControl.Resources>
<DataTemplate x:Key="HeaderTemplate">
<Grid>
<TextBlock Text="{Binding Path=Text}" FontSize="20"/>
</Grid>
</DataTemplate>
</ItemsControl.Resources>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<ScrollViewer />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplateSelector>
<DataTemplateSelector x:Name="DataTemplateSelector"/>
</ItemsControl.ItemTemplateSelector>
</ItemsControl>-->
</ScrollViewer>
</reactiveUi:ReactiveUserControl>

View File

@ -0,0 +1,25 @@
using System.Reactive.Disposables;
using ReactiveUI;
using Wabbajack.Lib;
using Wabbajack.View_Models;
namespace Wabbajack
{
public partial class ManifestView
{
public ModList Modlist { get; set; }
public ManifestView(ModList modlist)
{
Modlist = modlist;
InitializeComponent();
ViewModel = new ManifestVM(modlist);
this.WhenActivated(disposable =>
{
this.Bind(ViewModel, x => x.Manifest.Name, x => x.Name.Text)
.DisposeWith(disposable);
});
}
}
}

View File

@ -0,0 +1,11 @@
<Window x:Class="Wabbajack.ManifestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Wabbajack"
mc:Ignorable="d"
Title="ManifestWindow" Height="450" Width="800" d:DataContext="{d:DesignInstance local:ManifestWindow }">
<Grid x:Name="Grid">
</Grid>
</Window>

View File

@ -0,0 +1,16 @@
using Wabbajack.Lib;
namespace Wabbajack
{
public partial class ManifestWindow
{
public ModList Modlist { get; set; }
public ManifestWindow(ModList modlist)
{
Modlist = modlist;
InitializeComponent();
Grid.Children.Add(new ManifestView(Modlist));
}
}
}