diff --git a/Needlework.Net/App.axaml b/Needlework.Net/App.axaml index 02d7a64..a0e5438 100644 --- a/Needlework.Net/App.axaml +++ b/Needlework.Net/App.axaml @@ -15,6 +15,7 @@ + diff --git a/Needlework.Net/Assets/Users/sylv.jpg b/Needlework.Net/Assets/Users/sylv.jpg new file mode 100644 index 0000000..62a9eda Binary files /dev/null and b/Needlework.Net/Assets/Users/sylv.jpg differ diff --git a/Needlework.Net/Controls/UserCard.axaml b/Needlework.Net/Controls/UserCard.axaml new file mode 100644 index 0000000..e979822 --- /dev/null +++ b/Needlework.Net/Controls/UserCard.axaml @@ -0,0 +1,71 @@ + + + + + Needlework.Net is the .NET rewrite of Needlework. This tool was made to help others with LCU and Game Client development. Feel free to ask any questions + or help contribute to the project! Made with love. 💜 + + + + + diff --git a/Needlework.Net/Controls/UserCard.axaml.cs b/Needlework.Net/Controls/UserCard.axaml.cs new file mode 100644 index 0000000..8f683f4 --- /dev/null +++ b/Needlework.Net/Controls/UserCard.axaml.cs @@ -0,0 +1,91 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.Metadata; +using Avalonia.Controls.Primitives; +using Avalonia.Interactivity; +using Avalonia.Media; +using System.Diagnostics; + +namespace Needlework.Net.Controls; + +[TemplatePart("PART_GithubButton", typeof(Button))] +public partial class UserCard : ContentControl +{ + private Button? _githubButton; + + public UserCard() + { + UserImageMargin = new(0, !double.IsNaN(Height) ? 100 - Height : 0, 0, 0); + } + + public static readonly StyledProperty UserImageProperty = + AvaloniaProperty.Register(nameof(UserImage), defaultValue: null); + + public IImage? UserImage + { + get { return GetValue(UserImageProperty); } + set { SetValue(UserImageProperty, value); } + } + + public static readonly StyledProperty UserNameProperty = + AvaloniaProperty.Register(nameof(UserName), defaultValue: null); + + public string? UserName + { + get { return GetValue(UserNameProperty); } + set { SetValue(UserNameProperty, value); } + } + + public static readonly StyledProperty UserGithubProperty = + AvaloniaProperty.Register(nameof(UserGithub), defaultValue: null); + + public string? UserGithub + { + get { return GetValue(UserGithubProperty); } + set { SetValue(UserGithubProperty, value); } + } + + public static readonly DirectProperty UserImageMarginProperty = + AvaloniaProperty.RegisterDirect(nameof(UserImageMargin), o => o.UserImageMargin); + + private Thickness _userImageMargin = new(0, 0, 0, 0); + + public Thickness UserImageMargin + { + get { return _userImageMargin; } + private set { SetAndRaise(UserImageMarginProperty, ref _userImageMargin, value); } + } + + protected override void OnApplyTemplate(TemplateAppliedEventArgs e) + { + base.OnApplyTemplate(e); + + SizeChanged += UserCard_SizeChanged; + + if (_githubButton != null) + { + _githubButton.Click -= GithubButton_Click; + } + + _githubButton = e.NameScope.Find("PART_GithubButton") as Button; + + if (_githubButton != null) + { + _githubButton.Click += GithubButton_Click; + } + } + + private void UserCard_SizeChanged(object? sender, SizeChangedEventArgs e) + { + UserImageMargin = new(0, !double.IsNaN(e.NewSize.Height) ? 100 - e.NewSize.Height : 0, 0, 0); + } + + private void GithubButton_Click(object? sender, RoutedEventArgs e) + { + var process = new Process() + { + StartInfo = new ProcessStartInfo($"https://github.com/{UserGithub}") { UseShellExecute = true } + }; + process.Start(); + } +} \ No newline at end of file diff --git a/Needlework.Net/Views/Pages/AboutView.axaml b/Needlework.Net/Views/Pages/AboutView.axaml index beea255..c049c74 100644 --- a/Needlework.Net/Views/Pages/AboutView.axaml +++ b/Needlework.Net/Views/Pages/AboutView.axaml @@ -8,160 +8,41 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Needlework.Net.Views.Pages.AboutView" x:DataType="vm:AboutViewModel"> - - - - - - - - - - - - - - - Blossomi Shymae - - - - - - About - - Needlework.Net is the .NET rewrite of Needlework. This tool was made to help others with LCU development. Feel free to ask any questions - or help contribute to the project! Made with love. 💜 - - - - - - - - Thanks to the friends and people who made this tool possible... - - - - - - - - - - dysolix - - - - - - - For providing and hosting an auto-generated OpenAPI document of the LCU. - - - - - - - - - - - - - Ray - - - - - - - For guidance, advice, or providing help via HextechDocs. - - - - - - - - - - - - - dubble - - - - - - - For encouraging me to publish Needlework. This project may never have seen the light of day without him. - - - - - - - - - - - - - Third Party Developer Community - - - - - - For providing numerous documentation on the LCU. - - - - - - - - + + + + + + + Needlework.Net is the .NET rewrite of Needlework. This tool was made to help others with LCU and Game Client development. Feel free to ask any questions + or help contribute to the project! Made with love. 💜 + + + For providing LCU Schema, the auto-generated OpenAPI document for the LCU. + + + For providing a fixed up-to-date Game Client schema. + + + For guidance, advice, and providing help via HextechDocs. + + + For encouraging me to publish Needlework.Net and other ideas. + + +