Skip to content

Commit

Permalink
fix: version in about window
Browse files Browse the repository at this point in the history
  • Loading branch information
gosha20777 committed Apr 3, 2020
1 parent 28bc9ca commit a97010e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/LacmusApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<Company>Lacmus Foundation</Company>
<AssemblyVersion>0.3.3.3</AssemblyVersion>
<FileVersion>0.3.3.3</FileVersion>
<AssemblyVersion>0.3.3.4</AssemblyVersion>
<FileVersion>0.3.3.4</FileVersion>
</PropertyGroup>
<ItemGroup>
<Compile Update="**\*.xaml.cs">
Expand Down
11 changes: 11 additions & 0 deletions src/ViewModels/AboutViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Runtime.InteropServices;
using Avalonia.Controls;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using Serilog;

namespace LacmusApp.ViewModels
Expand All @@ -16,6 +17,8 @@ public AboutViewModel(Window window)
OpenGithubCommand = ReactiveCommand.Create(OpenGithub);
OpenSiteCommand = ReactiveCommand.Create(OpenSite);
}

[Reactive] public string TextVersion { get; set; } = GetVersion() + ".";
public ReactiveCommand<Unit, Unit> OpenLicenseCommand { get; set; }
public ReactiveCommand<Unit, Unit> OpenGithubCommand { get; set; }
public ReactiveCommand<Unit, Unit> OpenSiteCommand { get; set; }
Expand Down Expand Up @@ -57,5 +60,13 @@ private void OpenUrl(string url)
Log.Error(e,$"Unable to ope url {url}.");
}
}

private static string GetVersion()
{
var revision = "";
if (typeof(Program).Assembly.GetName().Version.Revision != 0)
revision = $"preview-{typeof(Program).Assembly.GetName().Version.Revision}";
return $"{typeof(Program).Assembly.GetName().Version.Major}.{typeof(Program).Assembly.GetName().Version.Minor}.{typeof(Program).Assembly.GetName().Version.Build}.{revision}";
}
}
}
2 changes: 1 addition & 1 deletion src/Views/AboutWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<TextBlock TextWrapping="Wrap" Classes="Caption" Text="Copyright (c) 2020 Lacmus Foundation." />
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Heavy" Text="Version: " />
<TextBlock Text="0.3.3.preview-3 alpha." />
<TextBlock Text="{Binding TextVersion}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Heavy" Text="Github page: " />
Expand Down

0 comments on commit a97010e

Please sign in to comment.