From 83a7b8e4473a261c11c50ce61c7e1469a61af541 Mon Sep 17 00:00:00 2001 From: Anton Terentev <111225722+GamerVII-NET@users.noreply.github.com> Date: Sat, 13 Jul 2024 19:05:05 +0300 Subject: [PATCH] Summary of Recent Changes and Updates in the Project beta2 (#37) 1. **Update host URL in ResourceKeysDictionary** - The host URL used in the ResourceKeysDictionary file has been updated from a local address to a production address. Additionally, a minor formatting change was made in the OverviewPageViewModel file. 2. **Update submodule link Gml.Client** 3. **Replace submodule update with git clone in scripts** - The git submodule update command in both the 'load-repositories.sh' and 'load-repositories.bat' scripts has been replaced with git clone. This allows for repositories 'GamerVII.Notification.Avalonia' and 'Gml.Client' to be cloned directly instead of being updated through submodules. 4. **Update system service, resources, and application UI** - The system service has been updated to asynchronously load system data. Additional resource keys and corresponding translations have been added to the localization service. Several changes have been made to the application user interface including a new splash screen, application icon, and version number. 5. **Add error tracking to AsyncStreamToImageLoader** - The update wraps the core logic of the OnSourceChanged method inside a try-catch block. In case of any exceptions during execution, they are captured and sent to Sentry for error tracking and troubleshooting. This ensures smoother runtime and easier debugging. 6. **Update host URL and clean up code** - The host URL in the ResourceKeysDictionary file was changed from a local IP address to an external URL "https://gmlb.recloud.tech". 7. **Gif background functionality (#29)** - Introduced several new classes to handle the decoding of GIF files. This includes reading the data stream and processing headers, frames, color tables, and extensions. Functionality for rendering frames and handling exceptions has also been implemented. 8. **Refactor code and optimize exceptions in gif decoder** - Code for gif decoding has been refactored for improved readability and efficiency. The exception handling has been optimized for specific errors, such as LzwDecompressionException, contributing to better error reporting and debugging. Unnecessary comments and code have also been removed. 9. **Remove unnecessary whitespace in AsyncStreamToImageLoader** - This commit eliminates a redundant line in the AsyncStreamToImageLoader class file. The change helps to maintain the cleanliness and readability of the code. 10. **Refactor LoginPageViewModel and update AsyncStreamToImageLoader** - This commit refactors LoginPageViewModel to change the type of _screen from IScreen to MainWindowViewModel. This allows the app to subscribe to the 'OnClosed' event of the main window, and dispose of connections when the window is closed to prevent memory leaks. AsyncStreamToImageLoader has also been updated to clear avatar image classes upfront and enhance filename checking mechanism to prevent non-loaded images. 11. **Update background component in MainWindow** - Updated the background image's component in MainWindow.axaml file. Added a class attribute, which can be used for styling or Javascript manipulation in the future. 12. **Remove invalid character from document.svg** - The first character of the document.svg file in the Gml.Launcher/Assets/Images directory was an invalid character and is now removed. This fix ensures that the SVG file is correctly formed and interprets as expected. 13. **Add 'launcher' project and comment out language combo box** - Added a new 'launcher' project to the Gml.Launcher.sln file and made adjustments to project settings for consistency. Additionally, commented out the language selection combo box in the SettingsPageView.axaml as it is currently not in use. 14. **Switch host and update debugging settings** - Furthermore, the debugging settings in App.axaml.cs have been updated to not debug mode, and the return value in case of null 'actualVersion' has been set to true in SplashScreenViewModel.cs. 15. **Optimize system data loading process** - The previous implementation executed the tasks for refreshing the drive, motherboard, and CPU lists sequentially. This was unnecessarily time-consuming. With the new implementation, these tasks are run concurrently using Task.WhenAll method for better performance and efficiency. 16. **Change execution context for MainWindow in debug mode** - This update modifies the execution context for MainWindow in the Gml.Launcher App. Previously, it was running in non-debug mode. Now, it is set up to run in debug mode. 17. **Disable window resizing and update pointer events handling** - A new property `CanResize=False` has been added to the MainWindow.axaml to prevent the window from being resized. The pointer events handling logic was moved from OverviewPageView to MainWindow. This was done to ensure better control over dragging behavior and to prevent inappropriate actions during specific interactions. 18. **Update settings validation for window size** - Improved the validation and error-handling approach for setting window size parameters. Now, the windowWidth and windowHeight values are only updated when numeric values are provided. If non-numeric values are input, they will be reset to default. 19. **Remove commented out code in MainWindow.axaml.cs** 20. **Added default font** 21. **Update font styles and host URL** - This commit updates the font styles across several components, improving text readability and consistency. It also switches the host URL in the ResourceKeysDictionary to a production-ready address. 22. **Add new game session management and enhance game profile features** - Enhanced game profile features by adding support for system types, file and profile session handling functionalities. Changes in the IGameProfile interface allow for game sessions to be locally stored and accessed. Introduced ProfileState type in the ProfileState enum. Also updated functionality to include OS specifics in process creation. This update increases compatibility across different systems and aids in clearer session management. 23. **Refactor code for skin rendering and noise string conversion** - Specifically, the update handles question mark in the value for noise string conversion and it also removes unnecessary spaces in ProfilePageView.axaml. Moreover, unnecessary comments in ProfilePageViewModel.cs are cleaned up and HTTP header in skin rendering is updated to include User-Agent information. 24. **Update ProfileUserControl design** - Changed the default skin URL to a new one, adjusted image and text alignment, and increased opacity of the profile gradient. 25. **Refactor client module for improved readability** - Refactored the Gml.Client module to enhance code readability and maintainability. This involved restructuring functions, renaming variables for clarity, and adding comments where necessary. No functional changes were made to ensure existing behavior is preserved. 26. **Add architecture check in splash screen initialization** - Updated SplashScreenViewModel to include the process architecture in version checks. This helps ensure the correct software version is retrieved based on both OS type and architecture. 27. **Update settings handling in OverviewPageViewModel** - Change default settings handling in `OverviewPageViewModel` to use `SettingsInfo.Default` when no settings are found. Add screen dimensions and full-screen settings to profile creation details. 28. **Enhance process restart commands for Linux and Windows** - Updated the process restart commands to properly handle filenames with spaces or special characters on both Linux and Windows. For Linux, enclosed filenames within single quotes and adjusted the process start command. For Windows, added double quotes around filenames to ensure proper execution. 29. **Refactor method names and update host URL** - Renamed the method `PrepareLaunch` to `GetProfileInfo` for better clarity. Also, switched the host URL to the production endpoint in the ResourceKeysDictionary file. Commented out sample profile info in ProfileInfoComponent for a cleaner initialization. 30. **Update client processing logic.** - Refactor the existing client-side logic to improve performance and readability. Adjust function naming and streamline data handling to reduce complexity. 31. **Add online player component and Java not found error handler** - Introduced a new UI component to display online server player counts and added corresponding localization entries. Also, included error handling for missing Java installations, displaying appropriate localized messages. 32. **Switch ProfileUserControl to ItemsControl and add Spacing** - Updated ProfileUserControl from TemplatedControl to ItemsControl to support dynamic item presentations. Introduced a new Spacing property to allow custom spacing between items. Additionally, moved ProfileInfoComponent and GmlButton from the UserControl template to the ProfilePageView for better separation of concerns. 33. **Add URL redirect attached property** - Introduce `UrlRedirectProperty` to handle URL redirections in controls. This property changes start a process to open the URL with the default system browser, enhancing the app's interactivity. 34. **Add additional button and group ProfilePageView buttons** - Reorganized the buttons on the ProfilePageView into a horizontal stack panel, adding a new Icon Additional button alongside the existing TextIcon Primary button. Both buttons execute the OpenLinkCommand with the same URL but have distinct visual styles. --- src/Gml.Client | 2 +- src/Gml.Launcher/App.axaml | 1 + src/Gml.Launcher/Assets/Images/users.svg | 8 +++ .../ResourceKeysDictionary.Template.cs | 1 + .../Resources/ResourceKeysDictionary.cs | 5 +- .../Assets/Resources/Resources.Designer.cs | 16 +++++ .../Assets/Resources/Resources.en.resx | 9 +++ .../Assets/Resources/Resources.resx | 9 +++ .../Assets/Resources/Resources.ru.resx | 9 +++ .../Converters/SumServersOnlineConverter.cs | 32 ++++++++++ .../Core/Converters/UrlRedirectProperty.cs | 30 +++++++++ src/Gml.Launcher/Models/SettingsInfo.cs | 2 + .../ViewModels/Pages/OverviewPageViewModel.cs | 24 ++++--- .../ViewModels/SplashScreenViewModel.cs | 9 ++- .../Views/Components/OnlineComponent.axaml | 64 +++++++++++++++++++ .../Views/Components/OnlineComponent.axaml.cs | 18 ++++++ .../Components/ProfileInfoComponent.axaml.cs | 8 +-- .../Views/Components/ProfileUserControl.axaml | 9 +-- .../Components/ProfileUserControl.axaml.cs | 19 ++++-- .../Views/Pages/OverviewPageView.axaml | 7 ++ .../Views/Pages/ProfilePageView.axaml | 29 ++++++++- 21 files changed, 277 insertions(+), 34 deletions(-) create mode 100644 src/Gml.Launcher/Assets/Images/users.svg create mode 100644 src/Gml.Launcher/Core/Converters/SumServersOnlineConverter.cs create mode 100644 src/Gml.Launcher/Core/Converters/UrlRedirectProperty.cs create mode 100644 src/Gml.Launcher/Views/Components/OnlineComponent.axaml create mode 100644 src/Gml.Launcher/Views/Components/OnlineComponent.axaml.cs diff --git a/src/Gml.Client b/src/Gml.Client index a7a7825..70ab8a3 160000 --- a/src/Gml.Client +++ b/src/Gml.Client @@ -1 +1 @@ -Subproject commit a7a782593813b360c0277192a3474f3582c565bc +Subproject commit 70ab8a3bd71c0214416e05d596bb529989eeb567 diff --git a/src/Gml.Launcher/App.axaml b/src/Gml.Launcher/App.axaml index 2bd69a7..863037e 100644 --- a/src/Gml.Launcher/App.axaml +++ b/src/Gml.Launcher/App.axaml @@ -30,6 +30,7 @@ + diff --git a/src/Gml.Launcher/Assets/Images/users.svg b/src/Gml.Launcher/Assets/Images/users.svg new file mode 100644 index 0000000..b8970a1 --- /dev/null +++ b/src/Gml.Launcher/Assets/Images/users.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.Template.cs b/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.Template.cs index 63545cc..6295512 100644 --- a/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.Template.cs +++ b/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.Template.cs @@ -20,6 +20,7 @@ public static class ResourceKeysDictionary public const string CheckUpdates = "CheckUpdates"; public const string InstallingUpdates = "InstallingUpdates"; public const string FailedOs = "FailedOs"; + public const string JavaNotFound = "JavaNotFound"; public const string Host = "{{HOST}}"; public const string FolderName = "{{FOLDER_NAME}}"; } diff --git a/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.cs b/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.cs index 578b9a4..9b77891 100644 --- a/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.cs +++ b/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.cs @@ -20,8 +20,9 @@ public static class ResourceKeysDictionary public const string CheckUpdates = "CheckUpdates"; public const string InstallingUpdates = "InstallingUpdates"; public const string FailedOs = "FailedOs"; - public const string Host = "http://192.168.31.199:5000"; - // public const string Host = "https://gmlb.recloud.tech"; + public const string JavaNotFound = "JavaNotFound"; + // public const string Host = "http://192.168.31.199:5000"; + public const string Host = "https://gmlb.recloud.tech"; // public const string Host = "https://gmlb-test.recloud.tech"; public const string FolderName = "GamerVIILacunerhV2"; } diff --git a/src/Gml.Launcher/Assets/Resources/Resources.Designer.cs b/src/Gml.Launcher/Assets/Resources/Resources.Designer.cs index 6107b98..ef35d1a 100644 --- a/src/Gml.Launcher/Assets/Resources/Resources.Designer.cs +++ b/src/Gml.Launcher/Assets/Resources/Resources.Designer.cs @@ -202,5 +202,21 @@ public static string Available { return ResourceManager.GetString("Available", resourceCulture); } } + /// + /// Ищет локализованную строку, похожую на ProfileNotConfigured. + /// + public static string OnServers { + get { + return ResourceManager.GetString("OnServers", resourceCulture); + } + } + /// + /// Ищет локализованную строку, похожую на ProfileNotConfigured. + /// + public static string PlayersShort { + get { + return ResourceManager.GetString("PlayersShort", resourceCulture); + } + } } } diff --git a/src/Gml.Launcher/Assets/Resources/Resources.en.resx b/src/Gml.Launcher/Assets/Resources/Resources.en.resx index 9b54437..e4546a5 100644 --- a/src/Gml.Launcher/Assets/Resources/Resources.en.resx +++ b/src/Gml.Launcher/Assets/Resources/Resources.en.resx @@ -107,4 +107,13 @@ Failed to determine the operating system + + On servers + + + pl. + + + Unable to detect a loaded Java for your operating system, please contact support or the project administrator. + diff --git a/src/Gml.Launcher/Assets/Resources/Resources.resx b/src/Gml.Launcher/Assets/Resources/Resources.resx index b3e1692..a69dbe2 100644 --- a/src/Gml.Launcher/Assets/Resources/Resources.resx +++ b/src/Gml.Launcher/Assets/Resources/Resources.resx @@ -114,4 +114,13 @@ Failed to determine the operating system + + On servers + + + pl. + + + Unable to detect a loaded Java for your operating system, please contact support or the project administrator. + diff --git a/src/Gml.Launcher/Assets/Resources/Resources.ru.resx b/src/Gml.Launcher/Assets/Resources/Resources.ru.resx index 791bee6..b051bee 100644 --- a/src/Gml.Launcher/Assets/Resources/Resources.ru.resx +++ b/src/Gml.Launcher/Assets/Resources/Resources.ru.resx @@ -107,4 +107,13 @@ Не удалось определить операционную систему + + На серверах + + + чел. + + + Не удалось обнаружить загруженную Java для Вашей операционной системы, обратитесь в поддержку или к администратору проекта + \ No newline at end of file diff --git a/src/Gml.Launcher/Core/Converters/SumServersOnlineConverter.cs b/src/Gml.Launcher/Core/Converters/SumServersOnlineConverter.cs new file mode 100644 index 0000000..d32a61e --- /dev/null +++ b/src/Gml.Launcher/Core/Converters/SumServersOnlineConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Avalonia.Data.Converters; +using Avalonia.Markup.Xaml; +using Gml.Web.Api.Dto.Servers; + +namespace Gml.Launcher.Core.Converters; + +public class SumServersOnlineConverter : MarkupExtension, IValueConverter +{ + public override object ProvideValue(IServiceProvider serviceProvider) => this; + + public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + { + if (value is List server) + { + return server + .Where(c => c.IsOnline) + .Sum(c => c.Online)? + .ToString() ?? "0"; + } + + return "0"; + } + + public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + { + return "0"; + } +} diff --git a/src/Gml.Launcher/Core/Converters/UrlRedirectProperty.cs b/src/Gml.Launcher/Core/Converters/UrlRedirectProperty.cs new file mode 100644 index 0000000..54cdad5 --- /dev/null +++ b/src/Gml.Launcher/Core/Converters/UrlRedirectProperty.cs @@ -0,0 +1,30 @@ +using System.Diagnostics; +using Avalonia; +using Avalonia.Controls; + +namespace Gml.Launcher.Core.Converters; + +public class UrlRedirectProperty +{ + public static readonly AttachedProperty RedirectUrlProperty = + AvaloniaProperty.RegisterAttached("RedirectUrl"); + + public static void SetRedirectUrl(Control obj, string value) => obj.SetValue(RedirectUrlProperty, value); + public static string GetRedirectUrl(Control obj) => obj.GetValue(RedirectUrlProperty); + + public UrlRedirectProperty() + { + RedirectUrlProperty.Changed.AddClassHandler(OnSourceChanged); + } + + private void OnSourceChanged(Control control, AvaloniaPropertyChangedEventArgs args) + { + var url = args.GetNewValue(); + + Process.Start(new ProcessStartInfo + { + FileName = url, + UseShellExecute = true + }); + } +} diff --git a/src/Gml.Launcher/Models/SettingsInfo.cs b/src/Gml.Launcher/Models/SettingsInfo.cs index 34106a6..2c40f16 100644 --- a/src/Gml.Launcher/Models/SettingsInfo.cs +++ b/src/Gml.Launcher/Models/SettingsInfo.cs @@ -2,4 +2,6 @@ public record SettingsInfo(int GameWidth, int GameHeight, bool FullScreen, bool IsDynamicRam, double RamValue, string? LanguageCode) { + public static SettingsInfo Default + => new SettingsInfo(900, 600, false, true, 0, "ru-RU"); } diff --git a/src/Gml.Launcher/ViewModels/Pages/OverviewPageViewModel.cs b/src/Gml.Launcher/ViewModels/Pages/OverviewPageViewModel.cs index f60ad0b..1c72c39 100644 --- a/src/Gml.Launcher/ViewModels/Pages/OverviewPageViewModel.cs +++ b/src/Gml.Launcher/ViewModels/Pages/OverviewPageViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Collections.ObjectModel; using System.Diagnostics; +using System.IO; using System.Linq; using System.Net.Http; using System.Reactive.Concurrency; @@ -130,7 +131,7 @@ await ExecuteFromNewThread(async () => { try { - var profileInfo = await PrepareLaunch(); + var profileInfo = await GetProfileInfo(); if (profileInfo is { Data: not null }) { @@ -147,6 +148,12 @@ await ExecuteFromNewThread(async () => ShowError(ResourceKeysDictionary.Error, ResourceKeysDictionary.ProfileNotConfigured); } } + catch (FileNotFoundException exception) + { + ShowError(ResourceKeysDictionary.Error, LocalizationService.GetString(ResourceKeysDictionary.JavaNotFound)); + + Console.WriteLine(exception); + } catch (Exception exception) { ShowError(ResourceKeysDictionary.Error, string.Join(". ", exception.Message)); @@ -191,7 +198,7 @@ private async Task GenerateProcess(CancellationToken cancellationToken, return process; } - private async Task?> PrepareLaunch() + private async Task?> GetProfileInfo() { UpdateProgress( LocalizationService.GetString(ResourceKeysDictionary.Updating), @@ -200,23 +207,20 @@ private async Task GenerateProcess(CancellationToken cancellationToken, await _gmlManager.UpdateDiscordRpcState($"{LocalizationService.GetString(ResourceKeysDictionary.PlayDRpcText)} \"{ListViewModel.SelectedProfile!.Name}\""); - var settings = await _storageService.GetAsync(StorageConstants.Settings); - - if (settings is null) - { - throw new Exception(LocalizationService.GetString(ResourceKeysDictionary.NotSetting)); - } + var settings = await _storageService.GetAsync(StorageConstants.Settings) ?? SettingsInfo.Default; var localProfile = new ProfileCreateInfoDto { ProfileName = ListViewModel.SelectedProfile!.Name, RamSize = Convert.ToInt32(settings.RamValue), - IsFullScreen = false, + IsFullScreen = settings.FullScreen, OsType = ((int)_systemService.GetOsType()).ToString(), OsArchitecture = Environment.Is64BitOperatingSystem ? "64" : "32", UserAccessToken = User.AccessToken, UserName = User.Name, - UserUuid = User.Uuid + UserUuid = User.Uuid, + WindowWidth = settings.GameWidth, + WindowHeight = settings.GameHeight }; var profileInfo = await _gmlManager.GetProfileInfo(localProfile); diff --git a/src/Gml.Launcher/ViewModels/SplashScreenViewModel.cs b/src/Gml.Launcher/ViewModels/SplashScreenViewModel.cs index 91e3eaa..7a80094 100644 --- a/src/Gml.Launcher/ViewModels/SplashScreenViewModel.cs +++ b/src/Gml.Launcher/ViewModels/SplashScreenViewModel.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.IO; using System.Reflection; +using System.Runtime.InteropServices; using System.Threading.Tasks; using Avalonia.Controls.Shapes; using Gml.Client; @@ -46,11 +47,12 @@ public SplashScreenViewModel(ISystemService? systemService = null, IGmlClientMan public async Task InitializeAsync() { var osType = _systemService.GetOsType(); + var osArch = RuntimeInformation.ProcessArchitecture; await _systemService.LoadSystemData(); ChangeState(_localizationService.GetString(ResourceKeysDictionary.CheckUpdates), true); - var versionInfo = await CheckActualVersion(osType); + var versionInfo = await CheckActualVersion(osType, osArch); if (!versionInfo.IsActuallVersion) { @@ -68,9 +70,10 @@ public async Task InitializeAsync() } } - private async Task<(IVersionFile? ActualVersion, bool IsActuallVersion)> CheckActualVersion(OsType osType) + private async Task<(IVersionFile? ActualVersion, bool IsActuallVersion)> CheckActualVersion(OsType osType, + Architecture osArch) { - var actualVersion = await _manager.GetActualVersion(osType); + var actualVersion = await _manager.GetActualVersion(osType, osArch); if (actualVersion is null) { diff --git a/src/Gml.Launcher/Views/Components/OnlineComponent.axaml b/src/Gml.Launcher/Views/Components/OnlineComponent.axaml new file mode 100644 index 0000000..0d69f5f --- /dev/null +++ b/src/Gml.Launcher/Views/Components/OnlineComponent.axaml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + diff --git a/src/Gml.Launcher/Views/Components/OnlineComponent.axaml.cs b/src/Gml.Launcher/Views/Components/OnlineComponent.axaml.cs new file mode 100644 index 0000000..662365f --- /dev/null +++ b/src/Gml.Launcher/Views/Components/OnlineComponent.axaml.cs @@ -0,0 +1,18 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Primitives; + +namespace Gml.Launcher.Views.Components; + +public class OnlineComponent : TemplatedControl +{ + public static readonly StyledProperty OnlineProperty = AvaloniaProperty.Register( + "Online", "0"); + + public string Online + { + get => GetValue(OnlineProperty); + set => SetValue(OnlineProperty, value); + } +} + diff --git a/src/Gml.Launcher/Views/Components/ProfileInfoComponent.axaml.cs b/src/Gml.Launcher/Views/Components/ProfileInfoComponent.axaml.cs index e980aed..51b30af 100644 --- a/src/Gml.Launcher/Views/Components/ProfileInfoComponent.axaml.cs +++ b/src/Gml.Launcher/Views/Components/ProfileInfoComponent.axaml.cs @@ -12,10 +12,10 @@ public class ProfileInfoComponent : TemplatedControl AvaloniaProperty.Register>( nameof(ProfileInfoItems), new List { - new("На проекте", "150 дней"), - new("Наиграно", " 551 час 45 мин"), - new("Баланс", "150 руб."), - new("Группа", "Premium"), + // new("На проекте", "150 дней"), + // new("Наиграно", " 551 час 45 мин"), + // new("Баланс", "150 руб."), + // new("Группа", "Premium"), }); diff --git a/src/Gml.Launcher/Views/Components/ProfileUserControl.axaml b/src/Gml.Launcher/Views/Components/ProfileUserControl.axaml index fc3f4bb..686b388 100644 --- a/src/Gml.Launcher/Views/Components/ProfileUserControl.axaml +++ b/src/Gml.Launcher/Views/Components/ProfileUserControl.axaml @@ -54,14 +54,7 @@ FontWeight="ExtraBlack" /> - - - - + diff --git a/src/Gml.Launcher/Views/Components/ProfileUserControl.axaml.cs b/src/Gml.Launcher/Views/Components/ProfileUserControl.axaml.cs index 19eea98..b48d35b 100644 --- a/src/Gml.Launcher/Views/Components/ProfileUserControl.axaml.cs +++ b/src/Gml.Launcher/Views/Components/ProfileUserControl.axaml.cs @@ -6,18 +6,22 @@ namespace Gml.Launcher.Views.Components; -public class ProfileUserControl : TemplatedControl +public class ProfileUserControl : ItemsControl { + public static readonly StyledProperty SpacingProperty = AvaloniaProperty.Register( + nameof(Spacing)); public static readonly StyledProperty> ProfileInfoItemsProperty = AvaloniaProperty.Register>( nameof(ProfileInfoItems)); - public static readonly StyledProperty SkinUrlProperty = AvaloniaProperty.Register( - nameof(SkinUrl), "https://www.clipartkey.com/mpngs/m/215-2156859_fond-transparent-steve-minecraft.png"); + public static readonly StyledProperty SkinUrlProperty = + AvaloniaProperty.Register( + nameof(SkinUrl), "https://www.clipartkey.com/mpngs/m/215-2156859_fond-transparent-steve-minecraft.png"); - public static readonly StyledProperty UserNameProperty = AvaloniaProperty.Register( - nameof(UserName), "GamerVII"); + public static readonly StyledProperty UserNameProperty = + AvaloniaProperty.Register( + nameof(UserName), "GamerVII"); public string UserName { @@ -37,4 +41,9 @@ public IEnumerable ProfileInfoItems set => SetValue(ProfileInfoItemsProperty, value); } + public int Spacing + { + get => GetValue(SpacingProperty); + set => SetValue(SpacingProperty, value); + } } diff --git a/src/Gml.Launcher/Views/Pages/OverviewPageView.axaml b/src/Gml.Launcher/Views/Pages/OverviewPageView.axaml index 7f5554e..ba9b84a 100644 --- a/src/Gml.Launcher/Views/Pages/OverviewPageView.axaml +++ b/src/Gml.Launcher/Views/Pages/OverviewPageView.axaml @@ -31,6 +31,13 @@ + + + VerticalAlignment="Top"> + + + + + + + + + + +