0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-12 16:50:43 -05:00

Merge pull request 'next' (!62) from waffle.lord/Launcher:next into master

Reviewed-on: SPT/Launcher#62
This commit is contained in:
IsWaffle 2024-07-08 22:44:26 +00:00
commit 8ca094cc56
36 changed files with 1016 additions and 602 deletions

View File

@ -141,7 +141,6 @@ namespace SPT.Launcher
try try
{ {
Process.Start(clientProcess); Process.Start(clientProcess);
LogManager.Instance.Info("[LaunchGame] Game process started"); LogManager.Instance.Info("[LaunchGame] Game process started");
} }

View File

@ -13,7 +13,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" /> <PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,32 +1,49 @@
<Application xmlns="https://github.com/avaloniaui" <Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SPT.Launcher" xmlns:local="using:SPT.Launcher"
x:Class="SPT.Launcher.App"> x:Class="SPT.Launcher.App"
RequestedThemeVariant="Dark"
>
<Application.DataTemplates> <Application.DataTemplates>
<local:ViewLocator/> <local:ViewLocator/>
</Application.DataTemplates> </Application.DataTemplates>
<Application.Styles> <Application.Styles>
<StyleInclude Source="avares://DialogHost.Avalonia/Styles.xaml"/> <StyleInclude Source="avares://DialogHost.Avalonia/Styles.xaml"/>
<FluentTheme Mode="Light"/> <FluentTheme />
</Application.Styles> </Application.Styles>
<Application.Resources> <Application.Resources>
<!-- Colors --> <ResourceDictionary>
<Color x:Key="SPT_DarkGray">#121212</Color> <ResourceDictionary.ThemeDictionaries>
<Color x:Key="SPT_Yellow">#FFC107</Color> <!-- let's be real... we are never going to use a light theme lol -waffle.lazy -->
<Color x:Key="SPT_White">#FFFFFF</Color> <ResourceDictionary x:Key="Light">
<Color x:Key="SPT_Gray">#282828</Color> <SolidColorBrush x:Key="AccentBrush">#436082</SolidColorBrush>
<Color x:Key="SPT_DarkGrayBlue">#323947</Color> <SolidColorBrush x:Key="AccentBrush2">#567ca8</SolidColorBrush>
<SolidColorBrush x:Key="AccentBrush3">#6998ce</SolidColorBrush>
<!-- Brushes --> <SolidColorBrush x:Key="AltAccentBrush">#6a6357</SolidColorBrush>
<SolidColorBrush x:Key="SPT_Foreground_Light" Color="{StaticResource SPT_White}"/> <SolidColorBrush x:Key="AltAccentBrush2">#908676</SolidColorBrush>
<SolidColorBrush x:Key="SPT_Background_Light" Color="{StaticResource SPT_Gray}"/> <SolidColorBrush x:Key="AltAccentBrush3">#b6a995</SolidColorBrush>
<SolidColorBrush x:Key="SPT_Background_Dark" Color="{StaticResource SPT_DarkGray}"/> <SolidColorBrush x:Key="BackgroundBrush">White</SolidColorBrush>
<SolidColorBrush x:Key="SPT_Brush_Yellow" Color="{StaticResource SPT_Yellow}"/> <SolidColorBrush x:Key="BackgroundBrush2">#cccccc</SolidColorBrush>
<SolidColorBrush x:Key="SPT_Brush_DarkGrayBlue" Color="{StaticResource SPT_DarkGrayBlue}"/> <SolidColorBrush x:Key="AltBackgroundBrush">#cca480</SolidColorBrush>
<SolidColorBrush x:Key="SPT_Brush_Lighter" Color="Gainsboro"/> <SolidColorBrush x:Key="ForegroundBrush">Black</SolidColorBrush>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="AccentBrush">#54a4ff</SolidColorBrush>
<SolidColorBrush x:Key="AccentBrush2">#4383cc</SolidColorBrush>
<SolidColorBrush x:Key="AccentBrush3">#326299</SolidColorBrush>
<SolidColorBrush x:Key="AltAccentBrush">#b2a58d</SolidColorBrush>
<SolidColorBrush x:Key="AltAccentBrush2">#7f7564</SolidColorBrush>
<SolidColorBrush x:Key="AltAccentBrush3">#4c463b</SolidColorBrush>
<SolidColorBrush x:Key="BackgroundBrush">#181a1b</SolidColorBrush>
<SolidColorBrush x:Key="BackgroundBrush2">#393e41</SolidColorBrush>
<SolidColorBrush x:Key="AltBackgroundBrush">#37332d</SolidColorBrush>
<SolidColorBrush x:Key="ForegroundBrush">White</SolidColorBrush>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
<!-- Path Geometry for re-usable icons --> <!-- Path Geometry for re-usable icons -->
<PathGeometry x:Key="FolderWithPlus" Figures="M20 6h-8l-2-2H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-1 8h-3v3h-2v-3h-3v-2h3V9h2v3h3v2z" FillRule="NonZero" <PathGeometry x:Key="FolderWithPlus" Figures="M20 6h-8l-2-2H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-1 8h-3v3h-2v-3h-3v-2h3V9h2v3h3v2z" FillRule="NonZero"
/> />

View File

@ -1,24 +1,64 @@
<Styles xmlns="https://github.com/avaloniaui" <Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="using:SPT.Launcher.CustomControls" xmlns:cc="using:SPT.Launcher.CustomControls"
xmlns:rxui="using:Avalonia.ReactiveUI"
> >
<Design.PreviewWith> <Design.PreviewWith>
<StackPanel Spacing="5" Background="{StaticResource SPT_Background_Dark}" Margin="50"> <Border Classes="card">
<Button Content="Blah"/> <StackPanel Spacing="5" Margin="50">
<TextBox Text="Some cool text here" Margin="5"/> <Label Content="Some label here"/>
<TextBox Watermark="This is a watermark" Margin="5"/> <Label Content="Some acc label here" Classes="acc"/>
<CheckBox Content="This is a checkbox"/> <Label Content="Some alt label here" Classes="alt"/>
<Label Classes="versionMismatch" Content="invalid version tag" />
<Button Content="button" />
<Button Content="outlined button" Classes="outlined"></Button>
<Button Content="Icon button" Classes="icon"/>
<Button Content="acc button" Classes="acc"/>
<Button Content="alt button" Classes="alt"/>
<Button IsEnabled="False" Content="disabled button"/>
<Button Content="link button" Classes="link"/>
<Button Content="underline link button" Classes="ulink"/>
<ComboBox SelectedIndex="0">
<ComboBoxItem>Item 1</ComboBoxItem>
<ComboBoxItem>Item 2</ComboBoxItem>
<ComboBoxItem>Item 3</ComboBoxItem>
</ComboBox>
<TextBox Text="Some cool text here" Margin="5" />
<TextBox Watermark="This is a watermark" Margin="5" />
<CheckBox Content="unchecked" />
<CheckBox Content="checked" IsChecked="True"/>
<ProgressBar Value="40" />
<ProgressBar IsIndeterminate="True" />
<ProgressBar Classes="error" />
</StackPanel> </StackPanel>
</Border>
</Design.PreviewWith> </Design.PreviewWith>
<!-- Add Styles Here --> <!-- Add Styles Here -->
<!-- Textblock Styles -->
<Style Selector="TextBlock.alt">
<Setter Property="Foreground" Value="{DynamicResource AltAccentBrush}"/>
</Style>
<!-- Border Styles -->
<Style Selector="Border.card">
<Setter Property="CornerRadius" Value="5"/>
<Setter Property="BoxShadow" Value="2 5 5 black"/>
<Setter Property="BorderBrush" Value="{DynamicResource AltBackgroundBrush}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="10"></Setter>
</Style>
<!-- BoxShadow="2 5 5 black"></Setter> CornerRadius="5" -->
<!-- BorderBrush="{DynamicResource AltBackgroundBrush}" -->
<!-- Background="{DynamicResource BackgroundBrush}" -->
<!-- Margin="15" -->
<!-- BorderThickness="1" -->
<!-- Notification Manager Styles --> <!-- Notification Manager Styles -->
<Style Selector="WindowNotificationManager"> <Style Selector="WindowNotificationManager">
<Setter Property="Margin" Value="0 35 0 0"/> <Setter Property="Margin" Value="0 35 0 0"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="MaxItems" Value="2"/> <Setter Property="MaxItems" Value="2"/>
</Style> </Style>
@ -40,296 +80,266 @@
</LayoutTransformControl> </LayoutTransformControl>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style.Animations>
<Animation Duration="0:0:0.45" Easing="SineEaseIn" FillMode="Forward">
<KeyFrame Cue="0%">
<Setter Property="Opacity" Value="0"/>
<Setter Property="ZIndex" Value="0"/>
<Setter Property="TranslateTransform.Y" Value="-100"/>
<Setter Property="ScaleTransform.ScaleX" Value="1"/>
<Setter Property="ScaleTransform.ScaleY" Value="1"/>
</KeyFrame>
<KeyFrame Cue="30%">
<Setter Property="Opacity" Value="0"/>
</KeyFrame>
<KeyFrame Cue="99%">
<Setter Property="ZIndex" Value="0"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Opacity" Value="1"/>
<Setter Property="ZIndex" Value="1"/>
<Setter Property="TranslateTransform.Y" Value="0"/>
<Setter Property="ScaleTransform.ScaleX" Value="1"/>
<Setter Property="ScaleTransform.ScaleY" Value="1"/>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
<Style Selector="NotificationCard[IsClosing=true] /template/ LayoutTransformControl#PART_LayoutTransformControl">
<Style.Animations>
<Animation Duration="0:0:0.3" Easing="SineEaseOut" FillMode="Backward">
<KeyFrame Cue="0%">
<Setter Property="Opacity" Value="1"/>
<Setter Property="TranslateTransform.X" Value="0"/>
<Setter Property="TranslateTransform.Y" Value="0"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Opacity" Value="0"/>
<Setter Property="TranslateTransform.X" Value="0"/>
<Setter Property="TranslateTransform.Y" Value="-100"/>
</KeyFrame>
</Animation>
</Style.Animations>
</Style> </Style>
<!-- TitleBar Styles --> <!-- TitleBar Styles -->
<Style Selector="cc|TitleBar"> <Style Selector="cc|TitleBar">
<Setter Property="Background" Value="{StaticResource SPT_Background_Dark}"/> <Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="ButtonForeground" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Setter Property="ButtonForeground" Value="{DynamicResource AltAccentBrush}"/>
</Style> </Style>
<Style Selector="cc|TitleBar.versiontag"> <Style Selector="cc|TitleBar.versiontag">
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness" Value="0 0 0 2"/> <Setter Property="BorderThickness" Value="0 0 0 2"/>
</Style> </Style>
<!-- TextBox Styles --> <!-- TextBox Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/TextBox.xaml -->
<Style Selector="TextBox"> <Style Selector="TextBox">
<Setter Property="Background" Value="{StaticResource SPT_Background_Light}"/> <Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="FontWeight" Value="SemiBold"/> <Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Lighter}"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style> </Style>
<Style Selector="TextBox:focus"> <Style Selector="TextBox:focus">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Lighter}"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style> </Style>
<Style Selector="TextBox:pointerover"> <Style Selector="TextBox:pointerover">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Lighter}"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style> </Style>
<Style Selector="TextBox:pointerover /template/ Border#PART_BorderElement"> <Style Selector="TextBox:pointerover /template/ Border#PART_BorderElement">
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="DimGray"/> <Setter Property="BorderBrush" Value="{DynamicResource AltAccentBrush}"/>
</Style> </Style>
<Style Selector="TextBox:pointerover /template/ TextBlock#PART_Watermark, TextBox:focus /template/ TextBlock#PART_FloatingWatermark"> <Style Selector="TextBox:pointerover /template/ TextBlock#PART_Watermark, TextBox:focus /template/ TextBlock#PART_FloatingWatermark">
<Setter Property="Foreground" Value="DimGray"/> <Setter Property="Foreground" Value="{DynamicResource AltAccentBrush2}"/>
</Style> </Style>
<Style Selector="TextBox:focus /template/ TextBlock#PART_Watermark, TextBox:focus /template/ TextBlock#PART_FloatingWatermark"> <Style Selector="TextBox:focus /template/ TextBlock#PART_Watermark, TextBox:focus /template/ TextBlock#PART_FloatingWatermark">
<Setter Property="Foreground" Value="DimGray"/> <Setter Property="Foreground" Value="{DynamicResource AltAccentBrush3}"/>
</Style> </Style>
<Style Selector="TextBox /template/ TextBlock#PART_Watermark, TextBox:focus /template/ TextBlock#PART_FloatingWatermark"> <Style Selector="TextBox /template/ TextBlock#PART_Watermark, TextBox:focus /template/ TextBlock#PART_FloatingWatermark">
<Setter Property="Foreground" Value="White"/> <Setter Property="Foreground" Value="White"/>
</Style> </Style>
<Style Selector="TextBox:focus /template/ Border#PART_BorderElement"> <Style Selector="TextBox:focus /template/ Border#PART_BorderElement">
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1"/>
</Style> </Style>
<!-- Label Styles --> <!-- Label Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Label.xaml -->
<Style Selector="Label"> <Style Selector="Label">
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style> </Style>
<Style Selector="Label.yellow"> <Style Selector="Label.acc">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
</Style> </Style>
<Style Selector="Label.dark"> <Style Selector="Label.alt">
<Setter Property="Foreground" Value="DimGray"/> <Setter Property="Foreground" Value="{DynamicResource AltAccentBrush}"/>
</Style> </Style>
<Style Selector="Label.versionMismatch"> <Style Selector="Label.versionMismatch">
<Setter Property="Foreground" Value="OrangeRed"/> <Setter Property="Foreground" Value="OrangeRed"/>
</Style> </Style>
<!-- ProgressBar Styles --> <!-- ProgressBar Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/ProgressBar.xaml -->
<Style Selector="ProgressBar"> <Style Selector="ProgressBar">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
<Setter Property="Background" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
</Style> </Style>
<Style Selector="ProgressBar.error"> <Style Selector="ProgressBar.error">
<Setter Property="Foreground" Value="Red"/> <Setter Property="Foreground" Value="Red"/>
<Style.Animations> <Style.Animations>
<Animation Duration="0:0:0.5" FillMode="Forward"> <Animation Duration="0:0:0.5" FillMode="Forward">
<KeyFrame Cue="0%"> <KeyFrame Cue="0%">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Yellow}"/>
<Setter Property="Value" Value="0"/> <Setter Property="Value" Value="0"/>
</KeyFrame> </KeyFrame>
<KeyFrame Cue="100%"> <KeyFrame Cue="100%">
<Setter Property="Foreground" Value="Red"/>
<Setter Property="Value" Value="100"/> <Setter Property="Value" Value="100"/>
</KeyFrame> </KeyFrame>
</Animation> </Animation>
</Style.Animations> </Style.Animations>
</Style> </Style>
<!-- Seperator Styles --> <!-- Seperator Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Separator.xaml -->
<Style Selector="Separator"> <Style Selector="Separator">
<Setter Property="Background" Value="{StaticResource SPT_Background_Dark}"/> <Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
</Style> </Style>
<!-- Button Styles --> <!-- Button Styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/Button.xaml -->
<Style Selector="Button"> <Style Selector="Button">
<Setter Property="Background" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="Foreground" Value="{StaticResource SPT_Background_Dark}"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style> </Style>
<Style Selector="Button:pointerover">
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
<Style Selector="Button:pointerover /template/ ContentPresenter"> <Style Selector="Button:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Background_Light}"/> <Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush2}"/>
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1"/>
</Style> </Style>
<Style Selector="Button:pressed /template/ ContentPresenter"> <Style Selector="Button:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
</Style> </Style>
<Style Selector="Button:disabled /template/ ContentPresenter"> <Style Selector="Button:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style> </Style>
<!-- Button yellow --> <!-- Button acc -->
<Style Selector="Button.yellow"> <Style Selector="Button.acc">
<Setter Property="Background" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
<Setter Property="Foreground" Value="{StaticResource SPT_Background_Dark}"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style> </Style>
<Style Selector="Button.yellow:pointerover"> <Style Selector="Button.acc:pointerover /template/ ContentPresenter">
<Setter Property="FontWeight" Value="SemiBold"/> <Setter Property="Background" Value="{DynamicResource AccentBrush2}"/>
</Style> <Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
<Style Selector="Button.yellow:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="Gold"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1"/>
</Style> </Style>
<Style Selector="Button.yellow:pressed /template/ ContentPresenter"> <Style Selector="Button.acc:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Brush_Lighter}"/> <Setter Property="Background" Value="{DynamicResource AccentBrush3}"/>
</Style> </Style>
<Style Selector="Button.yellow:disabled /template/ ContentPresenter"> <Style Selector="Button.acc:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style> </Style>
<!-- Button Link Style --> <!-- Button alt -->
<Style Selector="Button.link"> <Style Selector="Button.alt">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Lighter}"/> <Setter Property="Background" Value="{DynamicResource AltAccentBrush}"/>
<Setter Property="Background" Value="Transparent"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style> </Style>
<Style Selector="Button.link:pointerover /template/ ContentPresenter"> <Style Selector="Button.alt:pointerover /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="Background" Value="{DynamicResource AltAccentBrush2}"/>
<Setter Property="Background" Value="Transparent"/> <Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<Style Selector="Button.link:pressed /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<!-- Button Bordered Link Style -->
<Style Selector="Button.borderedlink">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Lighter}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Lighter}"/>
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1"/>
</Style> </Style>
<Style Selector="Button.borderedlink:pointerover /template/ ContentPresenter"> <Style Selector="Button.alt:pressed /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="Background" Value="{DynamicResource AltAccentBrush3}"/>
</Style>
<Style Selector="Button.alt:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style> </Style>
<Style Selector="Button.borderedlink:pressed /template/ ContentPresenter"> <!-- Button Link Styles -->
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Style Selector="Button.ulink">
<Setter Property="TextBlock.TextDecorations" Value="Underline"/>
</Style>
<Style Selector="Button.link, Button.ulink">
<Setter Property="Foreground" Value="{DynamicResource AltAccentBrush}"/>
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderThickness" Value="0"/>
</Style> </Style>
<!-- Button Profile Info Style --> <Style Selector="Button.link:pointerover /template/ ContentPresenter, Button.ulink:pointerover /template/ ContentPresenter">
<Style Selector="Button.profileinfo"> <Setter Property="TextBlock.Foreground" Value="{DynamicResource AccentBrush}"/>
<Setter Property="Background" Value="{StaticResource SPT_Background_Dark}"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Background_Dark}"/> <Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style> </Style>
<Style Selector="Button.link:pressed /template/ ContentPresenter, Button.ulink:pressed /template/ ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{DynamicResource AccentBrush3}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
<!-- Outlined Button -->
<Style Selector="Button.outlined">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style Selector="Button.outlined:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AltBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush2}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style Selector="Button.outlined:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AccentBrush3}"/>
</Style>
<Style Selector="Button.outlined:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style>
<!-- Icon button -->
<Style Selector="Button.icon"> <Style Selector="Button.icon">
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
</Style> </Style>
<Style Selector="Button.icon:pointerover"> <Style Selector="Button.icon:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Setter Property="Background" Value="{DynamicResource AltBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush2}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style Selector="Button.icon:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AccentBrush3}"/>
</Style>
<Style Selector="Button.icon:disabled /template/ ContentPresenter">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style> </Style>
<!-- Checkbox styles --> <!-- Checkbox styles -->
<!-- SourceRef: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/CheckBox.xaml -->
<Style Selector="CheckBox"> <Style Selector="CheckBox">
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
</Style> </Style>
<Style Selector="CheckBox /template/ Border#NormalRectangle"> <Style Selector="CheckBox /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}"/>
</Style> </Style>
<Style Selector="CheckBox:pointerover /template/ Border#NormalRectangle"> <Style Selector="CheckBox:pointerover /template/ Border#NormalRectangle">
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
</Style>
<Style Selector="CheckBox:pointerover /template/ ContentPresenter#ContentPresenter">
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Foreground_Light}" />
</Style> </Style>
<Style Selector="CheckBox:checked"> <Style Selector="CheckBox:checked">
<Setter Property="FontWeight" Value="SemiBold"/> <Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/> <Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
</Style> </Style>
<Style Selector="CheckBox:checked /template/ Border#NormalRectangle"> <Style Selector="CheckBox:checked /template/ Border#NormalRectangle">
<Setter Property="Background" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
</Style> </Style>
<Style Selector="CheckBox:checked /template/ Path#CheckGlyph"> <Style Selector="CheckBox:checked /template/ Path#CheckGlyph">
<Setter Property="Fill" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="Fill" Value="{DynamicResource AccentBrush}"/>
</Style> </Style>
<!-- ComboBox Styles --> <!-- ComboBox Styles -->
<!-- Source Ref: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/ComboBox.xaml -->
<Style Selector="ComboBox"> <Style Selector="ComboBox">
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="PlaceholderForeground" Value="{StaticResource SPT_Brush_Lighter}"/> <Setter Property="PlaceholderForeground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="Background" Value="{StaticResource SPT_Background_Dark}"/> <Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<DataValidationErrors> <DataValidationErrors>
@ -357,8 +367,8 @@
Grid.Row="1" Grid.Row="1"
Grid.Column="0" Grid.Column="0"
Grid.ColumnSpan="2" Grid.ColumnSpan="2"
Background="{DynamicResource ComboBoxBackgroundUnfocused}" Background="{TemplateBinding Background}"
BorderBrush="{DynamicResource ComboBoxBackgroundBorderBrushUnfocused}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" /> CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock x:Name="PlaceholderTextBlock" <TextBlock x:Name="PlaceholderTextBlock"
@ -402,7 +412,9 @@
<Panel Height="12" <Panel Height="12"
Width="12" /> Width="12" />
<Path x:Name="DropDownGlyph" <Path x:Name="DropDownGlyph"
VerticalAlignment="Center" /> VerticalAlignment="Center"
Data="M1939 486L2029 576L1024 1581L19 576L109 486L1024 1401L1939 486Z"
/>
</Panel> </Panel>
</Viewbox> </Viewbox>
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
@ -413,8 +425,8 @@
PlacementTarget="Background" PlacementTarget="Background"
IsLightDismissEnabled="True"> IsLightDismissEnabled="True">
<Border x:Name="PopupBorder" <Border x:Name="PopupBorder"
Background="{StaticResource SPT_Background_Dark}" Background="{DynamicResource BackgroundBrush2}"
BorderBrush="{StaticResource SPT_Background_Dark}" BorderBrush="{DynamicResource BackgroundBrush2}"
BorderThickness="{DynamicResource ComboBoxDropdownBorderThickness}" BorderThickness="{DynamicResource ComboBoxDropdownBorderThickness}"
Margin="0,-1,0,-1" Margin="0,-1,0,-1"
Padding="{DynamicResource ComboBoxDropdownBorderPadding}" Padding="{DynamicResource ComboBoxDropdownBorderPadding}"
@ -423,11 +435,9 @@
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" <ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"> VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter Name="PART_ItemsPresenter" <ItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
Margin="{DynamicResource ComboBoxDropdownContentMargin}" Margin="{DynamicResource ComboBoxDropdownContentMargin}"
ItemsPanel="{TemplateBinding ItemsPanel}" ItemsPanel="{TemplateBinding ItemsPanel}"
ItemTemplate="{TemplateBinding ItemTemplate}" />
VirtualizationMode="{TemplateBinding VirtualizationMode}" />
</ScrollViewer> </ScrollViewer>
</Border> </Border>
</Popup> </Popup>
@ -436,49 +446,43 @@
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </Style>
<Style Selector="ComboBox">
<Setter Property="Background" Value="{DynamicResource AltBackgroundBrush}"/>
</Style>
<Style Selector="ComboBox:dropdownopen">
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/>
</Style>
<Style Selector="ComboBox /template/ Path#DropDownGlyph"> <Style Selector="ComboBox /template/ Path#DropDownGlyph">
<Setter Property="Fill" Value="{StaticResource SPT_Foreground_Light}" /> <Setter Property="Fill" Value="{DynamicResource ForegroundBrush}" />
</Style> </Style>
<Style Selector="ComboBox:pointerover /template/ Path#DropDownGlyph"> <Style Selector="ComboBox:pointerover /template/ Path#DropDownGlyph">
<Setter Property="Fill" Value="{StaticResource SPT_Brush_Yellow}" /> <Setter Property="Fill" Value="{DynamicResource AccentBrush}" />
</Style> </Style>
<Style Selector="ComboBox:pointerover"> <Style Selector="ComboBox:pointerover">
<Setter Property="Foreground" Value="{StaticResource SPT_Brush_Yellow}"/> <Setter Property="Foreground" Value="{DynamicResource AccentBrush}"/>
</Style>
<Style Selector="ComboBox:pointerover /template/ Border#Background">
<Setter Property="Background" Value="Black"/>
<Setter Property="BorderBrush" Value="Black" />
</Style>
<Style Selector="ComboBox /template/ Border#PopupBorder">
<Setter Property="Background" Value="Black"/>
<Setter Property="BorderBrush" Value="Black"/>
</Style> </Style>
<!-- ComboBoxItem Styles --> <!-- ComboBoxItem Styles -->
<!-- Source Ref: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Themes.Fluent/Controls/ComboBoxItem.xaml-->
<Style Selector="ComboBoxItem /template/ ContentPresenter">
<Setter Property="Background" Value="Black"/>
</Style>
<Style Selector="ComboBoxItem"> <Style Selector="ComboBoxItem">
<Setter Property="Foreground" Value="{StaticResource SPT_Foreground_Light}"/> <Setter Property="Foreground" Value="{DynamicResource ForegroundBrush}"/>
<Setter Property="Background" Value="{StaticResource SPT_Background_Dark}"/> <Setter Property="Background" Value="{DynamicResource BackgroundBrush2}"/>
</Style> </Style>
<Style Selector="ComboBoxItem:pointerover /template/ ContentPresenter"> <Style Selector="ComboBoxItem:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Background_Light}" /> <Setter Property="Background" Value="{DynamicResource AltAccentBrush2}" />
<Setter Property="BorderBrush" Value="{StaticResource SPT_Background_Light}" /> <Setter Property="BorderBrush" Value="{DynamicResource BackgroundBrush2}" />
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Foreground_Light}" /> <Setter Property="TextBlock.Foreground" Value="{DynamicResource ForegroundBrush}" />
</Style> </Style>
<Style Selector="ComboBoxItem:selected /template/ ContentPresenter"> <Style Selector="ComboBoxItem:selected /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Brush_Yellow}" /> <Setter Property="Background" Value="{DynamicResource AccentBrush}" />
<Setter Property="BorderBrush" Value="{StaticResource SPT_Brush_Yellow}" /> <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
<Setter Property="TextBlock.Foreground" Value="{StaticResource SPT_Background_Dark}" /> <Setter Property="TextBlock.Foreground" Value="{DynamicResource ForegroundBrush}" />
</Style> </Style>
</Styles> </Styles>

View File

@ -0,0 +1,113 @@
<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"
xmlns:helpers="using:SPT.Launcher.Helpers"
xmlns:cvt="using:SPT.Launcher.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.CustomControls.DetailedProfileCard"
MinWidth="250" MinHeight="250"
PointerEntered="InputElement_OnPointerEntered"
PointerExited="InputElement_OnPointerExited"
PointerPressed="InputElement_OnPointerPressed"
PointerReleased="InputElement_OnPointerReleased"
>
<UserControl.Resources>
<cvt:ImageSourceConverter x:Key="ImageSourceCvt" />
</UserControl.Resources>
<Border x:Name="CardBorder" Classes="card" Margin="15">
<Border.Transitions>
<Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.200"/>
<BrushTransition Duration="0:0:0.200" Property="Background" />
<BoxShadowsTransition Property="BoxShadow" Duration="0:0:0.200" />
<DoubleTransition Property="Opacity" Duration="0:0:0.200" />
</Transitions>
</Border.Transitions>
<Grid RowDefinitions="Auto, Auto, *, Auto, Auto" ColumnDefinitions="Auto, *, Auto" Margin="10">
<!-- SPT version -->
<Label x:Name="SptVersion" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"
Background="Transparent" HorizontalAlignment="Center"
ToolTip.Tip="{Binding $parent[UserControl].ProfileInfo.MismatchMessage}"
Classes.versionMismatch="{Binding $parent[UserControl].ProfileInfo.VersionMismatch}"
>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding $parent[UserControl].ProfileInfo.SPT.version}"
/>
<Path Data="{StaticResource Alert}" Fill="{Binding ElementName=SptVersion, Path=Foreground}"
Margin="10 0"
IsVisible="{Binding $parent[UserControl].ProfileInfo.VersionMismatch}"
/>
</StackPanel>
</Label>
<!-- Side image -->
<Image Grid.Row="1" Grid.Column="0"
Source="{Binding $parent[UserControl].ProfileInfo.SideImage, Converter={StaticResource ImageSourceCvt}}"
Height="50" />
<!-- Name and nickname -->
<StackPanel Grid.Row="1" Grid.Column="1" Margin="10 0 0 0">
<Label Content="{Binding $parent[UserControl].ProfileInfo.Username}" FontSize="18" FontWeight="SemiBold"
/>
<Label Content="{Binding $parent[UserControl].ProfileInfo.Nickname}" FontSize="16" Classes="acc"
IsVisible="{Binding $parent[UserControl].ProfileInfo.HasData}"
/>
</StackPanel>
<!-- No data label -->
<Label Grid.Row="0" Grid.RowSpan="5" Grid.Column="1"
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=no_profile_data}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="SemiBold"
Classes="alt"
IsVisible="{Binding !$parent[UserControl].ProfileInfo.HasData}"
/>
<!-- Level -->
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=level}"
IsVisible="{Binding HasData}"
FontSize="20"
HorizontalAlignment="Center"
Margin="0"
Padding="0"
Classes="alt"
/>
<Label Content="{Binding $parent[UserControl].ProfileInfo.Level}"
FontSize="30"
FontWeight="Bold"
Margin="0"
Padding="0"
IsVisible="{Binding HasData}"
HorizontalAlignment="Center"
/>
</StackPanel>
<!-- remaining xp -->
<StackPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3"
HorizontalAlignment="Center"
Orientation="Horizontal"
IsVisible="{Binding $parent[UserControl].ProfileInfo.HasData}"
>
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=next_level_in}"/>
<Label Content="{Binding $parent[UserControl].ProfileInfo.RemainingExp}"
FontWeight="SemiBold"
Classes="acc"
/>
<Label Content="xp"/>
</StackPanel>
<!-- xp progress -->
<ProgressBar Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3"
Value="{Binding $parent[UserControl].ProfileInfo.XPLevelProgress}"
IsVisible="{Binding $parent[UserControl].ProfileInfo.HasData}"
/>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,107 @@
using System.Threading.Tasks;
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Media;
using Avalonia.Media.Immutable;
using Avalonia.Media.Transformation;
using Avalonia.Threading;
using SPT.Launcher.Models.Launcher;
namespace SPT.Launcher.CustomControls;
public partial class DetailedProfileCard : UserControl
{
public DetailedProfileCard()
{
InitializeComponent();
var border = this.GetControl<Border>("CardBorder");
border.Opacity = 0;
border.BoxShadow = BoxShadows.Parse("0 0 0 black");
border.RenderTransform = TransformOperations.Parse("scale(0.95)");
Task.Run(async () =>
{
await Dispatcher.UIThread.InvokeAsync(async () =>
{
border.Opacity = 1;
border.RenderTransform = TransformOperations.Parse("scale(1)");
border.BoxShadow = BoxShadows.Parse("2 5 5 black");
});
});
}
public static readonly StyledProperty<ProfileInfo> ProfileInfoProperty =
AvaloniaProperty.Register<DetailedProfileCard, ProfileInfo>(
"ProfileInfo");
public ProfileInfo ProfileInfo
{
get => GetValue(ProfileInfoProperty);
set => SetValue(ProfileInfoProperty, value);
}
public static readonly StyledProperty<ICommand> LoginCommandProperty = AvaloniaProperty.Register<DetailedProfileCard, ICommand>(
"LoginCommand");
public ICommand LoginCommand
{
get => GetValue(LoginCommandProperty);
set => SetValue(LoginCommandProperty, value);
}
private void InputElement_OnPointerEntered(object? sender, PointerEventArgs e)
{
if (Application.Current != null && Application.Current.TryFindResource("AltBackgroundBrush", this.ActualThemeVariant, out var brush))
{
if (brush is ImmutableSolidColorBrush immutableBrush)
{
var border = this.GetControl<Border>("CardBorder");
border.BoxShadow = BoxShadows.Parse("5 7 10 black");
border.Background = immutableBrush;
border.RenderTransform = TransformOperations.Parse("scale(1.02)");
}
}
}
private void InputElement_OnPointerExited(object? sender, PointerEventArgs e)
{
if (Application.Current != null && Application.Current.TryFindResource("BackgroundBrush", this.ActualThemeVariant, out var brush))
{
if (brush is ImmutableSolidColorBrush immutableBrush)
{
var border = this.GetControl<Border>("CardBorder");
border.BoxShadow = BoxShadows.Parse("2 5 5 black");
border.Background = immutableBrush;
border.RenderTransform = TransformOperations.Parse("scale(1)");
}
}
}
private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e)
{
var border = this.GetControl<Border>("CardBorder");
border.RenderTransform = TransformOperations.Parse("scale(0.98)");
}
private void InputElement_OnPointerReleased(object? sender, PointerReleasedEventArgs e)
{
var border = this.GetControl<Border>("CardBorder");
var pos = e.GetPosition(border);
if (border.Bounds.Contains(pos))
{
// pointer was released inside the control
border.RenderTransform = TransformOperations.Parse("scale(1.02)");
LoginCommand.Execute(ProfileInfo.Username);
return;
}
border.RenderTransform = TransformOperations.Parse("scale(1)");
}
}

View File

@ -0,0 +1,61 @@
<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"
xmlns:cvt="using:SPT.Launcher.Converters"
xmlns:helpers="using:SPT.Launcher.Helpers"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.CustomControls.GameLaunchBar">
<UserControl.Resources>
<cvt:ImageSourceConverter x:Key="ImageSourceCvt" />
</UserControl.Resources>
<Border Classes="card">
<DockPanel Background="{DynamicResource BackgroundBrush}" Margin="2">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Stretch"
Spacing="10"
IsVisible="{Binding $parent[UserControl].ProfileInfo.HasData}">
<Grid RowDefinitions="AUTO,AUTO" ColumnDefinitions="AUTO,AUTO">
<Image Source="{Binding $parent[UserControl].ProfileInfo.SideImage, Converter={StaticResource ImageSourceCvt}}"
Grid.RowSpan="2" Height="40" Margin="10 0" />
<Label Content="{Binding $parent[UserControl].ProfileInfo.Nickname}" Grid.Row="0" Grid.Column="2" Classes="acc"/>
<Label Content="{Binding $parent[UserControl].ProfileInfo.Side}" Grid.Row="1" Grid.Column="2" />
</Grid>
<Label Content="{Binding $parent[UserControl].ProfileInfo.Level}" VerticalAlignment="Center"
FontSize="22" />
<ProgressBar Value="{Binding $parent[UserControl].ProfileInfo.XPLevelProgress}" />
<StackPanel>
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=next_level_in}"
HorizontalAlignment="Center"
/>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding $parent[UserControl].ProfileInfo.RemainingExp}"
HorizontalAlignment="Center"
Classes="acc"/>
<Label Content="xp"/>
</StackPanel>
</StackPanel>
</StackPanel>
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=start_game}"
HorizontalAlignment="Right"
VerticalContentAlignment="Center"
VerticalAlignment="Stretch"
DockPanel.Dock="Right"
Command="{Binding $parent[UserControl].StartGameCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
Classes="acc" />
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=logout}"
Command="{Binding $parent[UserControl].LogoutCommand}"
Margin="10 0"
Classes="ulink"
DockPanel.Dock="Right"
HorizontalAlignment="Right" />
</DockPanel>
</Border>
</UserControl>

View File

@ -0,0 +1,41 @@
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using SPT.Launcher.Models.Launcher;
namespace SPT.Launcher.CustomControls;
public partial class GameLaunchBar : UserControl
{
public GameLaunchBar()
{
InitializeComponent();
}
public static readonly StyledProperty<ProfileInfo> ProfileInfoProperty = AvaloniaProperty.Register<GameLaunchBar, ProfileInfo>(
"ProfileInfo");
public ProfileInfo ProfileInfo
{
get => GetValue(ProfileInfoProperty);
set => SetValue(ProfileInfoProperty, value);
}
public static readonly StyledProperty<ICommand> StartGameCommandProperty = AvaloniaProperty.Register<GameLaunchBar, ICommand>(
"StartGameCommand");
public ICommand StartGameCommand
{
get => GetValue(StartGameCommandProperty);
set => SetValue(StartGameCommandProperty, value);
}
public static readonly StyledProperty<ICommand> LogoutCommandProperty = AvaloniaProperty.Register<GameLaunchBar, ICommand>(
"LogoutCommand");
public ICommand LogoutCommand
{
get => GetValue(LogoutCommandProperty);
set => SetValue(LogoutCommandProperty, value);
}
}

View File

@ -10,7 +10,7 @@
> >
<ComboBox.ItemTemplate> <ComboBox.ItemTemplate>
<DataTemplate DataType="{x:Type model:LocalizedLauncherAction}"> <DataTemplate DataType="{x:Type model:LocalizedLauncherAction}">
<Label Content="{Binding Name}"/> <TextBlock Text="{Binding Name}"/>
</DataTemplate> </DataTemplate>
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>

View File

@ -61,7 +61,7 @@ namespace SPT.Launcher.CustomControls
} }
} }
comboBox.Items = actionsList; comboBox.ItemsSource = actionsList;
foreach(var item in comboBox.Items) foreach(var item in comboBox.Items)
{ {

View File

@ -0,0 +1,38 @@
<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"
xmlns:helpers="using:SPT.Launcher.Helpers"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.CustomControls.LoginBox">
<Border Classes="card">
<Grid RowDefinitions="Auto, Auto" ColumnDefinitions="*, Auto" Margin="10">
<!-- Username box -->
<TextBox Watermark="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=username}"
VerticalAlignment="Center"
MinWidth="250"
Text="{Binding $parent[UserControl].Username}"
Margin="0 0 10 0"
/>
<!-- Login button -->
<Button Grid.Column="1" HorizontalContentAlignment="Center"
Command="{Binding $parent[UserControl].LoginCommand}"
IsEnabled="{Binding !$parent[UserControl].IsLoggingIn}"
IsDefault="True"
Classes="acc"
>
<TextBlock
Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=login_or_register}"
TextWrapping="Wrap" />
</Button>
<!-- Auto login checkbox -->
<CheckBox Grid.Row="1"
IsChecked="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=UseAutoLogin}"
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=login_automatically}"
/>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,40 @@
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
namespace SPT.Launcher.CustomControls;
public partial class LoginBox : UserControl
{
public LoginBox()
{
InitializeComponent();
}
public static readonly StyledProperty<string> UsernameProperty = AvaloniaProperty.Register<LoginBox, string>(
"Username");
public string Username
{
get => GetValue(UsernameProperty);
set => SetValue(UsernameProperty, value);
}
public static readonly StyledProperty<ICommand> LoginCommandProperty = AvaloniaProperty.Register<LoginBox, ICommand>(
"LoginCommand");
public ICommand LoginCommand
{
get => GetValue(LoginCommandProperty);
set => SetValue(LoginCommandProperty, value);
}
public static readonly StyledProperty<bool> IsLoggedInProperty = AvaloniaProperty.Register<LoginBox, bool>(
"IsLoggedIn");
public bool IsLoggedIn
{
get => GetValue(IsLoggedInProperty);
set => SetValue(IsLoggedInProperty, value);
}
}

View File

@ -5,12 +5,10 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:helpers="using:SPT.Launcher.Helpers" xmlns:helpers="using:SPT.Launcher.Helpers"
x:Class="SPT.Launcher.CustomControls.ModInfoCard"> x:Class="SPT.Launcher.CustomControls.ModInfoCard">
<Border CornerRadius="5" HorizontalAlignment="Stretch" <Border Classes="card" HorizontalAlignment="Stretch">
BorderBrush="{StaticResource SPT_Background_Dark}" <Grid RowDefinitions="10,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,AUTO,10"
BorderThickness="5" Background="{DynamicResource BackgroundBrush}"
> Margin="2"
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,AUTO,10"
Background="{StaticResource SPT_Background_Dark}"
> >
<!-- Icon stack --> <!-- Icon stack -->
@ -19,19 +17,19 @@
Orientation="Horizontal" Spacing="5" Orientation="Horizontal" Spacing="5"
> >
<!-- Server Icon --> <!-- Server Icon -->
<Path Data="{StaticResource Server}" Fill="{StaticResource SPT_Brush_DarkGrayBlue}" <Path Data="{StaticResource Server}" Fill="{DynamicResource AltAccentBrush}"
IsVisible="{Binding IsInServer, RelativeSource={RelativeSource AncestorType=UserControl}}" IsVisible="{Binding IsInServer, RelativeSource={RelativeSource AncestorType=UserControl}}"
/> />
<!-- Profile Icon --> <!-- Profile Icon -->
<Path Data="{StaticResource Profile}" Fill="{StaticResource SPT_Brush_DarkGrayBlue}" <Path Data="{StaticResource Profile}" Fill="{DynamicResource AltAccentBrush}"
IsVisible="{Binding IsInProfile, RelativeSource={RelativeSource AncestorType=UserControl}}" IsVisible="{Binding IsInProfile, RelativeSource={RelativeSource AncestorType=UserControl}}"
/> />
<!-- Info Icon --> <!-- Info Icon -->
<Canvas> <Canvas>
<Rectangle ToolTip.Tip="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=mod_not_in_server_warning}" Fill="Transparent" Height="20" Width="20"/> <Rectangle ToolTip.Tip="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=mod_not_in_server_warning}" Fill="Transparent" Height="20" Width="20"/>
<Path Data="{StaticResource Info}" Fill="DodgerBlue" <Path Data="{StaticResource Info}" Fill="{DynamicResource AccentBrush}"
ToolTip.Tip="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=mod_not_in_server_warning}" ToolTip.Tip="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=mod_not_in_server_warning}"
> >
<Path.IsVisible> <Path.IsVisible>
@ -54,7 +52,7 @@
> >
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=open_link}"/> <Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=open_link}"/>
<Path Data="{StaticResource Open}" Fill="{StaticResource SPT_Brush_Yellow}" <Path Data="{StaticResource Open}" Fill="{DynamicResource AccentBrush}"
IsVisible="{Binding IsInProfile, RelativeSource={RelativeSource AncestorType=UserControl}}" IsVisible="{Binding IsInProfile, RelativeSource={RelativeSource AncestorType=UserControl}}"
/> />
</StackPanel> </StackPanel>
@ -66,7 +64,7 @@
/> />
<!-- Author Text --> <!-- Author Text -->
<Label Grid.Row="3" Grid.Column="1" FontSize="12" Foreground="DimGray" <Label Grid.Row="3" Grid.Column="1" FontSize="12" Foreground="{DynamicResource AltAccentBrush}"
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=author}" Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=author}"
/> />
@ -78,6 +76,7 @@
<!-- Mod Version --> <!-- Mod Version -->
<Label Grid.Row="3" Grid.Column="3" FontSize="12" <Label Grid.Row="3" Grid.Column="3" FontSize="12"
Content="{Binding Version, RelativeSource={RelativeSource AncestorType=UserControl}}" Content="{Binding Version, RelativeSource={RelativeSource AncestorType=UserControl}}"
Classes="acc"
/> />
</Grid> </Grid>
</Border> </Border>

View File

@ -0,0 +1,61 @@
<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"
xmlns:helpers="using:SPT.Launcher.Helpers"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.CustomControls.ProfileCard">
<Border Classes="card">
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,10" Margin="2"
Background="{DynamicResource BackgroundBrush}">
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">
<Label Content="{Binding $parent[UserControl].ProfileInfo.Username}" Margin="5 0" />
<!-- profile name and version -->
<Label x:Name="SPTVersion"
Background="Transparent"
ToolTip.Tip="{Binding $parent[UserControl].ProfileInfo.MismatchMessage}"
Classes.versionMismatch="{Binding $parent[UserControl].ProfileInfo.VersionMismatch}"
Classes.acc="{Binding !$parent[UserControl].ProfileInfo.VersionMismatch}"
>
<StackPanel Orientation="Horizontal" Background="Transparent">
<TextBlock Text="{Binding $parent[UserControl].ProfileInfo.SPT.version}" />
<Path Data="{StaticResource Info}"
Fill="{Binding ElementName=SPTVersion, Path=Foreground}"
Margin="10 0"
IsVisible="{Binding $parent[UserControl].ProfileInfo.VersionMismatch}" />
</StackPanel>
</Label>
</StackPanel>
<!-- delete profile button -->
<Button HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2"
Classes="icon"
Command="{Binding $parent[UserControl].RemoveProfileCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}">
<Path Data="{StaticResource Delete}" Fill="IndianRed" />
</Button>
<!-- profile id button -->
<Button Content="{Binding $parent[UserControl].CurrentId}" Classes="ulink"
Grid.Row="2" Grid.Column="1"
Command="{Binding $parent[UserControl].CopyCommand}"
CommandParameter="{Binding $parent[UserControl].CurrentId}" />
<!-- profile edition button -->
<Button Content="{Binding $parent[UserControl].CurrentEdition}" Classes="ulink"
Grid.Row="3" Grid.Column="1"
Command="{Binding $parent[UserControl].ChangeEditionCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}" />
<!-- wipe profile checkbox -->
<CheckBox
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=wipe_on_start}"
Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2"
IsChecked="{Binding $parent[UserControl].WipeProfileOnStart}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
IsVisible="{Binding !$parent[UserControl].ProfileWipePending}"
/>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,86 @@
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using SPT.Launcher.Models.Launcher;
namespace SPT.Launcher.CustomControls;
public partial class ProfileCard : UserControl
{
public ProfileCard()
{
InitializeComponent();
}
public static readonly StyledProperty<ProfileInfo> ProfileInfoProperty = AvaloniaProperty.Register<ProfileCard, ProfileInfo>(
"ProfileInfo");
public ProfileInfo ProfileInfo
{
get => GetValue(ProfileInfoProperty);
set => SetValue(ProfileInfoProperty, value);
}
public static readonly StyledProperty<string> CurrentIdProperty = AvaloniaProperty.Register<ProfileCard, string>(
"CurrentId");
public string CurrentId
{
get => GetValue(CurrentIdProperty);
set => SetValue(CurrentIdProperty, value);
}
public static readonly StyledProperty<string> CurrentEditionProperty = AvaloniaProperty.Register<ProfileCard, string>(
"CurrentEdition");
public string CurrentEdition
{
get => GetValue(CurrentEditionProperty);
set => SetValue(CurrentEditionProperty, value);
}
public static readonly StyledProperty<bool> WipeProfileOnStartProperty = AvaloniaProperty.Register<ProfileCard, bool>(
"WipeProfileOnStart");
public bool WipeProfileOnStart
{
get => GetValue(WipeProfileOnStartProperty);
set => SetValue(WipeProfileOnStartProperty, value);
}
public static readonly StyledProperty<bool> ProfileWipePendingProperty = AvaloniaProperty.Register<ProfileCard, bool>(
"ProfileWipePending");
public bool ProfileWipePending
{
get => GetValue(ProfileWipePendingProperty);
set => SetValue(ProfileWipePendingProperty, value);
}
public static readonly StyledProperty<ICommand> RemoveProfileCommandProperty = AvaloniaProperty.Register<ProfileCard, ICommand>(
"RemoveProfileCommand");
public ICommand RemoveProfileCommand
{
get => GetValue(RemoveProfileCommandProperty);
set => SetValue(RemoveProfileCommandProperty, value);
}
public static readonly StyledProperty<ICommand> CopyCommandProperty = AvaloniaProperty.Register<ProfileCard, ICommand>(
"CopyCommand");
public ICommand CopyCommand
{
get => GetValue(CopyCommandProperty);
set => SetValue(CopyCommandProperty, value);
}
public static readonly StyledProperty<ICommand> ChangeEditionCommandProperty = AvaloniaProperty.Register<ProfileCard, ICommand>(
"ChangeEditionCommand");
public ICommand ChangeEditionCommand
{
get => GetValue(ChangeEditionCommandProperty);
set => SetValue(ChangeEditionCommandProperty, value);
}
}

View File

@ -55,11 +55,11 @@
> >
<Button.Styles> <Button.Styles>
<Style Selector="Button:pointerover /template/ ContentPresenter"> <Style Selector="Button:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Brush_DarkGrayBlue}"/> <Setter Property="Background" Value="{DynamicResource AccentBrush2}"/>
<Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderThickness" Value="0"/>
</Style> </Style>
<Style Selector="Button:pressed /template/ ContentPresenter"> <Style Selector="Button:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="{StaticResource SPT_Background_Light}"/> <Setter Property="Background" Value="{DynamicResource AccentBrush3}"/>
</Style> </Style>
</Button.Styles> </Button.Styles>
</Button> </Button>

View File

@ -0,0 +1,31 @@
<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"
xmlns:helpers="using:SPT.Launcher.Helpers"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.CustomControls.TotalModsCard">
<Border Classes="card" IsVisible="{Binding ModInfoCollection.HasMods}">
<Grid RowDefinitions="10,AUTO,10" ColumnDefinitions="10,Auto,*,AUTO,10" Margin="2"
Background="{DynamicResource BackgroundBrush}">
<!-- server mods count text -->
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=active_server_mods}" VerticalAlignment="Center"/>
<Label Content="{Binding $parent[UserControl].ActiveModsCount}" Classes="acc" FontWeight="SemiBold" VerticalAlignment="Center"/>
</StackPanel>
<!-- Show mods info view button -->
<Button Grid.Row="0" Grid.RowSpan="3" Grid.Column="3" Grid.ColumnSpan="2"
VerticalAlignment="Stretch" FontSize="18" Margin="10 0 0 0"
Command="{Binding $parent[UserControl].OpenModsInfoCommand}"
Classes="icon">
<Button.Content>
<Path Data="{StaticResource Open}" Fill="{DynamicResource ForegroundBrush}"
VerticalAlignment="Center"
/>
</Button.Content>
</Button>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,33 @@
using System.Collections.ObjectModel;
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace SPT.Launcher.CustomControls;
public partial class TotalModsCard : UserControl
{
public TotalModsCard()
{
InitializeComponent();
}
public static readonly StyledProperty<int> ActiveModsCountProperty = AvaloniaProperty.Register<TotalModsCard, int>(
"ActiveModsCount");
public int ActiveModsCount
{
get => GetValue(ActiveModsCountProperty);
set => SetValue(ActiveModsCountProperty, value);
}
public static readonly StyledProperty<ICommand> OpenModsInfoCommandProperty = AvaloniaProperty.Register<TotalModsCard, ICommand>(
"OpenModsInfoCommand");
public ICommand OpenModsInfoCommand
{
get => GetValue(OpenModsInfoCommandProperty);
set => SetValue(OpenModsInfoCommandProperty, value);
}
}

View File

@ -7,6 +7,7 @@ using Avalonia.Controls.Notifications;
using Splat; using Splat;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using DialogHostAvalonia;
namespace SPT.Launcher.Models namespace SPT.Launcher.Models
{ {
@ -30,7 +31,7 @@ namespace SPT.Launcher.Models
var localeText = string.Format(LocalizationProvider.Instance.file_mismatch_dialog_message, serverVersion); var localeText = string.Format(LocalizationProvider.Instance.file_mismatch_dialog_message, serverVersion);
var result = await DialogHost.DialogHost.Show(new ConfirmationDialogViewModel(null, localeText, null, null, LauncherSettingsProvider.Instance.IsDevMode)); var result = await DialogHost.Show(new ConfirmationDialogViewModel(null, localeText, null, null, LauncherSettingsProvider.Instance.IsDevMode));
if(result != null && result is bool confirmation && !confirmation) if(result != null && result is bool confirmation && !confirmation)
{ {

View File

@ -22,12 +22,13 @@
<Content Include="Assets\icon.ico" /> <Content Include="Assets\icon.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.15" /> <PackageReference Include="Avalonia" Version="11.1.0-rc2" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.15" /> <PackageReference Include="Avalonia.Desktop" Version="11.1.0-rc2" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> <!--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.12" /> <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.12" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.15" /> <PackageReference Include="Avalonia.ReactiveUI" Version="11.1.0-rc2" />
<PackageReference Include="DialogHost.Avalonia" Version="0.5.0" /> <PackageReference Include="Avalonia.Themes.Fluent" Version="11.1.0-rc2" />
<PackageReference Include="DialogHost.Avalonia" Version="0.8.0-avalonia11dot1-3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SPT.ByteBanger\SPT.ByteBanger.csproj" /> <ProjectReference Include="..\SPT.ByteBanger\SPT.ByteBanger.csproj" />

View File

@ -7,7 +7,7 @@ namespace SPT.Launcher
{ {
public class ViewLocator : IDataTemplate public class ViewLocator : IDataTemplate
{ {
public IControl Build(object data) public Control Build(object data)
{ {
var name = data.GetType().FullName!.Replace("ViewModel", "View"); var name = data.GetType().FullName!.Replace("ViewModel", "View");
var type = Type.GetType(name); var type = Type.GetType(name);

View File

@ -146,8 +146,10 @@ namespace SPT.Launcher.ViewModels
}); });
} }
public void GetExistingProfiles() public async Task GetExistingProfiles()
{ {
await Task.Delay(200);
ServerProfileInfo[] existingProfiles = AccountManager.GetExistingProfiles(); ServerProfileInfo[] existingProfiles = AccountManager.GetExistingProfiles();
if(existingProfiles != null) if(existingProfiles != null)
@ -164,6 +166,8 @@ namespace SPT.Launcher.ViewModels
ImageHelper sideImage = new ImageHelper() { Path = profileInfo.SideImage }; ImageHelper sideImage = new ImageHelper() { Path = profileInfo.SideImage };
sideImage.Touch(); sideImage.Touch();
await Task.Delay(100);
} }
} }
} }

View File

@ -9,7 +9,7 @@ using SPT.Launcher.Models.SPT;
using SPT.Launcher.Helpers; using SPT.Launcher.Helpers;
using SPT.Launcher.ViewModels.Dialogs; using SPT.Launcher.ViewModels.Dialogs;
using Avalonia.Threading; using Avalonia.Threading;
using dialogHost = DialogHost.DialogHost; using DialogHostAvalonia;
namespace SPT.Launcher.ViewModels namespace SPT.Launcher.ViewModels
@ -48,7 +48,7 @@ namespace SPT.Launcher.ViewModels
LocalizationProvider.Instance.yes, LocalizationProvider.Instance.yes,
LocalizationProvider.Instance.no); LocalizationProvider.Instance.no);
var confirmCopySettings = await dialogHost.Show(viewModel); var confirmCopySettings = await DialogHost.Show(viewModel);
if (confirmCopySettings is bool and true) if (confirmCopySettings is bool and true)
{ {

View File

@ -10,6 +10,7 @@ using SPT.Launcher.ViewModels.Dialogs;
using Avalonia.Threading; using Avalonia.Threading;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using Avalonia.Controls.ApplicationLifetimes;
using SPT.Launcher.Models.SPT; using SPT.Launcher.Models.SPT;
namespace SPT.Launcher.ViewModels namespace SPT.Launcher.ViewModels
@ -17,8 +18,8 @@ namespace SPT.Launcher.ViewModels
[RequireLoggedIn] [RequireLoggedIn]
public class ProfileViewModel : ViewModelBase public class ProfileViewModel : ViewModelBase
{ {
public string CurrentUsername { get; set; } // public string CurrentUsername { get; set; }
private string _CurrentEdition; private string _CurrentEdition;
public string CurrentEdition public string CurrentEdition
{ {
@ -40,7 +41,7 @@ namespace SPT.Launcher.ViewModels
set => this.RaiseAndSetIfChanged(ref _ProfileWipePending, value); set => this.RaiseAndSetIfChanged(ref _ProfileWipePending, value);
} }
public string CurrentID { get; set; } public string CurrentId { get; set; }
public ProfileInfo ProfileInfo { get; set; } = AccountManager.SelectedProfileInfo; public ProfileInfo ProfileInfo { get; set; } = AccountManager.SelectedProfileInfo;
@ -48,9 +49,9 @@ namespace SPT.Launcher.ViewModels
public ModInfoCollection ModInfoCollection { get; set; } = new ModInfoCollection(); public ModInfoCollection ModInfoCollection { get; set; } = new ModInfoCollection();
private GameStarter gameStarter = new GameStarter(new GameStarterFrontend()); private readonly GameStarter _gameStarter = new GameStarter(new GameStarterFrontend());
private ProcessMonitor monitor { get; set; } private readonly ProcessMonitor _monitor;
public ProfileViewModel(IScreen Host) : base(Host) public ProfileViewModel(IScreen Host) : base(Host)
{ {
@ -62,13 +63,13 @@ namespace SPT.Launcher.ViewModels
SideImage.Touch(); SideImage.Touch();
} }
monitor = new ProcessMonitor("EscapeFromTarkov", 1000, aliveCallback: GameAliveCallBack, exitCallback: GameExitCallback); _monitor = new ProcessMonitor("EscapeFromTarkov", 1000, aliveCallback: GameAliveCallBack, exitCallback: GameExitCallback);
CurrentUsername = AccountManager.SelectedAccount.username; // CurrentUsername = AccountManager.SelectedAccount.username;
CurrentEdition = AccountManager.SelectedAccount.edition; CurrentEdition = AccountManager.SelectedAccount.edition;
CurrentID = AccountManager.SelectedAccount.id; CurrentId = AccountManager.SelectedAccount.id;
} }
private async Task GameVersionCheck() private async Task GameVersionCheck()
@ -154,11 +155,11 @@ namespace SPT.Launcher.ViewModels
WipeProfileOnStart = false; WipeProfileOnStart = false;
} }
GameStarterResult gameStartResult = await gameStarter.LaunchGame(ServerManager.SelectedServer, AccountManager.SelectedAccount, LauncherSettingsProvider.Instance.GamePath); GameStarterResult gameStartResult = await _gameStarter.LaunchGame(ServerManager.SelectedServer, AccountManager.SelectedAccount, LauncherSettingsProvider.Instance.GamePath);
if (gameStartResult.Succeeded) if (gameStartResult.Succeeded)
{ {
monitor.Start(); _monitor.Start();
switch (LauncherSettingsProvider.Instance.LauncherStartGameAction) switch (LauncherSettingsProvider.Instance.LauncherStartGameAction)
{ {
@ -221,9 +222,14 @@ namespace SPT.Launcher.ViewModels
public async Task CopyCommand(object parameter) public async Task CopyCommand(object parameter)
{ {
if (Application.Current.Clipboard != null && parameter != null && parameter is string text) if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop && parameter is string text)
{ {
await Application.Current.Clipboard.SetTextAsync(text); if (desktop?.MainWindow?.Clipboard == null)
{
return;
}
await desktop.MainWindow.Clipboard.SetTextAsync(text);
SendNotification("", $"{text} {LocalizationProvider.Instance.copied}", Avalonia.Controls.Notifications.NotificationType.Success); SendNotification("", $"{text} {LocalizationProvider.Instance.copied}", Avalonia.Controls.Notifications.NotificationType.Success);
} }
} }

View File

@ -8,7 +8,7 @@ using ReactiveUI;
using Splat; using Splat;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using dialogHost = DialogHost.DialogHost; using DialogHostAvalonia;
namespace SPT.Launcher.ViewModels namespace SPT.Launcher.ViewModels
{ {
@ -162,7 +162,7 @@ namespace SPT.Launcher.ViewModels
/// <returns></returns> /// <returns></returns>
public async Task<object?> ShowDialog(object ViewModel) public async Task<object?> ShowDialog(object ViewModel)
{ {
return await dialogHost.Show(ViewModel); return await DialogHost.Show(ViewModel);
} }
public ViewModelBase(IScreen Host) public ViewModelBase(IScreen Host)

View File

@ -24,6 +24,7 @@
HorizontalAlignment="Center" HorizontalAlignment="Center"
IsVisible="{Binding connectModel.ConnectionFailed}" IsVisible="{Binding connectModel.ConnectionFailed}"
Command="{Binding RetryCommand}" Command="{Binding RetryCommand}"
Classes="alt"
/> />
</Grid> </Grid>

View File

@ -3,11 +3,12 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:helpers="using:SPT.Launcher.Helpers" xmlns:helpers="using:SPT.Launcher.Helpers"
xmlns:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia" xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.Dialogs.ChangeEditionDialogView" x:Class="SPT.Launcher.Views.Dialogs.ChangeEditionDialogView"
Background="{StaticResource SPT_Background_Dark}"> Background="{DynamicResource BackgroundBrush}"
>
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,*,AUTO,10"> <Grid RowDefinitions="10,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,*,AUTO,10">
@ -16,13 +17,13 @@
Foreground="IndianRed" Foreground="IndianRed"
/> />
<ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" <ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
Items="{Binding editions.AvailableEditions}" ItemsSource="{Binding editions.AvailableEditions}"
SelectedItem="{Binding editions.SelectedEdition}" SelectedItem="{Binding editions.SelectedEdition}"
PlaceholderText="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=select_edition}" PlaceholderText="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=select_edition}"
> >
<ComboBox.ItemTemplate> <ComboBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<Label Background="Transparent" Content="{Binding Name}" ToolTip.Tip="{Binding Description}"/> <TextBlock Background="Transparent" Text="{Binding Name}" ToolTip.Tip="{Binding Description}"/>
</DataTemplate> </DataTemplate>
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
@ -31,7 +32,7 @@
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=update}" <Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=update}"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"
CommandParameter="{Binding editions.SelectedEdition}" CommandParameter="{Binding editions.SelectedEdition}"
Classes="yellow" Classes="acc"
/> />
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=cancel}" <Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=cancel}"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"

View File

@ -2,23 +2,22 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia" xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.Dialogs.ConfirmationDialogView" x:Class="SPT.Launcher.Views.Dialogs.ConfirmationDialogView"
Background="{StaticResource SPT_Background_Dark}"
MinWidth="300" MinWidth="300"
MinHeight="100" MinHeight="100"
Background="{DynamicResource BackgroundBrush}"
> >
<Grid RowDefinitions="*,AUTO" ColumnDefinitions="*,AUTO" Margin="10"> <Grid RowDefinitions="*,AUTO" ColumnDefinitions="*,AUTO" Margin="10">
<TextBlock Text="{Binding Question}" Grid.ColumnSpan="2" FontSize="15" <TextBlock Text="{Binding Question}" Grid.ColumnSpan="2" FontSize="15"
Foreground="{StaticResource SPT_Foreground_Light}"
/> />
<StackPanel Grid.Row="1" Grid.Column="1" <StackPanel Grid.Row="1" Grid.Column="1"
Orientation="Horizontal" Spacing="10"> Orientation="Horizontal" Spacing="10">
<Button Content="{Binding ConfirmButtonText}" <Button Content="{Binding ConfirmButtonText}"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"
Classes="yellow" Classes="acc"
IsEnabled="{Binding AllowConfirm}" IsEnabled="{Binding AllowConfirm}"
> >
<Button.CommandParameter> <Button.CommandParameter>

View File

@ -2,11 +2,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia" xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
xmlns:helpers="using:SPT.Launcher.Helpers" xmlns:helpers="using:SPT.Launcher.Helpers"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.Dialogs.RegisterDialogView" x:Class="SPT.Launcher.Views.Dialogs.RegisterDialogView"
Background="{StaticResource SPT_Background_Dark}" Background="{DynamicResource BackgroundBrush}"
MinWidth="300" MinWidth="300"
MinHeight="100" MinHeight="100"
> >
@ -15,28 +15,26 @@
<!-- Question Text --> <!-- Question Text -->
<TextBlock Text="{Binding Question}" Grid.ColumnSpan="2" FontSize="15" <TextBlock Text="{Binding Question}" Grid.ColumnSpan="2" FontSize="15"
Foreground="{StaticResource SPT_Foreground_Light}" />
/>
<!-- Editions Combo Selection --> <!-- Editions Combo Selection -->
<ComboBox Items="{Binding Editions.AvailableEditions}" <ComboBox ItemsSource="{Binding Editions.AvailableEditions}"
Margin="0 10" Margin="0 10"
Grid.Row="1" Grid.ColumnSpan="2" Grid.Row="1" Grid.ColumnSpan="2"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
SelectedItem="{Binding Editions.SelectedEdition}" SelectedItem="{Binding Editions.SelectedEdition}"
PlaceholderText="{Binding ComboBoxPlaceholderText}" PlaceholderText="{Binding ComboBoxPlaceholderText}"
> >
<ComboBox.ItemTemplate> <ComboBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<Label Background="Transparent" Content="{Binding Name}" ToolTip.Tip="{Binding Description}"/> <TextBlock Background="Transparent" Text="{Binding Name}" ToolTip.Tip="{Binding Description}"/>
</DataTemplate> </DataTemplate>
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
<!-- Description Area --> <!-- Description Area -->
<Border Grid.Row="2" Grid.ColumnSpan="3" Margin="0 10" <Border Grid.Row="2" Grid.ColumnSpan="3" Margin="0 10"
Background="{StaticResource SPT_Background_Light}" CornerRadius="10" Background="{DynamicResource BackgroundBrush2}" CornerRadius="10"
MaxWidth="500" MinHeight="50" MaxWidth="500" MinHeight="50"
MinWidth="500" MinWidth="500"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
@ -44,11 +42,9 @@
<StackPanel Spacing="10" Margin="10"> <StackPanel Spacing="10" Margin="10">
<TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=description}" <TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=description}"
FontSize="12" FontSize="12"
Foreground="{StaticResource SPT_Foreground_Light}" />
/>
<TextBlock Text="{Binding Editions.SelectedEdition.Description}" <TextBlock Text="{Binding Editions.SelectedEdition.Description}"
TextWrapping="Wrap" TextWrapping="Wrap"
Foreground="{StaticResource SPT_Foreground_Light}"
/> />
</StackPanel> </StackPanel>
</Border> </Border>
@ -62,7 +58,7 @@
CommandParameter="{Binding Editions.SelectedEdition}" CommandParameter="{Binding Editions.SelectedEdition}"
IsEnabled="{Binding Editions.HasSelection}" IsEnabled="{Binding Editions.HasSelection}"
IsDefault="True" IsDefault="True"
Classes="yellow" Classes="acc"
/> />
<Button Content="{Binding CancelButtonText}" <Button Content="{Binding CancelButtonText}"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"

View File

@ -3,10 +3,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:helpers="using:SPT.Launcher.Helpers" xmlns:helpers="using:SPT.Launcher.Helpers"
xmlns:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia" xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.Dialogs.WarningDialogView" x:Class="SPT.Launcher.Views.Dialogs.WarningDialogView"
Background="{StaticResource SPT_Background_Dark}" Background="{DynamicResource BackgroundBrush}"
BorderBrush="IndianRed" BorderBrush="IndianRed"
BorderThickness="1" BorderThickness="1"
> >
@ -20,7 +20,7 @@
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=dialogHost:DialogHost}, Path=CloseDialogCommand}"
Classes="yellow" Classes="acc"
/> />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -2,140 +2,38 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:helpers="using:SPT.Launcher.Helpers"
xmlns:launcher="using:SPT.Launcher.Models.Launcher" xmlns:launcher="using:SPT.Launcher.Models.Launcher"
xmlns:cvt="using:SPT.Launcher.Converters" xmlns:cc="using:SPT.Launcher.CustomControls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.LoginView"> x:Class="SPT.Launcher.Views.LoginView">
<UserControl.Resources> <Grid RowDefinitions="10,*,Auto,10" ColumnDefinitions="10,*,Auto,*,10">
<cvt:ImageSourceConverter x:Key="imageSourceCvt"/>
</UserControl.Resources>
<Grid RowDefinitions="20,*,AUTO,*,20" ColumnDefinitions="20,4*,2*,20"> <ScrollViewer Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" >
<ItemsControl ItemsSource="{Binding ExistingProfiles}"
<ScrollViewer Grid.Row="1" Grid.RowSpan="3" Grid.Column="1"> VerticalAlignment="Center"
<ItemsControl Items="{Binding ExistingProfiles}" >
VerticalAlignment="Center" HorizontalAlignment="Stretch" <ItemsControl.ItemsPanel>
> <ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate DataType="launcher:ProfileInfo"> <DataTemplate DataType="launcher:ProfileInfo">
<Button Classes="profileinfo" Margin="0 10 10 10" HorizontalAlignment="Stretch" <cc:DetailedProfileCard
Command="{Binding $parent[ItemsControl].DataContext.LoginProfileCommand}" ProfileInfo="{Binding }"
CommandParameter="{Binding Username}" LoginCommand="{Binding $parent[ItemsControl].DataContext.LoginProfileCommand}"
> />
<!-- profile info item grid -->
<Grid RowDefinitions="5,AUTO,AUTO,12,5" ColumnDefinitions="5,AUTO,AUTO,AUTO,*,5">
<Image Source="{Binding SideImage, Converter={StaticResource imageSourceCvt}}" Height="35"
Grid.Row="1" Grid.RowSpan="2" Grid.Column="1" Margin="0 0 5 0"
/>
<!-- username -->
<Label Content="{Binding Username}" Grid.Row="1" Grid.Column="2"
/>
<!-- SPT version -->
<Label x:Name="SPTVersion"
Grid.Row="1" Grid.Column="4"
Background="Transparent"
ToolTip.Tip="{Binding MismatchMessage}"
Classes.versionMismatch="{Binding VersionMismatch}"
>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding SPT.version}"/>
<Path Data="{StaticResource Alert}" Fill="{Binding ElementName=SPTVersion, Path=Foreground}"
Margin="10 0"
IsVisible="{Binding VersionMismatch}"
/>
</StackPanel>
</Label>
<!-- no data label -->
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance},
Path=no_profile_data}"
Grid.Row="1" Grid.RowSpan="2" Grid.Column="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="SemiBold"
Foreground="{StaticResource SPT_Brush_DarkGrayBlue}"
IsVisible="{Binding !HasData}"
/>
<!-- nickname -->
<Label Content="{Binding Nickname}" Grid.Row="1" Grid.Column="3"
IsVisible="{Binding HasData}"
Foreground="{StaticResource SPT_Brush_DarkGrayBlue}"
/>
<!-- remaining exp -->
<Label Grid.Row="2" Grid.RowSpan="2" Grid.Column="4"
VerticalAlignment="Bottom" HorizontalAlignment="Center"
FontSize="12"
IsVisible="{Binding HasData}"
>
<Label.Content>
<MultiBinding StringFormat="{}{0} {1} xp">
<Binding Source="{x:Static helpers:LocalizationProvider.Instance}" Path="next_level_in"/>
<Binding Path="RemainingExp"/>
</MultiBinding>
</Label.Content>
</Label>
<!-- level text-->
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=level}"
Grid.Row="2" Grid.Column="2"
IsVisible="{Binding HasData}"
/>
<!-- level -->
<Label Content="{Binding Level}" Grid.Row="2" Grid.Column="3"
IsVisible="{Binding HasData}"
/>
<!-- exp level progress -->
<ProgressBar Value="{Binding XPLevelProgress}"
Grid.Row="2" Grid.Column="4" Grid.ColumnSpan="2"
IsVisible="{Binding HasData}"
/>
</Grid>
</Button>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
</ScrollViewer> </ScrollViewer>
<!-- Login Control backdrop --> <!-- Login box -->
<Border CornerRadius="5" <cc:LoginBox Grid.Row="2" Grid.Column="2"
Grid.Row="2" Grid.Column="2" Username="{Binding Login.Username, Mode=TwoWay}"
BorderBrush="{StaticResource SPT_Background_Dark}" LoginCommand="{Binding LoginCommand}"
BorderThickness="2" IsLoggedIn="{Binding IsLoggedIn}"
Background="{StaticResource SPT_Background_Dark}" />
>
<Rectangle Fill="{StaticResource SPT_Background_Dark}" />
</Border>
<StackPanel Spacing="10" Margin="10" Grid.Row="2" Grid.Column="2" HorizontalAlignment="Stretch">
<!-- Username box -->
<TextBox Watermark="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=username}"
Text="{Binding Login.Username}"
/>
<!-- Login button -->
<Button HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"
Command="{Binding LoginCommand}"
IsEnabled="{Binding !IsLoggingIn}"
IsDefault="True"
>
<TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=login_or_register}"
TextWrapping="Wrap"
/>
</Button>
<CheckBox IsChecked="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=UseAutoLogin}">
<TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=login_automatically}"
TextWrapping="Wrap"
/>
</CheckBox>
</StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -5,20 +5,19 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:cc="using:SPT.Launcher.CustomControls" xmlns:cc="using:SPT.Launcher.CustomControls"
xmlns:rxui="using:Avalonia.ReactiveUI" xmlns:rxui="using:Avalonia.ReactiveUI"
xmlns:helpers="using:SPT.Launcher.Helpers"
xmlns:cvt="using:SPT.Launcher.Converters" xmlns:cvt="using:SPT.Launcher.Converters"
xmlns:dialogHost="clr-namespace:DialogHost;assembly=DialogHost.Avalonia" xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
mc:Ignorable="d" d:DesignWidth="750" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="750" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.MainWindow" x:Class="SPT.Launcher.Views.MainWindow"
Icon="/Assets/spt-logo.ico" Icon="/Assets/spt-logo.ico"
Title="SPT.Launcher" Title="SPT.Launcher"
MinHeight="450" MinWidth="800" MinHeight="450" MinWidth="760"
Height="450" Width="800" Height="450" Width="760"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
ExtendClientAreaToDecorationsHint="True" ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome" ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="-1" ExtendClientAreaTitleBarHeightHint="-1"
Background="{StaticResource SPT_Background_Light}"> Background="{DynamicResource AltBackgroundBrush}">
<Window.Resources> <Window.Resources>
<cvt:ImageSourceConverter x:Key="imageSourceCvt"/> <cvt:ImageSourceConverter x:Key="imageSourceCvt"/>
@ -39,7 +38,7 @@
MinButtonCommand="{Binding MinimizeCommand}" MinButtonCommand="{Binding MinimizeCommand}"
SettingsButtonCommand="{Binding GoToSettingsCommand}" SettingsButtonCommand="{Binding GoToSettingsCommand}"
Classes.versiontag="{Binding VersionInfo.HasTag}" Classes.versiontag="{Binding VersionInfo.HasTag}"
/> />
<Image Source="{Binding Background.Path, Converter={StaticResource imageSourceCvt}}" <Image Source="{Binding Background.Path, Converter={StaticResource imageSourceCvt}}"
Stretch="Fill" RenderOptions.BitmapInterpolationMode="HighQuality" Stretch="Fill" RenderOptions.BitmapInterpolationMode="HighQuality"
@ -50,17 +49,16 @@
<dialogHost:DialogHost Identifier="mainHost" Grid.Row="1" Grid.RowSpan="2" <dialogHost:DialogHost Identifier="mainHost" Grid.Row="1" Grid.RowSpan="2"
CornerRadius="5" CornerRadius="5"
DialogMargin="0" DialogMargin="0"
OverlayBackground="{StaticResource SPT_Background_Light}" OverlayBackground="Gray"
> >
<rxui:RoutedViewHost Router="{Binding Router}" <rxui:RoutedViewHost Router="{Binding Router}" />
/>
</dialogHost:DialogHost> </dialogHost:DialogHost>
<Label Content="{Binding VersionInfo.Tag}" Grid.Row="1" <Label Content="{Binding VersionInfo.Tag}" Grid.Row="1"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Top" VerticalAlignment="Top"
Background="{StaticResource SPT_Brush_Yellow}" Background="{DynamicResource AccentBrush}"
Foreground="{StaticResource SPT_Brush_DarkGrayBlue}" Foreground="DarkSlateGray"
FontWeight="SemiBold" FontWeight="SemiBold"
CornerRadius="0 0 5 5" CornerRadius="0 0 5 5"
Margin="10 0" Margin="10 0"

View File

@ -19,32 +19,27 @@
<!-- Active Mods List Header --> <!-- Active Mods List Header -->
<Border Grid.Row="3" Grid.Column="1" <Border Grid.Row="3" Grid.Column="1"
CornerRadius="5" Classes="card"
Background="{StaticResource SPT_Background_Dark}"> >
<StackPanel Spacing="2" Margin="10"> <StackPanel Spacing="2" Margin="10">
<!-- Active mods count and text --> <!-- Active mods count and text -->
<Label VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Label.Content> <Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=active_server_mods}"/>
<MultiBinding StringFormat="{}{0}: {1}"> <Label Content="{Binding ModsCollection.ActiveMods.Count}" Classes="acc"/>
<Binding Source="{x:Static helpers:LocalizationProvider.Instance}" Path="active_server_mods"/> </StackPanel>
<Binding Path="ModsCollection.ActiveMods.Count"/>
</MultiBinding>
</Label.Content>
</Label>
<!-- Active mods info text --> <!-- Active mods info text -->
<TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=active_server_mods_info_text}" <TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=active_server_mods_info_text}"
VerticalAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="12" FontSize="12"
TextWrapping="Wrap" TextWrapping="Wrap"
Foreground="{StaticResource SPT_Foreground_Light}" Classes="alt"/>
/>
</StackPanel> </StackPanel>
</Border> </Border>
<!-- Active Mods List --> <!-- Active Mods List -->
<ScrollViewer Grid.Row="5" Grid.Column="1"> <ScrollViewer Grid.Row="5" Grid.Column="1">
<ItemsControl Items="{Binding ModsCollection.ActiveMods}"> <ItemsControl ItemsSource="{Binding ModsCollection.ActiveMods}">
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type launcher:SPTMod}"> <DataTemplate DataType="{x:Type launcher:SPTMod}">
<cc:ModInfoCard ModName="{Binding Name}" <cc:ModInfoCard ModName="{Binding Name}"
@ -62,31 +57,27 @@
<!-- Inactive Mods List Header --> <!-- Inactive Mods List Header -->
<Border Grid.Row="3" Grid.Column="3" <Border Grid.Row="3" Grid.Column="3"
CornerRadius="5" Classes="card"
Background="{StaticResource SPT_Background_Dark}"> >
<StackPanel Spacing="2" Margin="10"> <StackPanel Spacing="2" Margin="10">
<!-- Inactive mods count and text --> <!-- Inactive mods count and text -->
<Label VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="16"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Label.Content> <Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=inactive_server_mods}"/>
<MultiBinding StringFormat="{}{0}: {1}"> <Label Content="{Binding ModsCollection.InactiveMods.Count}" Classes="acc"/>
<Binding Source="{x:Static helpers:LocalizationProvider.Instance}" Path="inactive_server_mods"/> </StackPanel>
<Binding Path="ModsCollection.InactiveMods.Count"/>
</MultiBinding>
</Label.Content>
</Label>
<!-- Inactive mods info text --> <!-- Inactive mods info text -->
<TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=inactive_server_mods_info_text}" <TextBlock Text="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=inactive_server_mods_info_text}"
VerticalAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="12" FontSize="12"
TextWrapping="Wrap" TextWrapping="Wrap"
Foreground="{StaticResource SPT_Foreground_Light}" Classes="alt"
/> />
</StackPanel> </StackPanel>
</Border> </Border>
<!-- Inactive Mods List --> <!-- Inactive Mods List -->
<ScrollViewer Grid.Row="5" Grid.Column="3" > <ScrollViewer Grid.Row="5" Grid.Column="3" >
<ItemsControl Items="{Binding ModsCollection.InactiveMods}"> <ItemsControl ItemsSource="{Binding ModsCollection.InactiveMods}">
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type launcher:SPTMod}"> <DataTemplate DataType="{x:Type launcher:SPTMod}">
<cc:ModInfoCard ModName="{Binding Name}" <cc:ModInfoCard ModName="{Binding Name}"

View File

@ -6,7 +6,7 @@
x:Class="SPT.Launcher.Views.Notifications.SPTNotificationView" x:Class="SPT.Launcher.Views.Notifications.SPTNotificationView"
> >
<Border Padding="12" MinHeight="20" Background="{StaticResource SPT_Background_Dark}" <Border Padding="12" MinHeight="20" Background="{DynamicResource BackgroundBrush}"
BorderBrush="{Binding BarColor}" BorderBrush="{Binding BarColor}"
BorderThickness="3 0 0 0"> BorderThickness="3 0 0 0">
<Grid> <Grid>

View File

@ -2,148 +2,36 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:helpers="using:SPT.Launcher.Helpers" xmlns:cc="using:SPT.Launcher.CustomControls"
xmlns:cvt="using:SPT.Launcher.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SPT.Launcher.Views.ProfileView"> x:Class="SPT.Launcher.Views.ProfileView">
<UserControl.Resources>
<cvt:ImageSourceConverter x:Key="imageSourceCvt" />
</UserControl.Resources>
<Grid RowDefinitions="10,AUTO,10,AUTO,10,*,10,AUTO,10" ColumnDefinitions="10,AUTO,10,*,10"> <Grid RowDefinitions="10,AUTO,10,AUTO,10,*,10,AUTO,10" ColumnDefinitions="10,AUTO,10,*,10">
<!-- profile info --> <!-- profile info -->
<Border Grid.Row="1" Grid.Column="1" CornerRadius="5" <cc:ProfileCard Grid.Row="1" Grid.Column="1"
BorderBrush="{StaticResource SPT_Background_Dark}" ProfileInfo="{Binding ProfileInfo}"
BorderThickness="5"> CurrentEdition="{Binding CurrentEdition}"
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,AUTO,10" ColumnDefinitions="10,AUTO,*,10" CurrentId="{Binding CurrentId}"
Background="{StaticResource SPT_Background_Dark}"> WipeProfileOnStart="{Binding WipeProfileOnStart}"
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1"> ProfileWipePending="{Binding ProfileWipePending}"
<Label Content="{Binding CurrentUsername}" Margin="5 0" /> CopyCommand="{Binding CopyCommand}"
ChangeEditionCommand="{Binding ChangeEditionCommand}"
<!-- profile name and version --> RemoveProfileCommand="{Binding RemoveProfileCommand}"
<Label x:Name="SPTVersion" />
Background="Transparent"
ToolTip.Tip="{Binding ProfileInfo.MismatchMessage}"
Classes.versionMismatch="{Binding ProfileInfo.VersionMismatch}">
<StackPanel Orientation="Horizontal" Background="Transparent">
<TextBlock Text="{Binding ProfileInfo.SPT.version}" />
<Path Data="{StaticResource Info}"
Fill="{Binding ElementName=SPTVersion, Path=Foreground}"
Margin="10 0"
IsVisible="{Binding ProfileInfo.VersionMismatch}" />
</StackPanel>
</Label>
</StackPanel>
<!-- delete profile button -->
<Button HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2"
Classes="icon"
Command="{Binding RemoveProfileCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}">
<Path Data="{StaticResource Delete}" Fill="IndianRed" />
</Button>
<!-- profile id button -->
<Button Content="{Binding CurrentID}" Classes="link"
Grid.Row="2" Grid.Column="1"
Command="{Binding CopyCommand}"
CommandParameter="{Binding CurrentID}" />
<!-- profile edition button -->
<Button Content="{Binding CurrentEdition}" Classes="link"
Grid.Row="3" Grid.Column="1"
Command="{Binding ChangeEditionCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}" />
<!-- wipe profile checkbox -->
<CheckBox
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=wipe_on_start}"
Grid.Row="4" Grid.Column="1"
IsChecked="{Binding WipeProfileOnStart}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
IsVisible="{Binding !ProfileWipePending}" />
</Grid>
</Border>
<!-- Total Mods Info --> <!-- Total Mods Info -->
<Border Grid.Row="3" Grid.Column="1" CornerRadius="5" <cc:TotalModsCard Grid.Row="3" Grid.Column="1"
BorderBrush="{StaticResource SPT_Background_Dark}" ActiveModsCount="{Binding ModInfoCollection.ActiveMods.Count}"
BorderThickness="5" IsVisible="{Binding ModInfoCollection.HasMods}"> OpenModsInfoCommand="{Binding OpenModsInfoCommand}"
<Grid RowDefinitions="10,AUTO,10" ColumnDefinitions="10,Auto,*,AUTO,10" />
Background="{StaticResource SPT_Background_Dark}">
<!-- server mods count text -->
<Label Grid.Row="1" Grid.Column="1">
<Label.Content>
<MultiBinding StringFormat="{}{0}: {1}">
<Binding Source="{x:Static helpers:LocalizationProvider.Instance}" Path="active_server_mods"/>
<Binding Path="ModInfoCollection.ActiveMods.Count"/>
</MultiBinding>
</Label.Content>
</Label>
<!-- Show mods info view button -->
<Button Grid.Row="0" Grid.RowSpan="3" Grid.Column="3" Grid.ColumnSpan="2"
VerticalAlignment="Stretch" FontSize="18" Margin="10 0 0 0"
Command="{Binding OpenModsInfoCommand}"
Classes="icon">
<Button.Content>
<Path Data="{StaticResource Open}" Fill="{StaticResource SPT_Foreground_Light}"
VerticalAlignment="Center"
/>
</Button.Content>
</Button>
</Grid>
</Border>
<!-- Bottom bar --> <!-- Game bar -->
<Border Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3" CornerRadius="5" <cc:GameLaunchBar Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3"
BorderBrush="{StaticResource SPT_Background_Dark}" ProfileInfo="{Binding ProfileInfo}"
BorderThickness="5"> StartGameCommand="{Binding StartGameCommand}"
<DockPanel Background="{StaticResource SPT_Background_Dark}"> LogoutCommand="{Binding LogoutCommand}"
/>
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Stretch"
Spacing="10"
IsVisible="{Binding ProfileInfo.HasData}">
<Grid RowDefinitions="AUTO,AUTO" ColumnDefinitions="AUTO,AUTO">
<Image Source="{Binding SideImage.Path, Converter={StaticResource imageSourceCvt}}"
Grid.RowSpan="2" Height="40" Margin="10 0" />
<Label Content="{Binding ProfileInfo.Nickname}" Grid.Row="0" Grid.Column="2" />
<Label Content="{Binding ProfileInfo.Side}" Grid.Row="1" Grid.Column="2" />
</Grid>
<Label Content="{Binding ProfileInfo.Level}" VerticalAlignment="Center"
FontSize="22" />
<ProgressBar Value="{Binding ProfileInfo.XPLevelProgress}" />
<StackPanel>
<Label
Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=next_level_in}"
HorizontalAlignment="Center" />
<Label Content="{Binding ProfileInfo.RemainingExp, StringFormat={}{0} xp}"
HorizontalAlignment="Center" />
</StackPanel>
</StackPanel>
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=start_game}"
HorizontalAlignment="Right"
VerticalContentAlignment="Center"
VerticalAlignment="Stretch"
DockPanel.Dock="Right"
Command="{Binding StartGameCommand}"
IsEnabled="{Binding Source={x:Static helpers:LauncherSettingsProvider.Instance}, Path=!GameRunning}"
Classes="yellow" />
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=logout}"
Command="{Binding LogoutCommand}"
Margin="10 0"
Classes="link"
DockPanel.Dock="Right"
HorizontalAlignment="Right" />
</DockPanel>
</Border>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -11,29 +11,29 @@
<Grid RowDefinitions="10,AUTO,AUTO,*, AUTO, AUTO, AUTO,10" ColumnDefinitions="10,2*,2*,AUTO,10"> <Grid RowDefinitions="10,AUTO,AUTO,*, AUTO, AUTO, AUTO,10" ColumnDefinitions="10,2*,2*,AUTO,10">
<!-- Backdrop --> <!-- Backdrop -->
<Rectangle Fill="{StaticResource SPT_Background_Dark}" <Rectangle Fill="{DynamicResource BackgroundBrush}"
Grid.RowSpan="7" Grid.ColumnSpan="5" Grid.RowSpan="7" Grid.ColumnSpan="5"
Opacity=".7" Opacity=".7"
/> />
<WrapPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal"> <WrapPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=remove_registry_keys}" <Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=remove_registry_keys}"
Command="{Binding RemoveRegistryKeysCommand}" Command="{Binding RemoveRegistryKeysCommand}"
Classes="borderedlink" Classes="outlined"
Margin="0 0 10 5" Margin="0 0 10 5"
/> />
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=load_live_settings}" <Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=load_live_settings}"
Command="{Binding ResetGameSettingsCommand}" Command="{Binding ResetGameSettingsCommand}"
Classes="borderedlink" Classes="outlined"
Margin="0 0 10 5" Margin="0 0 10 5"
/> />
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=clear_game_settings}" <Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=clear_game_settings}"
Command="{Binding ClearGameSettingsCommand}" Command="{Binding ClearGameSettingsCommand}"
Classes="borderedlink" Classes="outlined"
Margin="0 0 10 5" Margin="0 0 10 5"
/> />
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=clean_temp_files}" <Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=clean_temp_files}"
Command="{Binding CleanTempFilesCommand}" Command="{Binding CleanTempFilesCommand}"
Classes="borderedlink" Classes="outlined"
Margin="0 0 10 5" Margin="0 0 10 5"
/> />
</WrapPanel> </WrapPanel>
@ -50,9 +50,9 @@
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=default_language}" <Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=default_language}"
/> />
<!-- LocaleCollection reloads the locale from file when the selected loacle changes --> <!-- LocaleCollection reloads the locale from file when the selected loacle changes -->
<ComboBox Items="{Binding Locales.AvailableLocales}" MinWidth="200" <ComboBox ItemsSource="{Binding Locales.AvailableLocales}" MinWidth="200"
SelectedItem="{Binding Locales.SelectedLocale, Mode=TwoWay}" SelectedItem="{Binding Locales.SelectedLocale, Mode=TwoWay}"
/> />
</StackPanel> </StackPanel>
<!-- Game Start Action --> <!-- Game Start Action -->