Split LogCpuView

This commit is contained in:
Justin Swanson 2019-12-08 16:30:49 -06:00
parent f8f0490047
commit 886fbd13ad
7 changed files with 110 additions and 44 deletions

View File

@ -1,44 +1,17 @@
<UserControl
x:Class="Wabbajack.LogCpuView"
x:Class="Wabbajack.CpuView"
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:local="clr-namespace:Wabbajack"
xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="250"
d:DesignHeight="450"
d:DesignWidth="800"
BorderThickness="0"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="500" />
</Grid.ColumnDefinitions>
<Rectangle
Grid.Column="0"
Fill="{StaticResource HeatedBorderBrush}"
Opacity="{Binding ProgressPercent, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
<Rectangle Fill="{StaticResource HeatedBorderBrush}" Opacity="{Binding ProgressPercent, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
<ListBox
Grid.Column="0"
local:AutoScrollBehavior.ScrollOnNewItem="True"
BorderBrush="Transparent"
BorderThickness="1"
ItemsSource="{Binding Log}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ShortDescription}" TextWrapping="WrapWithOverflow" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Rectangle
Grid.Column="2"
Fill="{StaticResource HeatedBorderBrush}"
Opacity="{Binding ProgressPercent, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
<ListBox
Grid.Column="2"
HorizontalAlignment="Stretch"
BorderBrush="Transparent"
BorderThickness="1"

View File

@ -1,22 +1,34 @@
using System.Windows;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for LogCpuView.xaml
/// Interaction logic for CpuView.xaml
/// </summary>
public partial class LogCpuView : UserControl
public partial class CpuView : UserControl
{
public double ProgressPercent
{
get => (double)GetValue(ProgressPercentProperty);
set => SetValue(ProgressPercentProperty, value);
}
public static readonly DependencyProperty ProgressPercentProperty = DependencyProperty.Register(nameof(ProgressPercent), typeof(double), typeof(LogCpuView),
public static readonly DependencyProperty ProgressPercentProperty = DependencyProperty.Register(nameof(ProgressPercent), typeof(double), typeof(CpuView),
new FrameworkPropertyMetadata(default(double)));
public LogCpuView()
public CpuView()
{
InitializeComponent();
}

View File

@ -0,0 +1,26 @@
<UserControl
x:Class="Wabbajack.LogView"
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:local="clr-namespace:Wabbajack"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid>
<Rectangle Fill="{StaticResource HeatedBorderBrush}" Opacity="{Binding ProgressPercent, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
<ListBox
local:AutoScrollBehavior.ScrollOnNewItem="True"
BorderBrush="Transparent"
BorderThickness="1"
ItemsSource="{Binding Log}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ShortDescription}" TextWrapping="WrapWithOverflow" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for LogView.xaml
/// </summary>
public partial class LogView : UserControl
{
public double ProgressPercent
{
get => (double)GetValue(ProgressPercentProperty);
set => SetValue(ProgressPercentProperty, value);
}
public static readonly DependencyProperty ProgressPercentProperty = DependencyProperty.Register(nameof(ProgressPercent), typeof(double), typeof(LogView),
new FrameworkPropertyMetadata(default(double)));
public LogView()
{
InitializeComponent();
}
}
}

View File

@ -240,7 +240,13 @@
Grid.ColumnSpan="5"
Margin="5"
Visibility="{Binding Compiling, Converter={StaticResource bool2VisibilityConverter}, FallbackValue=Hidden}">
<local:LogCpuView ProgressPercent="{Binding PercentCompleted}" />
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="500" />
</Grid.ColumnDefinitions>
<local:LogView Grid.Column="0" ProgressPercent="{Binding PercentCompleted, Mode=OneWay}" />
<local:CpuView Grid.Column="2" ProgressPercent="{Binding PercentCompleted, Mode=OneWay}" />
</Grid>
</Grid>
</UserControl>

View File

@ -343,7 +343,13 @@
Grid.Row="2"
Margin="5,0,5,5"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}, FallbackValue=Hidden}">
<local:LogCpuView ProgressPercent="{Binding PercentCompleted, Mode=OneWay}" />
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="500" />
</Grid.ColumnDefinitions>
<local:LogView Grid.Column="0" ProgressPercent="{Binding PercentCompleted, Mode=OneWay}" />
<local:CpuView Grid.Column="2" ProgressPercent="{Binding PercentCompleted, Mode=OneWay}" />
</Grid>
</Grid>
</UserControl>

View File

@ -173,6 +173,12 @@
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Converters\EqualsToBoolConverter.cs" />
<Compile Include="Views\Common\CpuView.xaml.cs">
<DependentUpon>CpuView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Common\LogView.xaml.cs">
<DependentUpon>LogView.xaml</DependentUpon>
</Compile>
<Compile Include="View Models\UserInterventionHandlers.cs" />
<Compile Include="View Models\WebBrowserVM.cs" />
<Compile Include="Views\Installers\MO2InstallerConfigView.xaml.cs">
@ -234,9 +240,6 @@
</Compile>
<Compile Include="View Models\Compilers\CompilerVM.cs" />
<Compile Include="View Models\MainWindowVM.cs" />
<Compile Include="Views\Common\LogCpuView.xaml.cs">
<DependentUpon>LogCpuView.xaml</DependentUpon>
</Compile>
<Compile Include="Converters\LeftMarginMultiplierConverter.cs" />
<Compile Include="Util\TreeViewItemExtensions.cs" />
<Compile Include="View Models\SlideShow.cs" />
@ -256,6 +259,14 @@
<Compile Include="Views\WebBrowserView.xaml.cs">
<DependentUpon>WebBrowserView.xaml</DependentUpon>
</Compile>
<Page Include="Views\Common\CpuView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Common\LogView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Installers\MO2InstallerConfigView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -304,10 +315,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Common\LogCpuView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>