mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
CompilerView revamp. Wiring still needs work
This commit is contained in:
parent
c340cadd42
commit
f339c633bb
@ -26,16 +26,16 @@ namespace Wabbajack
|
||||
public string ModListName { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string Location { get; set; }
|
||||
public string ModlistLocation { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool UIReady { get; set; } = true;
|
||||
public bool Compiling { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string AuthorName { get; set; }
|
||||
public string AuthorText { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string Summary { get; set; } = "Description (700 characters max)";
|
||||
public string Description { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string ImagePath { get; set; }
|
||||
@ -55,16 +55,23 @@ namespace Wabbajack
|
||||
[Reactive]
|
||||
public string DownloadLocation { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool ModlistLocationInError { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool DownloadLocationInError { get; set; }
|
||||
|
||||
public IReactiveCommand BeginCommand { get; }
|
||||
|
||||
public CompilerVM(MainWindowVM mainWindowVM, string source)
|
||||
{
|
||||
this.MWVM = mainWindowVM;
|
||||
this.Location = source;
|
||||
this.ModlistLocation = source;
|
||||
|
||||
this.BeginCommand = ReactiveCommand.CreateFromTask(
|
||||
execute: this.ExecuteBegin,
|
||||
canExecute: this.WhenAny(x => x.UIReady)
|
||||
canExecute: this.WhenAny(x => x.Compiling)
|
||||
.Select(compiling => !compiling)
|
||||
.ObserveOnGuiThread());
|
||||
|
||||
this._Image = this.WhenAny(x => x.ImagePath)
|
||||
@ -83,9 +90,9 @@ namespace Wabbajack
|
||||
|
||||
// Load settings
|
||||
CompilationSettings settings = this.MWVM.Settings.CompilationSettings.TryCreate(source);
|
||||
this.AuthorName = settings.Author;
|
||||
this.AuthorText = settings.Author;
|
||||
this.ModListName = settings.ModListName;
|
||||
this.Summary = settings.Description;
|
||||
this.Description = settings.Description;
|
||||
this.ReadMeText = settings.Readme;
|
||||
this.ImagePath = settings.SplashScreen;
|
||||
this.Website = settings.Website;
|
||||
@ -95,18 +102,18 @@ namespace Wabbajack
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(settings.Location))
|
||||
{
|
||||
this.Location = settings.Location;
|
||||
this.ModlistLocation = settings.Location;
|
||||
}
|
||||
this.MWVM.Settings.SaveSignal
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
settings.Author = this.AuthorName;
|
||||
settings.Author = this.AuthorText;
|
||||
settings.ModListName = this.ModListName;
|
||||
settings.Description = this.Summary;
|
||||
settings.Description = this.Description;
|
||||
settings.Readme = this.ReadMeText;
|
||||
settings.SplashScreen = this.ImagePath;
|
||||
settings.Website = this.Website;
|
||||
settings.Location = this.Location;
|
||||
settings.Location = this.ModlistLocation;
|
||||
settings.DownloadLocation = this.DownloadLocation;
|
||||
})
|
||||
.DisposeWith(this.CompositeDisposable);
|
||||
@ -136,15 +143,15 @@ namespace Wabbajack
|
||||
{
|
||||
MO2Profile = this.MOProfile,
|
||||
ModListName = this.ModListName,
|
||||
ModListAuthor = this.AuthorName,
|
||||
ModListDescription = this.Summary,
|
||||
ModListAuthor = this.AuthorText,
|
||||
ModListDescription = this.Description,
|
||||
ModListImage = this.ImagePath,
|
||||
ModListWebsite = this.Website,
|
||||
ModListReadme = this.ReadMeText,
|
||||
};
|
||||
await Task.Run(() =>
|
||||
{
|
||||
UIReady = false;
|
||||
Compiling = true;
|
||||
try
|
||||
{
|
||||
compiler.Compile();
|
||||
@ -160,14 +167,14 @@ namespace Wabbajack
|
||||
}
|
||||
finally
|
||||
{
|
||||
UIReady = true;
|
||||
Compiling = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.Log("Cannot compile modlist: no valid Mod Organizer profile directory selected.");
|
||||
UIReady = true;
|
||||
Compiling = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,78 +6,36 @@
|
||||
xmlns:local="clr-namespace:Wabbajack"
|
||||
xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DataContext="{d:DesignInstance local:CompilerVM}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Viewbox Stretch="Uniform">
|
||||
<Grid Margin="4,0,4,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="435" />
|
||||
<RowDefinition Height="10" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="320" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="45" />
|
||||
<RowDefinition Height="4*" />
|
||||
<RowDefinition Height="*" MinHeight="150" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
Margin="5,0"
|
||||
ClipToBounds="False">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="638" />
|
||||
<ColumnDefinition Width="4" />
|
||||
<ColumnDefinition Width="638" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="1" />
|
||||
<ColumnDefinition Width="5*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Margin="0,8,0,8"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Text="Compiling" />
|
||||
<TextBlock FontSize="16" Text=" : " />
|
||||
<TextBlock FontSize="16" Text="{Binding MOProfile}" />
|
||||
</StackPanel>
|
||||
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0,8,0,8"
|
||||
IsEnabled="{Binding UIReady}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Image
|
||||
Grid.Row="0"
|
||||
Source="{Binding Image}"
|
||||
Stretch="Fill" />
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Column="0" Content="Splash Screen Path:" />
|
||||
<local:FilePicker
|
||||
Grid.Column="1"
|
||||
Width="534"
|
||||
HorizontalAlignment="Left"
|
||||
DoExistsCheck="False"
|
||||
Filter="Banner image|*.png"
|
||||
IsEnabled="{Binding UIReady}"
|
||||
PathType="File"
|
||||
TargetPath="{Binding ImagePath}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Grid.Column="0"
|
||||
Margin="5,0,5,5"
|
||||
Background="Transparent"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
IsEnabled="{Binding UIReady}"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Background="Transparent" Orientation="Vertical">
|
||||
<StackPanel
|
||||
Margin="0,20,0,0"
|
||||
Background="Transparent"
|
||||
Orientation="Vertical">
|
||||
<StackPanel.Resources>
|
||||
<Thickness
|
||||
x:Key="TitleMargin"
|
||||
@ -94,9 +52,9 @@
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<TextBlock Margin="{StaticResource TitleMargin}" Text="ModList Name" />
|
||||
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding ModListName}" />
|
||||
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding ModListName, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Margin="{StaticResource TitleMargin}" Text="Author" />
|
||||
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding AuthorName}" />
|
||||
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding AuthorText, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Margin="{StaticResource TitleMargin}" Text="Description" />
|
||||
<TextBox
|
||||
Height="150"
|
||||
@ -105,7 +63,7 @@
|
||||
AcceptsTab="False"
|
||||
MaxLength="700"
|
||||
Style="{StaticResource ValueStyle}"
|
||||
Text="{Binding Summary}"
|
||||
Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock Margin="{StaticResource TitleMargin}" Text="Website" />
|
||||
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding Website}" />
|
||||
@ -120,148 +78,111 @@
|
||||
ToolTip="Path to a readme file." />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<ProgressBar
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="1,0,1,0"
|
||||
Background="#444444"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Value="{Binding MWVM.QueueProgress, Mode=OneWay}" />
|
||||
|
||||
<!-- Log -->
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Margin="0,16,0,8"
|
||||
FontSize="14"
|
||||
Text="Log:" />
|
||||
<ListBox
|
||||
Grid.Row="4"
|
||||
Margin="0,0,2,0"
|
||||
local:AutoScrollBehavior.ScrollOnNewItem="True"
|
||||
ItemsSource="{Binding MWVM.Log}" />
|
||||
<!-- End Log -->
|
||||
|
||||
<!-- Location -->
|
||||
<local:DetailImageView
|
||||
Title="{Binding ModListName}"
|
||||
Grid.Column="2"
|
||||
Author="{Binding AuthorText}"
|
||||
BorderThickness="0"
|
||||
Description="{Binding Description}"
|
||||
Image="{Binding Image}" />
|
||||
<Rectangle
|
||||
x:Name="ControlVerticalThinSeparator"
|
||||
Grid.Column="1"
|
||||
Width="1"
|
||||
HorizontalAlignment="Center"
|
||||
Fill="{StaticResource DarkBackgroundBrush}"
|
||||
SnapsToDevicePixels="True" />
|
||||
</Grid>
|
||||
<!-- Comes after center area so shadow can overlay -->
|
||||
<local:TopProgressView
|
||||
Title="{Binding ModListName, Mode=OneWay}"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
OverhangShadow="True"
|
||||
ProgressPercent="{Binding ProgressPercent}"
|
||||
StatePrefixTitle="Compiling" />
|
||||
<Rectangle
|
||||
x:Name="ControlTopThinSeparator"
|
||||
Grid.Row="2"
|
||||
Height="1"
|
||||
Margin="25,0"
|
||||
VerticalAlignment="Top"
|
||||
Fill="{StaticResource DarkBackgroundBrush}"
|
||||
SnapsToDevicePixels="True" />
|
||||
<Grid Grid.Row="2" MaxWidth="1000">
|
||||
<Border
|
||||
x:Name="ConfigurationBackgroundHaze"
|
||||
Height="120"
|
||||
Background="{StaticResource PrimaryVariantBrush}"
|
||||
CornerRadius="50"
|
||||
Opacity="0.10">
|
||||
<Border.Effect>
|
||||
<BlurEffect Radius="45" />
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<Grid
|
||||
Grid.Row="5"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="0"
|
||||
Margin="-4,10,0,10"
|
||||
HorizontalAlignment="Stretch">
|
||||
Margin="35,0,35,0"
|
||||
VerticalAlignment="Center"
|
||||
ClipToBounds="False"
|
||||
Visibility="{Binding Compiling, Converter={StaticResource bool2VisibilityConverter}, ConverterParameter=False}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition MinHeight="10" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Label
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Content="Installation Location:" />
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="Modlist Location"
|
||||
TextAlignment="Center" />
|
||||
<local:FilePicker
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
DoExistsCheck="False"
|
||||
IsEnabled="{Binding UIReady}"
|
||||
PathType="Folder"
|
||||
SetTargetPathCommand="{Binding ChangePathCommand}"
|
||||
TargetPath="{Binding Location}" />
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Content="Download Location:" />
|
||||
<local:FilePicker
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
DoExistsCheck="False"
|
||||
IsEnabled="{Binding UIReady}"
|
||||
PathType="Folder"
|
||||
SetTargetPathCommand="{Binding ChangeDownloadPathCommand}"
|
||||
TargetPath="{Binding DownloadLocation}" />
|
||||
</Grid>
|
||||
<!-- End Location -->
|
||||
|
||||
|
||||
<!-- Work Queue Start -->
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
Margin="0,16,0,8"
|
||||
FontSize="14"
|
||||
Text="Work Queue:" />
|
||||
|
||||
<ListBox
|
||||
Grid.Row="4"
|
||||
Grid.Column="2"
|
||||
Width="Auto"
|
||||
HorizontalAlignment="Stretch"
|
||||
ItemsSource="{Binding MWVM.StatusList}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ProgressBar
|
||||
Grid.Column="0"
|
||||
Width="100"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Value="{Binding Progress, Mode=OneTime}">
|
||||
<ProgressBar.Style>
|
||||
<Style TargetType="ProgressBar">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Progress}" Value="0">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ProgressBar.Style>
|
||||
</ProgressBar>
|
||||
<TextBlock Grid.Column="1" Text=" CPU " />
|
||||
<TextBlock Grid.Column="2" Text="{Binding ID}" />
|
||||
<TextBlock Grid.Column="3" Text=" - " />
|
||||
<TextBlock Grid.Column="4" Text="{Binding Msg}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<!-- Work Queue End -->
|
||||
|
||||
<Grid
|
||||
Grid.Row="5"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="2"
|
||||
Margin="0,10,0,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
<Button
|
||||
Grid.Row="0"
|
||||
Margin="0,0,0,4"
|
||||
Command="{Binding ShowReportCommand}"
|
||||
Visibility="{Binding HTMLReport, Converter={StaticResource IsNotNullVisibilityConverter}}">
|
||||
<TextBlock FontSize="13" FontWeight="Bold">View ModList Contents</TextBlock>
|
||||
</Button>
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
Height="30"
|
||||
VerticalAlignment="Center"
|
||||
DoExistsCheck="True"
|
||||
FontSize="14"
|
||||
PathType="File"
|
||||
PromptTitle="Select Modlist"
|
||||
TargetPath="{Binding ModlistLocation}" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Margin="0,4,0,0"
|
||||
Command="{Binding BeginCommand}">
|
||||
<TextBlock FontSize="13" FontWeight="Bold">Begin</TextBlock>
|
||||
</Button>
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="Download Location"
|
||||
TextAlignment="Center" />
|
||||
<local:FilePicker
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Height="30"
|
||||
VerticalAlignment="Center"
|
||||
DoExistsCheck="True"
|
||||
FontSize="14"
|
||||
PathType="Folder"
|
||||
PromptTitle="Select Download Location"
|
||||
TargetPath="{Binding DownloadLocation}" />
|
||||
<local:BeginButton
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="4" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
<Grid
|
||||
Grid.Row="2"
|
||||
Margin="5,0,5,5"
|
||||
Visibility="{Binding Compiling, Converter={StaticResource bool2VisibilityConverter}, FallbackValue=Hidden}">
|
||||
<local:LogCpuView DataContext="{Binding MWVM}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
Loading…
Reference in New Issue
Block a user