updating avalonia, WIP patch generator
This commit is contained in:
parent
2339f5d9b9
commit
f57abbb64a
@ -19,11 +19,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.10" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.10" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.11" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.11" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.10" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.10" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.11" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.11" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -3,7 +3,7 @@
|
||||
xmlns:vm="using:PatchClient.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:cc="using:PatchClient.CustomControls"
|
||||
xmlns:cc="using:PatchClient.CustomControls"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="PatchClient.Views.MainWindow"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
@ -32,5 +32,6 @@
|
||||
<DockPanel LastChildFill="True" Grid.Row="1">
|
||||
<ContentControl Content="{Binding navigator.SelectedViewModel}"/>
|
||||
</DockPanel>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@ -9,4 +9,20 @@
|
||||
<Application.Styles>
|
||||
<FluentTheme Mode="Light"/>
|
||||
</Application.Styles>
|
||||
|
||||
<Application.Resources>
|
||||
<!-- Colors -->
|
||||
<Color x:Key="AKI_DarkGray">#121212</Color>
|
||||
<Color x:Key="AKI_Yellow">#FFC107</Color>
|
||||
<Color x:Key="AKI_White">#FFFFFF</Color>
|
||||
<Color x:Key="AKI_Gray">#282828</Color>
|
||||
<Color x:Key="AKI_DarkGrayBlue">#323947</Color>
|
||||
|
||||
<!-- Brushes -->
|
||||
<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_Brush_Yellow" Color="{StaticResource AKI_Yellow}"/>
|
||||
<SolidColorBrush x:Key="AKI_Brush_DarkGrayBlue" Color="{StaticResource AKI_DarkGrayBlue}"/>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
71
Patcher/_port/Patcher/PatchGenerator/Assets/Styles.axaml
Normal file
71
Patcher/_port/Patcher/PatchGenerator/Assets/Styles.axaml
Normal file
@ -0,0 +1,71 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cc="using:PatchGenerator.CustomControls">
|
||||
<Design.PreviewWith>
|
||||
<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">
|
||||
<Setter Property="Foreground" Value="{StaticResource AKI_Foreground_Light}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Label.yellow">
|
||||
<Setter Property="Foreground" Value="{StaticResource AKI_Brush_Yellow}"/>
|
||||
</Style>
|
||||
|
||||
<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>
|
||||
<BrushTransition Property="Foreground" Duration="0:0:1"/>
|
||||
</Transitions>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ProgressBar.done /template/ Border">
|
||||
<Setter Property="CornerRadius" Value="0"/>
|
||||
<Setter Property="Width" Value="5"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Style.Animations>
|
||||
<Animation Duration="0:0:0.2" FillMode="Forward">
|
||||
<KeyFrame Cue="0%">
|
||||
<Setter Property="Width" Value="200"/>
|
||||
</KeyFrame>
|
||||
<KeyFrame Cue="100%">
|
||||
<Setter Property="Width" Value="5"/>
|
||||
</KeyFrame>
|
||||
</Animation>
|
||||
</Style.Animations>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Separator">
|
||||
<Setter Property="Background" Value="{StaticResource AKI_Background_Dark}"/>
|
||||
</Style>
|
||||
</Styles>
|
@ -0,0 +1,44 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="PatchGenerator.CustomControls.TitleBar">
|
||||
|
||||
<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"
|
||||
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>
|
@ -0,0 +1,67 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace PatchGenerator.CustomControls
|
||||
{
|
||||
public partial class TitleBar : UserControl
|
||||
{
|
||||
public TitleBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string> TitleProperty =
|
||||
AvaloniaProperty.Register<TitleBar, string>(nameof(Title));
|
||||
|
||||
public string Title
|
||||
{
|
||||
get => GetValue(TitleProperty);
|
||||
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));
|
||||
|
||||
public new IBrush Foreground
|
||||
{
|
||||
get => GetValue(ForegroundProperty);
|
||||
set => SetValue(ForegroundProperty, value);
|
||||
}
|
||||
|
||||
public static new readonly StyledProperty<IBrush> BackgroundProperty =
|
||||
AvaloniaProperty.Register<TitleBar, IBrush>(nameof(Background));
|
||||
|
||||
public new IBrush Background
|
||||
{
|
||||
get => GetValue(BackgroundProperty);
|
||||
set => SetValue(BackgroundProperty, value);
|
||||
}
|
||||
|
||||
//Close Button Command (X Button) Property
|
||||
public static readonly StyledProperty<ICommand> XButtonCommandProperty =
|
||||
AvaloniaProperty.Register<TitleBar, ICommand>(nameof(XButtonCommand));
|
||||
|
||||
public ICommand XButtonCommand
|
||||
{
|
||||
get => GetValue(XButtonCommandProperty);
|
||||
set => SetValue(XButtonCommandProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
14
Patcher/_port/Patcher/PatchGenerator/Models/ViewNavigator.cs
Normal file
14
Patcher/_port/Patcher/PatchGenerator/Models/ViewNavigator.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using ReactiveUI;
|
||||
|
||||
namespace PatchGenerator.Models
|
||||
{
|
||||
public class ViewNavigator : ReactiveObject
|
||||
{
|
||||
private object _SelectedViewModel;
|
||||
public object SelectedViewModel
|
||||
{
|
||||
get => _SelectedViewModel;
|
||||
set => this.RaiseAndSetIfChanged(ref _SelectedViewModel, value);
|
||||
}
|
||||
}
|
||||
}
|
@ -16,15 +16,23 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
<AvaloniaResource Remove="Assets\Styles.axaml" />
|
||||
<None Remove=".gitignore" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.10" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.10" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.11" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.11" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.10" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.10" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.11" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.11" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="CustomControls\TitleBar.axaml.cs">
|
||||
<DependentUpon>%(Filename)</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,11 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Avalonia;
|
||||
using PatchGenerator.Models;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace PatchGenerator.ViewModels
|
||||
{
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
public string Greeting => "Welcome to Avalonia!";
|
||||
public ICommand CloseCommand => ReactiveCommand.Create(() =>
|
||||
{
|
||||
if (Application.Current.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktopApp)
|
||||
{
|
||||
desktopApp.MainWindow.Close();
|
||||
}
|
||||
});
|
||||
|
||||
public ViewNavigator navigator { get; set; } = new ViewNavigator();
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
navigator.SelectedViewModel = new OptionsViewModel();
|
||||
|
||||
Locator.CurrentMutable.RegisterConstant(navigator, typeof(ViewNavigator));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PatchGenerator.ViewModels
|
||||
{
|
||||
public class OptionsViewModel : ViewModelBase
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PatchGenerator.ViewModels
|
||||
{
|
||||
public class PatchGenerationViewModel : ViewModelBase
|
||||
{
|
||||
}
|
||||
}
|
@ -3,15 +3,35 @@
|
||||
xmlns:vm="using:PatchGenerator.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:cc="using:PatchGenerator.CustomControls"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="PatchGenerator.Views.MainWindow"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="PatchGenerator">
|
||||
Title="PatchGenerator"
|
||||
Height="400" Width="800"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
ExtendClientAreaToDecorationsHint="True"
|
||||
ExtendClientAreaChromeHints="NoChrome"
|
||||
ExtendClientAreaTitleBarHeightHint="-1"
|
||||
Background="{StaticResource AKI_Background_Light}"
|
||||
>
|
||||
<Window.Styles>
|
||||
<StyleInclude Source="/Assets/Styles.axaml"/>
|
||||
</Window.Styles>
|
||||
|
||||
<Design.DataContext>
|
||||
<vm:MainWindowViewModel/>
|
||||
</Design.DataContext>
|
||||
|
||||
<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Grid RowDefinitions="AUTO,*">
|
||||
|
||||
<cc:TitleBar Title="Patch Generator"
|
||||
XButtonCommand="{Binding CloseCommand}"/>
|
||||
|
||||
<DockPanel LastChildFill="True" Grid.Row="1">
|
||||
<ContentControl Content="{Binding navigator.SelectedViewModel}"/>
|
||||
</DockPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
|
10
Patcher/_port/Patcher/PatchGenerator/Views/OptionsView.axaml
Normal file
10
Patcher/_port/Patcher/PatchGenerator/Views/OptionsView.axaml
Normal file
@ -0,0 +1,10 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="PatchGenerator.Views.OptionsView">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
@ -0,0 +1,19 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace PatchGenerator.Views
|
||||
{
|
||||
public partial class OptionsView : UserControl
|
||||
{
|
||||
public OptionsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="PatchGenerator.Views.PatchGenerationView">
|
||||
Welcome to Avalonia!
|
||||
</UserControl>
|
@ -0,0 +1,19 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace PatchGenerator.Views
|
||||
{
|
||||
public partial class PatchGenerationView : UserControl
|
||||
{
|
||||
public PatchGenerationView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user