From d67c57353591c1e27b2eaa07d346b8f790703d4e Mon Sep 17 00:00:00 2001 From: Dong Bin Date: Mon, 5 May 2025 22:07:20 +0800 Subject: [PATCH 1/3] feat: add aboutus page. --- demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml | 219 ++++++++++++++++++ .../Semi.Avalonia.Demo/Pages/AboutUs.axaml.cs | 58 +++++ .../Pages/Overview.axaml.cs | 1 + .../Semi.Avalonia.Demo.csproj | 1 + demo/Semi.Avalonia.Demo/Views/MainView.axaml | 3 + 5 files changed, 282 insertions(+) create mode 100644 demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml create mode 100644 demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml.cs diff --git a/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml b/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml new file mode 100644 index 0000000..9d6b0f2 --- /dev/null +++ b/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml @@ -0,0 +1,219 @@ + + + + + + + #FFFDB7A5 + #FFF6A0B5 + #FFDD9BE0 + #FFC4A7E9 + #FFA7B3E1 + #FF98CDFD + #FF95D8F8 + + + + + + + + + + + #FFB42019 + #FFA41751 + #FF731F8A + #FF582EA0 + #FF29368E + #FF135CB8 + #FF0366A9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml.cs b/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml.cs new file mode 100644 index 0000000..eb0a539 --- /dev/null +++ b/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Windows.Input; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Interactivity; +using Avalonia.Markup.Xaml; +using Avalonia.Platform.Storage; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; + +namespace Semi.Avalonia.Demo.Pages; + +public partial class AboutUs : UserControl +{ + public AboutUs() + { + InitializeComponent(); + this.DataContext = new AboutUsViewModel(); + } + + protected override void OnLoaded(RoutedEventArgs e) + { + base.OnLoaded(e); + if (this.DataContext is AboutUsViewModel vm) + { + var launcher = TopLevel.GetTopLevel(this)?.Launcher; + vm.Launcher = launcher; + } + } +} + +public partial class AboutUsViewModel: ObservableObject +{ + public ICommand NavigateCommand { get; set; } + + internal ILauncher? Launcher { get; set; } + + public AboutUsViewModel() + { + NavigateCommand = new AsyncRelayCommand(OnNavigateAsync); + } + + private static readonly IReadOnlyDictionary _keyToUrlMapping = new Dictionary() + { + ["semi"] = "https://github.com/irihitech/Semi.Avalonia", + }; + + private async Task OnNavigateAsync(string? arg) + { + if (Launcher is not null && arg is not null && _keyToUrlMapping.TryGetValue(arg.ToLower(), out var uri)) + { + await Launcher.LaunchUriAsync(new Uri(uri)); + } + + } +} \ No newline at end of file diff --git a/demo/Semi.Avalonia.Demo/Pages/Overview.axaml.cs b/demo/Semi.Avalonia.Demo/Pages/Overview.axaml.cs index b7a5aa4..0bb4e36 100644 --- a/demo/Semi.Avalonia.Demo/Pages/Overview.axaml.cs +++ b/demo/Semi.Avalonia.Demo/Pages/Overview.axaml.cs @@ -1,4 +1,5 @@ using Avalonia.Controls; +using Avalonia.Media; namespace Semi.Avalonia.Demo.Pages; diff --git a/demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj b/demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj index 38a0043..e4a0aa4 100644 --- a/demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj +++ b/demo/Semi.Avalonia.Demo/Semi.Avalonia.Demo.csproj @@ -19,6 +19,7 @@ All + diff --git a/demo/Semi.Avalonia.Demo/Views/MainView.axaml b/demo/Semi.Avalonia.Demo/Views/MainView.axaml index bc1422b..fdbe2bd 100644 --- a/demo/Semi.Avalonia.Demo/Views/MainView.axaml +++ b/demo/Semi.Avalonia.Demo/Views/MainView.axaml @@ -111,6 +111,9 @@ + + + From 08ee7e4dc0627c92f32e3e6584cc643acefed07d Mon Sep 17 00:00:00 2001 From: Dong Bin Date: Mon, 5 May 2025 22:08:28 +0800 Subject: [PATCH 2/3] feat: add urls. --- demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml.cs b/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml.cs index eb0a539..a1491c3 100644 --- a/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml.cs +++ b/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml.cs @@ -45,6 +45,8 @@ public partial class AboutUsViewModel: ObservableObject private static readonly IReadOnlyDictionary _keyToUrlMapping = new Dictionary() { ["semi"] = "https://github.com/irihitech/Semi.Avalonia", + ["ursa"] = "https://github.com/irihitech/Ursa.Avalonia", + ["mantra"] = "https://www.bilibili.com/video/BV15pfKYbEEQ", }; private async Task OnNavigateAsync(string? arg) From 4af5fb654fa20f27acf7c0e3704e29a5f134accb Mon Sep 17 00:00:00 2001 From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com> Date: Tue, 6 May 2025 17:43:34 +0800 Subject: [PATCH 3/3] feat: update AboutUs page styles and links. --- demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml | 34 ++++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml b/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml index 9d6b0f2..c8b7ad6 100644 --- a/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/AboutUs.axaml @@ -130,6 +130,7 @@ HorizontalAlignment="Center" Classes="Tertiary" FontSize="20" + FontWeight="700" Text="聚焦生产力的美学进化" /> @@ -194,7 +195,7 @@ - + @@ -203,17 +204,34 @@ - + + Content="Homepage" + NavigateUri="https://irihi.tech"> + + + + - - + + + + + + - + \ No newline at end of file