wabbajack/Wabbajack/Views/Compilers/CompilerView.xaml
2020-01-11 00:43:40 -06:00

324 lines
16 KiB
XML

<UserControl
x:Class="Wabbajack.CompilerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="clr-namespace:Wabbajack.Common;assembly=Wabbajack.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:Wabbajack"
xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wabbacommon="clr-namespace:Wabbajack.Common;assembly=Wabbajack.Common"
d:DataContext="{d:DesignInstance local:CompilerVM}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="47" />
<RowDefinition Height="4*" />
<RowDefinition Height="*" MinHeight="150" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="5" />
</Grid.ColumnDefinitions>
<local:HeatedBackgroundView
Grid.Row="0"
Grid.RowSpan="3"
Grid.Column="0"
Grid.ColumnSpan="5"
PercentCompleted="{Binding PercentCompleted}" />
<Border
x:Name="ModlistDetailsBackground"
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="2"
Margin="1,1,5,0"
Background="{StaticResource WindowBackgroundBrush}"
BorderThickness="0,0,1,1">
<Border.BorderBrush>
<LinearGradientBrush StartPoint="1,0" EndPoint="0,0">
<GradientStop Offset="0.5" Color="{StaticResource DarkBackgroundColor}" />
<GradientStop Offset="1" Color="{StaticResource WindowBackgroundColor}" />
</LinearGradientBrush>
</Border.BorderBrush>
</Border>
<Border
x:Name="ModlistDetailsHeatBorder"
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="2"
Margin="1,1,5,0"
BorderBrush="{StaticResource HeatedBorderBrush}"
BorderThickness="1"
Opacity="{Binding PercentCompleted}" />
<Border
Grid.Row="1"
Grid.Column="3"
BorderBrush="{StaticResource BorderInterestBrush}"
BorderThickness="1,0,1,1">
<local:DetailImageView
Title="{Binding CurrentModlistSettings.ModListName}"
Author="{Binding CurrentModlistSettings.AuthorText}"
BorderThickness="0"
Description="{Binding CurrentModlistSettings.Description}"
Image="{Binding Image}" />
</Border>
<!-- Comes after image area so shadow can overlay -->
<local:TopProgressView
Title="{Binding CurrentModlistSettings.ModListName, Mode=OneWay}"
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="0"
Grid.ColumnSpan="5"
OverhangShadow="True"
ProgressPercent="{Binding PercentCompleted}"
StatePrefixTitle="{Binding ProgressTitle}" />
<Button
x:Name="BackButton"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="5"
Width="30"
Height="30"
Margin="12,5,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Command="{Binding BackCommand}"
Style="{StaticResource IconCircleButtonStyle}"
ToolTip="Back to main menu">
<icon:PackIconMaterial Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" Kind="ArrowLeft" />
</Button>
<ScrollViewer
Grid.Row="1"
Grid.Column="1"
Margin="5"
Background="Transparent"
HorizontalScrollBarVisibility="Disabled"
IsEnabled="{Binding Compiling, Converter={StaticResource InverseBooleanConverter}}"
VerticalScrollBarVisibility="Auto">
<StackPanel
Margin="0,5,0,0"
Background="Transparent"
DataContext="{Binding CurrentModlistSettings}"
Orientation="Vertical">
<StackPanel.Resources>
<Thickness
x:Key="TitleMargin"
Bottom="1"
Left="5" />
<Style
x:Key="ValueStyle"
BasedOn="{StaticResource MainTextBoxStyle}"
TargetType="TextBox">
<Setter Property="MaxLength" Value="50" />
<Setter Property="AcceptsTab" Value="False" />
<Setter Property="FontSize" Value="15" />
<Setter Property="Margin" Value="0,0,0,6" />
</Style>
<Style
x:Key="PickerStyle"
BasedOn="{StaticResource MainFilePickerStyle}"
TargetType="local:FilePicker">
<Setter Property="Margin" Value="0,0,0,6" />
</Style>
</StackPanel.Resources>
<TextBlock Margin="{StaticResource TitleMargin}" Text="ModList Name" />
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding ModListName, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Margin="{StaticResource TitleMargin}" Text="Author" />
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding AuthorText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Margin="{StaticResource TitleMargin}" Text="Description" />
<TextBox
Height="150"
mahapps:TextBoxHelper.Watermark="(700 characters max)"
AcceptsReturn="True"
AcceptsTab="False"
MaxLength="700"
Style="{StaticResource ValueStyle}"
Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<TextBlock Margin="{StaticResource TitleMargin}" Text="Image" />
<local:FilePicker
PickerVM="{Binding ImagePath}"
Style="{StaticResource PickerStyle}"
ToolTip="Path to an image to display for the modlist." />
<TextBlock Margin="{StaticResource TitleMargin}" Text="Website" />
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding Website, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock
Margin="{StaticResource TitleMargin}"
Text="Readme"
ToolTip="Path to a readme file." />
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<local:FilePicker
Grid.Column="0"
Height="27"
Margin="0,0,3,0"
VerticalAlignment="Center"
PickerVM="{Binding ReadmeFilePath}"
ToolTip="Path to a readme file."
Visibility="{Binding ReadmeIsWebsite, Converter={StaticResource bool2VisibilityConverter}, ConverterParameter=False}" />
<TextBox
Grid.Column="0"
Height="27"
Margin="0,0,3,0"
VerticalAlignment="Center"
Text="{Binding ReadmeWebsite}"
ToolTip="Readme website"
Visibility="{Binding ReadmeIsWebsite, Converter={StaticResource bool2VisibilityConverter}}" />
<Button
Grid.Column="1"
Width="27"
Command="{Binding SwapToWebsiteReadmeCommand}"
ToolTip="Set readme to be a website">
<Button.Style>
<Style BasedOn="{StaticResource IconBareButtonStyle}" TargetType="Button">
<Style.Triggers>
<DataTrigger Binding="{Binding ReadmeIsWebsite}" Value="True">
<Setter Property="Foreground" Value="{StaticResource SecondaryBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<icon:PackIconMaterial
Width="20"
Height="20"
Kind="Web" />
</Button>
<Button
Grid.Column="2"
Width="27"
Command="{Binding SwapToTextReadmeCommand}"
ToolTip="Source readme from a local file (txt | html)">
<Button.Style>
<Style BasedOn="{StaticResource IconBareButtonStyle}" TargetType="Button">
<Style.Triggers>
<DataTrigger Binding="{Binding ReadmeIsWebsite}" Value="False">
<Setter Property="Foreground" Value="{StaticResource SecondaryBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<icon:PackIconMaterial
Width="20"
Height="20"
Kind="File" />
</Button>
</Grid>
</StackPanel>
</ScrollViewer>
<Border
x:Name="BottomBarBackground"
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="5"
Margin="5"
Background="{StaticResource WindowBackgroundBrush}" />
<Grid
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="5"
MaxWidth="1000">
<Grid
Margin="35,0,35,0"
VerticalAlignment="Center"
ClipToBounds="False"
Visibility="{Binding StartedCompilation, Converter={StaticResource bool2VisibilityConverter}, ConverterParameter=False}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid
Grid.Row="0"
Grid.RowSpan="5"
Grid.Column="0"
Margin="15"
VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<local:ImageRadioButtonView
Grid.Row="0"
Height="35"
Margin="4"
IsChecked="{Binding SelectedCompilerType, Converter={StaticResource EqualsToBoolConverter}, ConverterParameter={x:Static wabbacommon:ModManager.MO2}}">
<local:ImageRadioButtonView.Image>
<BitmapImage UriSource="../../Resources/MO2Button.png" />
</local:ImageRadioButtonView.Image>
</local:ImageRadioButtonView>
<local:ImageRadioButtonView
Grid.Row="1"
Height="35"
Margin="4"
IsChecked="{Binding SelectedCompilerType, Converter={StaticResource EqualsToBoolConverter}, ConverterParameter={x:Static wabbacommon:ModManager.Vortex}}">
<local:ImageRadioButtonView.Image>
<BitmapImage UriSource="../../Resources/VortexButton.png" />
</local:ImageRadioButtonView.Image>
</local:ImageRadioButtonView>
</Grid>
<ContentPresenter
Grid.Row="1"
Grid.Column="1"
Content="{Binding Compiler}">
<ContentPresenter.Resources>
<DataTemplate DataType="{x:Type local:MO2CompilerVM}">
<local:MO2CompilerConfigView />
</DataTemplate>
<DataTemplate DataType="{x:Type local:VortexCompilerVM}">
<local:VortexCompilerConfigView />
</DataTemplate>
</ContentPresenter.Resources>
</ContentPresenter>
<local:BeginButton
Grid.Row="0"
Grid.RowSpan="3"
Grid.Column="5"
Command="{Binding BeginCommand}" />
</Grid>
</Grid>
<Grid
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="5"
Margin="5"
Visibility="{Binding StartedCompilation, Converter={StaticResource bool2VisibilityConverter}, FallbackValue=Hidden}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<local:LogView Grid.Column="0" ProgressPercent="{Binding PercentCompleted, Mode=OneWay}" />
<local:CpuView
Grid.Column="2"
ProgressPercent="{Binding PercentCompleted, Mode=OneWay}"
SettingsHook="{Binding MWVM.Settings}"
ViewModel="{Binding}"
Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsNotNullVisibilityConverter}, ConverterParameter=False}" />
<local:AttentionBorder Grid.Column="2" Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsNotNullVisibilityConverter}}">
<local:AttentionBorder.DisplayContent>
<Grid>
<local:ConfirmationInterventionView DataContext="{Binding ActiveGlobalUserIntervention}" Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsTypeVisibilityConverter}, ConverterParameter={x:Type common:ConfirmationIntervention}}" />
</Grid>
</local:AttentionBorder.DisplayContent>
</local:AttentionBorder>
<local:CompilationCompleteView Grid.Column="2" Visibility="{Binding Completed, Converter={StaticResource IsNotNullVisibilityConverter}, FallbackValue=Collapsed}" />
</Grid>
</Grid>
</UserControl>