finish patch client styling, remove test method

This commit is contained in:
IsWaffle 2021-12-21 10:21:55 -05:00
parent 3cb2b9cfae
commit c76e8329fc
9 changed files with 91 additions and 86 deletions

View File

@ -22,7 +22,7 @@
<SolidColorBrush x:Key="AKI_Foreground_Light" Color="{StaticResource AKI_White}"/>
<SolidColorBrush x:Key="AKI_Background_Light" Color="{StaticResource AKI_Gray}"/>
<SolidColorBrush x:Key="AKI_Background_Dark" Color="{StaticResource AKI_DarkGray}"/>
<SolidColorBrush x:Key="AKI_Background_Yellow" Color="{StaticResource AKI_Yellow}"/>
<SolidColorBrush x:Key="AKI_Background_DarkGrayBlue" Color="{StaticResource AKI_DarkGrayBlue}"/>
<SolidColorBrush x:Key="AKI_Brush_Yellow" Color="{StaticResource AKI_Yellow}"/>
<SolidColorBrush x:Key="AKI_Brush_DarkGrayBlue" Color="{StaticResource AKI_DarkGrayBlue}"/>
</Application.Resources>
</Application>

View File

@ -2,23 +2,45 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="using:PatchClient.CustomControls">
<Design.PreviewWith>
<Border Padding="20">
<Border Padding="20" Background="{StaticResource AKI_Background_Light}">
<!-- Add Controls for Previewer Here -->
<StackPanel Background="{StaticResource AKI_Background_Light}" Spacing="15" Margin="10">
<cc:TitleBar Title="Title Bar Text"/>
<Label Content="Normal label"/>
<Label Content="Yellow label" Classes="yellow"/>
<Label Content="Blue label" Classes="dark"/>
<ProgressBar Value="40"/>
<Separator Height="1"/>
<ProgressBar Value="60" Classes="done"/>
</StackPanel>
</Border>
</Design.PreviewWith>
<!-- Add Styles Here -->
<Style Selector="cc|TitleBar">
<Setter Property="Background" Value="{StaticResource AKI_Background_Dark}"/>
<Setter Property="Foreground" Value="{StaticResource AKI_Foreground_Light}"/>
<Setter Property="XButtonForeground" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
</Style>
<Style Selector="Label.blue">
<Setter Property="Foreground" Value="DodgerBlue"/>
<Style Selector="Label">
<Setter Property="Foreground" Value="{StaticResource AKI_Foreground_Light}"/>
</Style>
<Style Selector="Label.yellow">
<Setter Property="Foreground" Value="{StaticResource AKI_Brush_Yellow}"/>
</Style>
<Style Selector="ProgressBar.Done">
<Style Selector="Label.dark">
<Setter Property="Foreground" Value="DimGray"/>
</Style>
<Style Selector="ProgressBar">
<Setter Property="Foreground" Value="{StaticResource AKI_Brush_Yellow}"/>
</Style>
<Style Selector="ProgressBar.done">
<Setter Property="Foreground" Value="Green"/>
<Setter Property="Transitions">
<Transitions>
@ -27,7 +49,7 @@
</Setter>
</Style>
<Style Selector="ProgressBar.Done /template/ Border">
<Style Selector="ProgressBar.done /template/ Border">
<Setter Property="CornerRadius" Value="0"/>
<Setter Property="Width" Value="5"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
@ -42,4 +64,8 @@
</Animation>
</Style.Animations>
</Style>
<Style Selector="Separator">
<Setter Property="Background" Value="{StaticResource AKI_Background_Dark}"/>
</Style>
</Styles>

View File

@ -5,41 +5,40 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="PatchClient.CustomControls.TitleBar">
<Grid ColumnDefinitions="AUTO,*,AUTO">
<Rectangle Grid.ColumnSpan="3" IsHitTestVisible="False"
Fill="{Binding Background, RelativeSource={
RelativeSource AncestorType=UserControl}}"
<Grid ColumnDefinitions="AUTO,*,AUTO">
<Rectangle Grid.ColumnSpan="3" IsHitTestVisible="False"
Fill="{Binding Background, RelativeSource={
RelativeSource AncestorType=UserControl}}"
/>
<Label Content="{Binding Title, RelativeSource={
RelativeSource
AncestorType=UserControl}}"
IsHitTestVisible="False"
Foreground="{Binding Foreground, RelativeSource={
RelativeSource
AncestorType=UserControl}}"
Background="Transparent"
VerticalContentAlignment="Center"
/>
<Button Content="X" Grid.Column="2"
Command="{Binding XButtonCommand, RelativeSource={
RelativeSource
AncestorType=UserControl}}"
Background="Transparent"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
VerticalAlignment="Stretch"
CornerRadius="0"
Width="35"
>
<Button.Styles>
<Style Selector="Button:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="IndianRed"/>
</Style>
<Style Selector="Button:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="Crimson"/>
</Style>
</Button.Styles>
</Button>
</Grid>
<Label Content="{Binding Title, RelativeSource={
RelativeSource AncestorType=UserControl}}"
IsHitTestVisible="False"
Foreground="{Binding Foreground, RelativeSource={
RelativeSource AncestorType=UserControl}}"
Background="Transparent"
VerticalContentAlignment="Center"
/>
<Button Content="X" Grid.Column="2"
Foreground="{Binding XButtonForeground, RelativeSource={
RelativeSource AncestorType=UserControl}}"
Command="{Binding XButtonCommand, RelativeSource={
RelativeSource AncestorType=UserControl}}"
Background="Transparent"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
VerticalAlignment="Stretch"
CornerRadius="0"
Width="35"
>
<Button.Styles>
<Style Selector="Button:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="IndianRed"/>
</Style>
<Style Selector="Button:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="Crimson"/>
</Style>
</Button.Styles>
</Button>
</Grid>
</UserControl>

View File

@ -27,6 +27,15 @@ namespace PatchClient.CustomControls
set => SetValue(TitleProperty, value);
}
public static readonly StyledProperty<IBrush> XButtonForegroundProperty =
AvaloniaProperty.Register<TitleBar, IBrush>(nameof(XButtonForeground));
public IBrush XButtonForeground
{
get => GetValue(XButtonForegroundProperty);
set => SetValue(XButtonForegroundProperty, value);
}
public static new readonly StyledProperty<IBrush> ForegroundProperty =
AvaloniaProperty.Register<TitleBar, IBrush>(nameof(Foreground));

View File

@ -1,9 +1,7 @@
{
"profiles": {
"PatchClient": {
"commandName": "Executable",
"executablePath": "Z:\\SPTarkov\\Patcher\\Patcher\\_port\\Patcher\\PatchClient\\bin\\Debug\\net5.0\\PatchClient.exe",
"workingDirectory": "C:\\Users\\JohnO\\Desktop\\12.12.2.16165"
"commandName": "Project"
}
}
}

View File

@ -44,35 +44,6 @@ namespace PatchClient.ViewModels
RunPatcher();
}
[Obsolete]
private void Test()
{
Task.Run(() =>
{
LineItem x = new LineItem("test 1", 30);
LineItem xx = new LineItem("test 2", 100);
LineItem xxx = new LineItem("test 3", 70);
LineItems.Add(new LineItemProgress(x));
LineItems.Add(new LineItemProgress(xx));
LineItems.Add(new LineItemProgress(xxx));
for (int i = 0; i <= 100; i++)
{
System.Threading.Thread.Sleep(20);
PatchPercent = i;
ProgressMessage = $"Patching @ {i}%";
foreach(var item in LineItems)
{
item.UpdateProgress(item.Total - i);
}
}
navigator.SelectedViewModel = new MessageViewModel("Test Run Complete").WithDelay(400);
});
}
private void RunPatcher()
{
Task.Run(() =>

View File

@ -8,11 +8,12 @@
x:Class="PatchClient.Views.MainWindow"
Icon="/Assets/avalonia-logo.ico"
Title="Patch Client"
Height="300" Width="600"
Height="240" Width="600"
WindowStartupLocation="CenterScreen"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="-1"
Background="{StaticResource AKI_Background_Light}"
>
<Window.Styles>
<StyleInclude Source="/Assets/Styles.axaml"/>

View File

@ -13,7 +13,7 @@
<Label Content="You can close this window"
FontSize="12" FontWeight="SemiBold"/>
<Label Content="{Binding InfoText}"
Classes="blue"
Classes="yellow"
/>
</StackPanel>

View File

@ -21,12 +21,11 @@
<!-- Current Patch Text -->
<Label Content="{Binding ProgressMessage}"/>
<Label Content="{Binding PatchMessage}" Grid.Row="1"
Classes="blue"/>
Classes="dark"/>
<ProgressBar Grid.Row="2" Value="{Binding PatchPercent}"/>
<Separator Grid.Row="3"
VerticalAlignment="Bottom"
Background="Gainsboro"
Height="1"
Margin="0 20"/>
@ -34,15 +33,17 @@
<ItemsControl Items="{Binding LineItems}" Grid.Row="4">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type model:LineItemProgress}">
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Info}"/>
<Label Content="{Binding ProgressInfo}"/>
<ProgressBar Value="{Binding Progress}"
<Grid ColumnDefinitions="AUTO,3*,AUTO,*,AUTO">
<Label Content="{Binding Info}"
/>
<Label Content="{Binding ProgressInfo}" Grid.Column="2"
FontSize="12"/>
<ProgressBar Value="{Binding Progress}" Grid.Column="4"
Margin="0 0 0 4"
VerticalAlignment="Center"
Width="200" MaxWidth="200"
Classes.Done="{Binding Completed}"/>
</StackPanel>
Classes.done="{Binding Completed}"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>