mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
refactor: re-write About
window
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
83f23583be
commit
43fed8e04d
2 changed files with 13 additions and 25 deletions
|
@ -5,7 +5,7 @@
|
||||||
xmlns:v="using:SourceGit.Views"
|
xmlns:v="using:SourceGit.Views"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="SourceGit.Views.About"
|
x:Class="SourceGit.Views.About"
|
||||||
x:DataType="v:About"
|
x:Name="ThisControl"
|
||||||
Icon="/App.ico"
|
Icon="/App.ico"
|
||||||
Title="{DynamicResource Text.About}"
|
Title="{DynamicResource Text.About}"
|
||||||
SizeToContent="WidthAndHeight"
|
SizeToContent="WidthAndHeight"
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
WindowStartupLocation="CenterScreen">
|
WindowStartupLocation="CenterScreen">
|
||||||
<Grid RowDefinitions="Auto,*">
|
<Grid RowDefinitions="Auto,*">
|
||||||
<!-- TitleBar -->
|
<!-- TitleBar -->
|
||||||
<Grid Grid.Row="0" Height="28" IsVisible="{Binding !UseSystemWindowFrame}">
|
<Grid Grid.Row="0" Height="28" IsVisible="{Binding !#ThisControl.UseSystemWindowFrame}">
|
||||||
<Border Background="{DynamicResource Brush.TitleBar}"
|
<Border Background="{DynamicResource Brush.TitleBar}"
|
||||||
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
|
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
|
||||||
PointerPressed="BeginMoveWindow"/>
|
PointerPressed="BeginMoveWindow"/>
|
||||||
|
@ -46,13 +46,13 @@
|
||||||
<StackPanel Height="48" Orientation="Horizontal">
|
<StackPanel Height="48" Orientation="Horizontal">
|
||||||
<TextBlock Classes="bold" Text="SourceGit" FontSize="32" />
|
<TextBlock Classes="bold" Text="SourceGit" FontSize="32" />
|
||||||
<Border Margin="12,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent}" Effect="drop-shadow(0 0 6 #40000000)">
|
<Border Margin="12,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent}" Effect="drop-shadow(0 0 6 #40000000)">
|
||||||
<TextBlock Classes="primary" Margin="8,0" Text="{Binding Version}" FontSize="12" Foreground="White"/>
|
<TextBlock x:Name="TxtVersion" Classes="primary" Margin="8,0" FontSize="12" Foreground="White"/>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock Margin="2,0,0,0" Text="{DynamicResource Text.About.SubTitle}" FontSize="16"/>
|
<TextBlock Margin="2,0,0,0" Text="{DynamicResource Text.About.SubTitle}" FontSize="16"/>
|
||||||
|
|
||||||
<TextBlock Margin="2,8,0,0" Text="{Binding Copyright}" Foreground="{DynamicResource Brush.FG2}"/>
|
<TextBlock x:Name="TxtCopyright" Margin="2,8,0,0" Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
|
|
||||||
<StackPanel Orientation="Vertical" Margin="0,24,0,0">
|
<StackPanel Orientation="Vertical" Margin="0,24,0,0">
|
||||||
<StackPanel Orientation="Horizontal" Height="18">
|
<StackPanel Orientation="Horizontal" Height="18">
|
||||||
|
|
|
@ -5,30 +5,18 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
public partial class About : ChromelessWindow
|
public partial class About : ChromelessWindow
|
||||||
{
|
{
|
||||||
public string Version
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Copyright
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
private set;
|
|
||||||
}
|
|
||||||
|
|
||||||
public About()
|
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();
|
InitializeComponent();
|
||||||
|
|
||||||
|
var assembly = Assembly.GetExecutingAssembly();
|
||||||
|
var ver = assembly.GetName().Version;
|
||||||
|
if (ver != null)
|
||||||
|
TxtVersion.Text = $"{ver.Major}.{ver.Minor:D2}";
|
||||||
|
|
||||||
|
var copyright = assembly.GetCustomAttribute<AssemblyCopyrightAttribute>();
|
||||||
|
if (copyright != null)
|
||||||
|
TxtCopyright.Text = copyright.Copyright;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnVisitAvaloniaUI(object _, PointerPressedEventArgs e)
|
private void OnVisitAvaloniaUI(object _, PointerPressedEventArgs e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue