fix(ui): show short semver (major.minor.patch) in version footer\n\n- Parse AssemblyInformationalVersion and display only first 3 segments\n- Bind Text to AppVersionShort to hide '+sha' build metadata
This commit is contained in:
parent
74c5b403ae
commit
1eb7f13a05
2 changed files with 12 additions and 3 deletions
|
@ -7,6 +7,7 @@ using AdvancedCalculator.Services;
|
||||||
using CSMic;
|
using CSMic;
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace AdvancedCalculator.ViewModels;
|
namespace AdvancedCalculator.ViewModels;
|
||||||
|
|
||||||
|
@ -43,12 +44,20 @@ public partial class MainViewModel : ViewModelBase
|
||||||
public ObservableCollection<HistoryItem> History { get; }
|
public ObservableCollection<HistoryItem> History { get; }
|
||||||
public ObservableCollection<VariableItem> Variables { get; }
|
public ObservableCollection<VariableItem> Variables { get; }
|
||||||
|
|
||||||
// App version string, sourced from AssemblyInformationalVersion
|
// App version strings
|
||||||
public string AppVersion { get; } =
|
private static readonly string s_appVersion =
|
||||||
typeof(MainViewModel).Assembly
|
typeof(MainViewModel).Assembly
|
||||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
|
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
|
||||||
.InformationalVersion ?? "0.0.0";
|
.InformationalVersion ?? "0.0.0";
|
||||||
|
|
||||||
|
private static readonly string s_appVersionShort =
|
||||||
|
Regex.Match(s_appVersion, @"^(\d+)\.(\d+)\.(\d+)").Success
|
||||||
|
? Regex.Match(s_appVersion, @"^(\d+)\.(\d+)\.(\d+)").Value
|
||||||
|
: s_appVersion;
|
||||||
|
|
||||||
|
public string AppVersion => s_appVersion;
|
||||||
|
public string AppVersionShort => s_appVersionShort;
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void ToggleFunctions()
|
private void ToggleFunctions()
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
<!-- Bottom sticky version bar -->
|
<!-- Bottom sticky version bar -->
|
||||||
<Border Grid.Row="1" Padding="10" Background="{DynamicResource Brush.Surface}"
|
<Border Grid.Row="1" Padding="10" Background="{DynamicResource Brush.Surface}"
|
||||||
BorderBrush="{DynamicResource Brush.Border}" BorderThickness="0,1,0,0">
|
BorderBrush="{DynamicResource Brush.Border}" BorderThickness="0,1,0,0">
|
||||||
<TextBlock Text="{Binding AppVersion, StringFormat='Version {0}'}"
|
<TextBlock Text="{Binding AppVersionShort, StringFormat='Version {0}'}"
|
||||||
HorizontalAlignment="Left"/>
|
HorizontalAlignment="Left"/>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue