TopProgressView and LogCpuView

This commit is contained in:
Justin Swanson 2019-11-06 23:33:08 -06:00
parent ba8e423f26
commit e0974a5fc0
7 changed files with 308 additions and 220 deletions

View File

@ -76,6 +76,9 @@ namespace Wabbajack
private readonly ObservableAsPropertyHelper<string> _Description;
public string Description => _Description.Value;
private readonly ObservableAsPropertyHelper<string> _ProgressTitle;
public string ProgressTitle => _ProgressTitle.Value;
// Command properties
public IReactiveCommand BeginCommand { get; }
public IReactiveCommand ShowReportCommand { get; }
@ -231,6 +234,16 @@ namespace Wabbajack
}
})
.DisposeWith(this.CompositeDisposable);
this._ProgressTitle = Observable.CombineLatest(
this.WhenAny(x => x.Installing),
this.WhenAny(x => x.InstallingMode),
resultSelector: (installing, mode) =>
{
if (!installing) return "Configuring";
return mode ? "Installing" : "Installed";
})
.ToProperty(this, nameof(this.ProgressTitle));
}
private void ShowReport()

View File

@ -57,15 +57,14 @@
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="5" />
<RowDefinition Height="45" />
<RowDefinition Height="4*" />
<RowDefinition Height="*" MinHeight="150" />
</Grid.RowDefinitions>
<Rectangle
x:Name="BorderEdgeFadeDown"
Grid.Row="1"
Grid.RowSpan="3">
Grid.RowSpan="2">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="#191919" />
@ -76,7 +75,7 @@
<!-- Slideshow -->
<Border
x:Name="Slideshow"
Grid.Row="2"
Grid.Row="1"
Margin="5,0,5,5"
BorderBrush="#171717"
BorderThickness="1,0,1,1"
@ -367,176 +366,11 @@
Fill="Transparent" />
</Grid>
</Border>
<!-- Top progress bar -->
<!-- Comes after slideshow control, so that any effects/overlap goes on top -->
<Rectangle
Grid.Row="2"
Height="25"
Margin="6,0"
VerticalAlignment="Top"
IsHitTestVisible="False">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="#AA000000" />
<GradientStop Offset="1" Color="#00000000" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Grid.Row="1" Fill="{StaticResource BackgroundBrush}" />
<mahapps:MetroProgressBar
x:Name="BottomProgressBarDarkGlow"
Grid.Row="1"
Grid.RowSpan="2"
Height="16"
Margin="-4"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="Transparent"
Foreground="{StaticResource PrimaryVariantBrush}"
Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}">
<mahapps:MetroProgressBar.Effect>
<BlurEffect Radius="25" />
</mahapps:MetroProgressBar.Effect>
</mahapps:MetroProgressBar>
<mahapps:MetroProgressBar
x:Name="BottomProgressBarBrightGlow"
Grid.Row="1"
Grid.RowSpan="2"
Height="6"
Margin="-4"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="Transparent"
Foreground="{StaticResource PrimaryBrush}"
Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}">
<mahapps:MetroProgressBar.Effect>
<BlurEffect Radius="20" />
</mahapps:MetroProgressBar.Effect>
</mahapps:MetroProgressBar>
<Grid x:Name="TopBarGrid" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<mahapps:MetroProgressBar
Grid.Column="0"
Grid.ColumnSpan="4"
Background="{StaticResource WindowBackgroundBrush}"
BorderThickness="0"
Foreground="Transparent"
Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}" />
<mahapps:MetroProgressBar
Grid.Column="0"
Grid.ColumnSpan="4"
Background="Transparent"
BorderThickness="0"
Foreground="{StaticResource PrimaryVariantBrush}"
Maximum="1"
Opacity="{Binding ProgressPercent, Mode=OneWay}"
Value="{Binding ProgressPercent, Mode=OneWay}" />
<TextBlock
Grid.Column="0"
Width="90"
Margin="10,0,0,8"
VerticalAlignment="Bottom"
FontFamily="Lucida Sans"
FontWeight="Black"
TextAlignment="Right">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="Configuring" />
<Setter Property="FontSize" Value="15" />
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding InstallingMode}" Value="True" />
<Condition Binding="{Binding Installing}" Value="True" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="Text" Value="Installing" />
<Setter Property="FontSize" Value="14" />
</MultiDataTrigger.Setters>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding InstallingMode}" Value="True" />
<Condition Binding="{Binding Installing}" Value="False" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="Text" Value="Installed" />
<Setter Property="FontSize" Value="14" />
</MultiDataTrigger.Setters>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock
Grid.Column="1"
Margin="15,0,0,0"
VerticalAlignment="Center"
FontFamily="Lucida Sans"
FontSize="25"
FontWeight="Black"
Text="{Binding ModListName}" />
<!-- Readd when Pause/Stop implementations added -->
<!--<Button Grid.Column="2"
ToolTip="Pause Installation"
Margin="0,0,0,5"
Width="50"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}}">
<icon:PackIconMaterial
Kind="Pause" />
</Button>
<Button Grid.Column="3"
ToolTip="Stop Installation"
Margin="0,0,0,5"
Width="50"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}}" >
<icon:PackIconFontAwesome
Width="25"
Height="25"
Kind="TimesCircleSolid" />
</Button>-->
</Grid>
<mahapps:MetroProgressBar
x:Name="BottomProgressBar"
Grid.Row="1"
Grid.RowSpan="2"
Height="5"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="Transparent"
Foreground="{StaticResource PrimaryBrush}"
Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}" />
<mahapps:MetroProgressBar
x:Name="BottomProgressBarHighlight"
Grid.Row="1"
Grid.RowSpan="2"
Height="5"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="Transparent"
Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}">
<mahapps:MetroProgressBar.Foreground>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="#CCFFFFFF" />
<GradientStop Offset="0.3" Color="#00FFFFFF" />
<GradientStop Offset="0.7" Color="#00FFFFFF" />
<GradientStop Offset="1" Color="#CCFFFFFF" />
</LinearGradientBrush>
</mahapps:MetroProgressBar.Foreground>
</mahapps:MetroProgressBar>
<local:TopProgressView Grid.Row="0" Grid.RowSpan="2" />
<!-- Bottom Area -->
<Grid
Grid.Row="3"
Grid.Row="2"
Margin="5,0,5,5"
ClipToBounds="True"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}, ConverterParameter=False}">
@ -738,57 +572,10 @@
Fill="{StaticResource DarkBackgroundBrush}" />
</Grid>
<Grid
Grid.Row="3"
Grid.Row="2"
Margin="5,0,5,5"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="4" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ListBox
Grid.Column="0"
local:AutoScrollBehavior.ScrollOnNewItem="True"
ItemsSource="{Binding MWVM.Log}" />
<ListBox
x:Name="CpuListBox"
Grid.Column="2"
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, Mode=OneTime}" 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, Mode=OneTime}" />
<TextBlock Grid.Column="3" Text=" - " />
<TextBlock Grid.Column="4" Text="{Binding Msg, Mode=OneTime}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<local:LogCpuView DataContext="{Binding MWVM}" />
</Grid>
</Grid>
</UserControl>

View File

@ -0,0 +1,62 @@
<UserControl
x:Class="Wabbajack.LogCpuView"
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="250"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="4" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ListBox
Grid.Column="0"
Margin="0,0,2,0"
local:AutoScrollBehavior.ScrollOnNewItem="True"
ItemsSource="{Binding Log}" />
<ListBox
Grid.Column="2"
HorizontalAlignment="Stretch"
ItemsSource="{Binding 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>
</Grid>
</UserControl>

View File

@ -0,0 +1,28 @@
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
/// </summary>
public partial class LogCpuView : UserControl
{
public LogCpuView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,156 @@
<UserControl
x:Class="Wabbajack.TopProgressView"
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="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="5" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<Rectangle
Grid.Row="2"
Height="25"
Margin="6,0"
VerticalAlignment="Top"
IsHitTestVisible="False">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="#AA000000" />
<GradientStop Offset="1" Color="#00000000" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle Grid.Row="1" Fill="{StaticResource BackgroundBrush}" />
<mahapps:MetroProgressBar
x:Name="BottomProgressBarDarkGlow"
Grid.Row="1"
Grid.RowSpan="2"
Height="16"
Margin="-4"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="Transparent"
Foreground="{StaticResource PrimaryVariantBrush}"
Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}">
<mahapps:MetroProgressBar.Effect>
<BlurEffect Radius="25" />
</mahapps:MetroProgressBar.Effect>
</mahapps:MetroProgressBar>
<mahapps:MetroProgressBar
x:Name="BottomProgressBarBrightGlow"
Grid.Row="1"
Grid.RowSpan="2"
Height="6"
Margin="-4"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="Transparent"
Foreground="{StaticResource PrimaryBrush}"
Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}">
<mahapps:MetroProgressBar.Effect>
<BlurEffect Radius="20" />
</mahapps:MetroProgressBar.Effect>
</mahapps:MetroProgressBar>
<Grid x:Name="TopBarGrid" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<mahapps:MetroProgressBar
Grid.Column="0"
Grid.ColumnSpan="4"
Background="{StaticResource WindowBackgroundBrush}"
BorderThickness="0"
Foreground="Transparent"
Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}" />
<mahapps:MetroProgressBar
Grid.Column="0"
Grid.ColumnSpan="4"
Background="Transparent"
BorderThickness="0"
Foreground="{StaticResource PrimaryVariantBrush}"
Maximum="1"
Opacity="{Binding ProgressPercent, Mode=OneWay}"
Value="{Binding ProgressPercent, Mode=OneWay}" />
<TextBlock
Grid.Column="0"
Width="90"
Margin="10,0,0,8"
VerticalAlignment="Bottom"
FontFamily="Lucida Sans"
FontWeight="Black"
Text="{Binding ProgressTitle}"
TextAlignment="Right" />
<TextBlock
Grid.Column="1"
Margin="15,0,0,0"
VerticalAlignment="Center"
FontFamily="Lucida Sans"
FontSize="25"
FontWeight="Black"
Text="{Binding ModListName}" />
<!-- Readd when Pause/Stop implementations added -->
<!--<Button Grid.Column="2"
ToolTip="Pause Installation"
Margin="0,0,0,5"
Width="50"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}}">
<icon:PackIconMaterial
Kind="Pause" />
</Button>
<Button Grid.Column="3"
ToolTip="Stop Installation"
Margin="0,0,0,5"
Width="50"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}}" >
<icon:PackIconFontAwesome
Width="25"
Height="25"
Kind="TimesCircleSolid" />
</Button>-->
</Grid>
<mahapps:MetroProgressBar
x:Name="BottomProgressBar"
Grid.Row="1"
Grid.RowSpan="2"
Height="5"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="Transparent"
Foreground="{StaticResource PrimaryBrush}"
Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}" />
<mahapps:MetroProgressBar
x:Name="BottomProgressBarHighlight"
Grid.Row="1"
Grid.RowSpan="2"
Height="5"
VerticalAlignment="Top"
Background="Transparent"
BorderBrush="Transparent"
Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}">
<mahapps:MetroProgressBar.Foreground>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="#CCFFFFFF" />
<GradientStop Offset="0.3" Color="#00FFFFFF" />
<GradientStop Offset="0.7" Color="#00FFFFFF" />
<GradientStop Offset="1" Color="#CCFFFFFF" />
</LinearGradientBrush>
</mahapps:MetroProgressBar.Foreground>
</mahapps:MetroProgressBar>
</Grid>
</UserControl>

View File

@ -0,0 +1,28 @@
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 TopProgressView.xaml
/// </summary>
public partial class TopProgressView : UserControl
{
public TopProgressView()
{
InitializeComponent();
}
}
}

View File

@ -163,6 +163,9 @@
</ApplicationDefinition>
<Compile Include="Converters\BoolToVisibilityConverter.cs" />
<Compile Include="Extensions\EnumerableExt.cs" />
<Compile Include="Views\TopProgressView.xaml.cs">
<DependentUpon>TopProgressView.xaml</DependentUpon>
</Compile>
<Compile Include="Settings.cs" />
<Compile Include="View Models\ModListVM.cs" />
<Compile Include="View Models\ModVM.cs" />
@ -185,6 +188,9 @@
</Compile>
<Compile Include="View Models\CompilerVM.cs" />
<Compile Include="View Models\MainWindowVM.cs" />
<Compile Include="Views\LogCpuView.xaml.cs">
<DependentUpon>LogCpuView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ModeSelectionWindow.xaml.cs">
<DependentUpon>ModeSelectionWindow.xaml</DependentUpon>
</Compile>
@ -199,6 +205,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\TopProgressView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\DownloadWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -211,6 +221,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\LogCpuView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>