Skip to content

Commit

Permalink
Add version display in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
xirreal committed Nov 2, 2024
1 parent 5af193d commit 153ce87
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
15 changes: 12 additions & 3 deletions Views/Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<InfoBar x:Name="InfoBar" IsOpen="True" Severity="Informational" IsClosable="False">

<Grid HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<InfoBar Grid.Row="1" x:Name="InfoBar" IsOpen="True" Severity="Informational" IsClosable="False">
<StackPanel Padding="32,32,32,32">
<TextBlock HorizontalAlignment="Center" Text="There's nothing here yet..."></TextBlock>
<HyperlinkButton NavigateUri="https://github.com/uwu/tailscale-client/issues" Content="Have a suggestion? Let us know."></HyperlinkButton>
</StackPanel>
</InfoBar>
</StackPanel>

<TextBlock Grid.Row="3" Margin="0,0,0,32" HorizontalAlignment="Center" Text="{x:Bind Version, Mode=OneTime}"></TextBlock>
</Grid>
</Page>
37 changes: 18 additions & 19 deletions Views/Settings.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Windows.Foundation;
using Windows.Foundation.Collections;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
using Windows.ApplicationModel;

namespace TailscaleClient.Views;
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>

public sealed partial class Settings : Page
{
private readonly string Version;

public static string GetAppVersion()
{
try
{
var version = Package.Current.Id.Version;
return string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
}
catch
{
return "Unpackaged build";
}
}

public Settings()
{
this.InitializeComponent();
Version = GetAppVersion();
}
}

0 comments on commit 153ce87

Please sign in to comment.