From 3eb298719e2282edff3a76c8c3ef4920e768a3ae Mon Sep 17 00:00:00 2001 From: Highbyte Date: Mon, 6 Jul 2026 17:43:32 +0200 Subject: [PATCH 1/4] Improve Avalonia About dialog. Remove "General info" tab in center/bottom (all that info moved to About dialog). --- .../ViewModels/AboutViewModel.cs | 41 +++++++- .../Views/AboutUserControl.axaml | 96 +++++++++++++++++-- .../Views/AboutUserControl.axaml.cs | 10 +- .../Views/MainView.axaml | 84 ---------------- .../Views/MainView.axaml.cs | 1 - 5 files changed, 135 insertions(+), 97 deletions(-) diff --git a/src/apps/Avalonia/Highbyte.DotNet6502.App.Avalonia.Core/ViewModels/AboutViewModel.cs b/src/apps/Avalonia/Highbyte.DotNet6502.App.Avalonia.Core/ViewModels/AboutViewModel.cs index dfde1e4bd..5576aa6b3 100644 --- a/src/apps/Avalonia/Highbyte.DotNet6502.App.Avalonia.Core/ViewModels/AboutViewModel.cs +++ b/src/apps/Avalonia/Highbyte.DotNet6502.App.Avalonia.Core/ViewModels/AboutViewModel.cs @@ -1,5 +1,7 @@ using System; +using System.Reflection; using System.Reactive; +using System.Runtime.InteropServices; using System.Threading.Tasks; using Highbyte.DotNet6502.App.Avalonia.Core.Services; using ReactiveUI; @@ -12,6 +14,8 @@ namespace Highbyte.DotNet6502.App.Avalonia.Core.ViewModels; /// public class AboutViewModel : ViewModelBase { + private const string RepositoryUrl = "https://github.com/highbyte/dotnet-6502"; + private readonly IAppUpdateService _updateService; private string _statusText = string.Empty; @@ -32,13 +36,12 @@ public AboutViewModel(IAppUpdateService updateService) _updateService = updateService; CurrentVersionDisplay = updateService.CurrentVersionDisplay; IsUpdateCheckSupported = updateService.IsSupported; + CurrentReleaseNotesUrl = BuildCurrentReleaseNotesUrl(CurrentVersionDisplay); UpdateNowCommand = ReactiveCommandHelper.CreateSafeCommand(UpdateNowAsync); CloseCommand = ReactiveCommandHelper.CreateSafeCommand(() => RequestClose?.Invoke(this, EventArgs.Empty)); - StatusText = IsUpdateCheckSupported - ? "Checking for updates…" - : "Update checks aren't available for this build."; + StatusText = IsUpdateSectionVisible ? "Checking for updates…" : string.Empty; // Opening the About dialog is an explicit user action, so always run a fresh check (force:true // bypasses the daily cadence and the disabled-setting/CI gating). No separate "Check now" needed. @@ -48,6 +51,14 @@ public AboutViewModel(IAppUpdateService updateService) public string CurrentVersionDisplay { get; } public bool IsUpdateCheckSupported { get; } + public bool IsUpdateSectionVisible => IsUpdateCheckSupported; + public string? CurrentReleaseNotesUrl { get; } + public bool HasCurrentReleaseNotes => !string.IsNullOrEmpty(CurrentReleaseNotesUrl); + public string Author => "Highbyte"; + public string RepoUrl => RepositoryUrl; + public string OSVersion => RuntimeInformation.OSDescription; + public string DotNetVersion => RuntimeInformation.FrameworkDescription; + public string AvaloniaVersion => ReadAvaloniaVersion(); public ReactiveCommand UpdateNowCommand { get; } public ReactiveCommand CloseCommand { get; } @@ -147,7 +158,7 @@ private void ApplyStatus(AppUpdateStatus? status) { if (status is null) { - StatusText = "Update checks aren't available for this build."; + StatusText = "Update check did not return any result."; IsUpdateAvailable = false; SuggestedCommand = null; ReleaseNotesUrl = null; @@ -166,4 +177,26 @@ private void ApplyStatus(AppUpdateStatus? status) else StatusText = $"You're on the latest version ({status.CurrentVersionDisplay})."; } + + private static string? BuildCurrentReleaseNotesUrl(string currentVersionDisplay) + { + if (!currentVersionDisplay.StartsWith("v", StringComparison.Ordinal)) + return null; + + return $"{RepositoryUrl}/releases/tag/{currentVersionDisplay}"; + } + + private static string ReadAvaloniaVersion() + { + try + { + var asm = typeof(global::Avalonia.Controls.Control).Assembly; + var infoAttr = asm.GetCustomAttribute(); + return infoAttr?.InformationalVersion ?? asm.GetName().Version?.ToString() ?? "Unknown"; + } + catch + { + return "Unknown"; + } + } } diff --git a/src/apps/Avalonia/Highbyte.DotNet6502.App.Avalonia.Core/Views/AboutUserControl.axaml b/src/apps/Avalonia/Highbyte.DotNet6502.App.Avalonia.Core/Views/AboutUserControl.axaml index 7995762f1..95f3c1ff4 100644 --- a/src/apps/Avalonia/Highbyte.DotNet6502.App.Avalonia.Core/Views/AboutUserControl.axaml +++ b/src/apps/Avalonia/Highbyte.DotNet6502.App.Avalonia.Core/Views/AboutUserControl.axaml @@ -5,10 +5,10 @@ x:DataType="vm:AboutViewModel" AutomationProperties.AutomationId="AboutDialog" AutomationProperties.Name="About and updates" - Width="480" + Width="520" MinWidth="360"> - + @@ -16,26 +16,108 @@ - + +