From 0963264dfe099fe955e1d4eb87e2deaf64d93d0b Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Sat, 6 Jul 2024 11:48:16 -0400 Subject: [PATCH 1/6] update to avalonia 11 --- .../SPT.Launcher.Base.csproj | 2 +- project/SPT.Launcher/App.axaml | 6 +- project/SPT.Launcher/Assets/Styles.axaml | 89 +++++++++---------- .../LocalizedLauncherActionSelector.axaml.cs | 2 +- .../Models/GameStarterFrontend.cs | 3 +- project/SPT.Launcher/SPT.Launcher.csproj | 9 +- project/SPT.Launcher/ViewLocator.cs | 2 +- .../ViewModels/MainWindowViewModel.cs | 4 +- .../ViewModels/ProfileViewModel.cs | 10 ++- .../SPT.Launcher/ViewModels/ViewModelBase.cs | 4 +- .../Dialogs/ChangeEditionDialogView.axaml | 4 +- .../Dialogs/ConfirmationDialogView.axaml | 2 +- .../Views/Dialogs/RegisterDialogView.axaml | 16 ++-- .../Views/Dialogs/WarningDialogView.axaml | 2 +- project/SPT.Launcher/Views/LoginView.axaml | 6 +- project/SPT.Launcher/Views/MainWindow.axaml | 2 +- project/SPT.Launcher/Views/ModInfoView.axaml | 4 +- project/SPT.Launcher/Views/SettingsView.axaml | 4 +- 18 files changed, 89 insertions(+), 82 deletions(-) diff --git a/project/SPT.Launcher.Base/SPT.Launcher.Base.csproj b/project/SPT.Launcher.Base/SPT.Launcher.Base.csproj index 5c039d0..d7cf473 100644 --- a/project/SPT.Launcher.Base/SPT.Launcher.Base.csproj +++ b/project/SPT.Launcher.Base/SPT.Launcher.Base.csproj @@ -13,7 +13,7 @@ - + diff --git a/project/SPT.Launcher/App.axaml b/project/SPT.Launcher/App.axaml index 5377cca..24e5d27 100644 --- a/project/SPT.Launcher/App.axaml +++ b/project/SPT.Launcher/App.axaml @@ -1,14 +1,16 @@ + x:Class="SPT.Launcher.App" + RequestedThemeVariant="Dark" + > - + diff --git a/project/SPT.Launcher/Assets/Styles.axaml b/project/SPT.Launcher/Assets/Styles.axaml index 8f31d4f..dc7083f 100644 --- a/project/SPT.Launcher/Assets/Styles.axaml +++ b/project/SPT.Launcher/Assets/Styles.axaml @@ -1,7 +1,6 @@  @@ -17,8 +16,8 @@ @@ -41,48 +40,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + - - + - + - + - + - + - + - + - + - - - - - - + - + - - + - + - - - + - + - - - - - - - + + + + + - + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - \ No newline at end of file diff --git a/project/SPT.Launcher/CustomControls/ModInfoCard.axaml b/project/SPT.Launcher/CustomControls/ModInfoCard.axaml index dd4fadc..da535d1 100644 --- a/project/SPT.Launcher/CustomControls/ModInfoCard.axaml +++ b/project/SPT.Launcher/CustomControls/ModInfoCard.axaml @@ -6,11 +6,11 @@ xmlns:helpers="using:SPT.Launcher.Helpers" x:Class="SPT.Launcher.CustomControls.ModInfoCard"> @@ -19,12 +19,12 @@ Orientation="Horizontal" Spacing="5" > - - @@ -54,7 +54,7 @@ > diff --git a/project/SPT.Launcher/CustomControls/TitleBar.axaml b/project/SPT.Launcher/CustomControls/TitleBar.axaml index 86179b4..988b156 100644 --- a/project/SPT.Launcher/CustomControls/TitleBar.axaml +++ b/project/SPT.Launcher/CustomControls/TitleBar.axaml @@ -55,12 +55,12 @@ > - + + + diff --git a/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml b/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml index 0da8f40..28522b7 100644 --- a/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml +++ b/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml @@ -7,7 +7,8 @@ xmlns:s="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="SPT.Launcher.Views.Dialogs.ChangeEditionDialogView" - Background="{StaticResource SPT_Background_Dark}"> + Background="{DynamicResource BackgroundBrush}" + > @@ -31,7 +32,7 @@ diff --git a/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml b/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml index 0da8f40..28522b7 100644 --- a/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml +++ b/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml @@ -7,7 +7,8 @@ xmlns:s="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="SPT.Launcher.Views.Dialogs.ChangeEditionDialogView" - Background="{StaticResource SPT_Background_Dark}"> + Background="{DynamicResource BackgroundBrush}" + > @@ -31,7 +32,7 @@ + + + diff --git a/project/SPT.Launcher/CustomControls/TotalModsCard.axaml b/project/SPT.Launcher/CustomControls/TotalModsCard.axaml new file mode 100644 index 0000000..e31b467 --- /dev/null +++ b/project/SPT.Launcher/CustomControls/TotalModsCard.axaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + diff --git a/project/SPT.Launcher/CustomControls/TotalModsCard.axaml.cs b/project/SPT.Launcher/CustomControls/TotalModsCard.axaml.cs new file mode 100644 index 0000000..5da6cf4 --- /dev/null +++ b/project/SPT.Launcher/CustomControls/TotalModsCard.axaml.cs @@ -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 ActiveModsCountProperty = AvaloniaProperty.Register( + "ActiveModsCount"); + + public int ActiveModsCount + { + get => GetValue(ActiveModsCountProperty); + set => SetValue(ActiveModsCountProperty, value); + } + + public static readonly StyledProperty OpenModsInfoCommandProperty = AvaloniaProperty.Register( + "OpenModsInfoCommand"); + + public ICommand OpenModsInfoCommand + { + get => GetValue(OpenModsInfoCommandProperty); + set => SetValue(OpenModsInfoCommandProperty, value); + } +} \ No newline at end of file diff --git a/project/SPT.Launcher/ViewModels/ProfileViewModel.cs b/project/SPT.Launcher/ViewModels/ProfileViewModel.cs index fa8db2f..59e8c4a 100644 --- a/project/SPT.Launcher/ViewModels/ProfileViewModel.cs +++ b/project/SPT.Launcher/ViewModels/ProfileViewModel.cs @@ -18,8 +18,8 @@ namespace SPT.Launcher.ViewModels [RequireLoggedIn] public class ProfileViewModel : ViewModelBase { - public string CurrentUsername { get; set; } - + // public string CurrentUsername { get; set; } + private string _CurrentEdition; public string CurrentEdition { @@ -41,7 +41,7 @@ namespace SPT.Launcher.ViewModels set => this.RaiseAndSetIfChanged(ref _ProfileWipePending, value); } - public string CurrentID { get; set; } + public string CurrentId { get; set; } public ProfileInfo ProfileInfo { get; set; } = AccountManager.SelectedProfileInfo; @@ -49,9 +49,9 @@ namespace SPT.Launcher.ViewModels 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) { @@ -63,13 +63,13 @@ namespace SPT.Launcher.ViewModels 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; - CurrentID = AccountManager.SelectedAccount.id; + CurrentId = AccountManager.SelectedAccount.id; } private async Task GameVersionCheck() @@ -155,11 +155,11 @@ namespace SPT.Launcher.ViewModels 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) { - monitor.Start(); + _monitor.Start(); switch (LauncherSettingsProvider.Instance.LauncherStartGameAction) { diff --git a/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml b/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml index 28522b7..a81ecfa 100644 --- a/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml +++ b/project/SPT.Launcher/Views/Dialogs/ChangeEditionDialogView.axaml @@ -23,7 +23,7 @@ > - @@ -32,7 +32,7 @@ - - - - - + - - - - - - - - - - - -