Version binding

This commit is contained in:
2026-06-16 23:00:06 +02:00
parent 1cc0cd306a
commit abe9164912
4 changed files with 29 additions and 0 deletions

23
StarterNG/AppInfo.cs Normal file
View File

@@ -0,0 +1,23 @@
using System.Reflection;
namespace StarterNG;
/// <summary>Static, display-ready information about the running launcher build.</summary>
public static class AppInfo
{
/// <summary>
/// The launcher's assembly version (e.g. "1.2.3.4"), with a " (DEBUG)" suffix
/// appended for Debug builds so debug and release binaries are easy to tell
/// apart. Computed once; safe to bind with {x:Static}.
/// </summary>
public static string Version { get; } = BuildVersion();
private static string BuildVersion()
{
string text = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "0.0.0.0";
#if DEBUG
text += " (DEBUG)";
#endif
return text;
}
}

View File

@@ -16,6 +16,7 @@
ToolTip.Tip="{Binding [ShowLatestLogTooltip], Source={x:Static starterNg:App.Loc}}">
<materialIcons:MaterialIcon Kind="FileDocument"/>
</Button>
<Label VerticalAlignment="Center" Content="{x:Static starterNg:AppInfo.Version}"/>
</sukiUi:SukiWindow.RightWindowTitleBarControls>
<sukiUi:SukiSideMenu IsMenuExpanded="False">
<sukiUi:SukiSideMenu.Items>

View File

@@ -14,6 +14,9 @@ public partial class MainWindow : SukiWindow
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
InitializeComponent();
}
private void linkClick(object? sender, RoutedEventArgs e)
{
if (sender is not Button btn)

View File

@@ -6,6 +6,8 @@
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<PlatformTarget>x64</PlatformTarget>