fix: Dynamic load copyright (#1030)

This commit is contained in:
GadflyFang 2025-02-27 21:14:24 +08:00 committed by GitHub
parent caca1dcaaf
commit 57cb9d0909
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 14 additions and 13 deletions

View file

@ -52,7 +52,7 @@
<TextBlock Margin="2,0,0,0" Text="{DynamicResource Text.About.SubTitle}" FontSize="16"/>
<TextBlock Margin="2,8,0,0" Text="{DynamicResource Text.About.Copyright}" Foreground="{DynamicResource Brush.FG2}"/>
<TextBlock Margin="2,8,0,0" Text="{Binding Copyright}" Foreground="{DynamicResource Brush.FG2}"/>
<StackPanel Orientation="Vertical" Margin="0,24,0,0">
<StackPanel Orientation="Horizontal" Height="18">

View file

@ -11,11 +11,21 @@ namespace SourceGit.Views
private set;
}
public string Copyright
{
get;
private set;
}
public About()
{
var ver = Assembly.GetExecutingAssembly().GetName().Version;
if (ver != null)
Version = $"{ver.Major}.{ver.Minor}";
var attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length > 0)
Copyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
DataContext = this;
InitializeComponent();