-
Notifications
You must be signed in to change notification settings - Fork 401
Expand file tree
/
Copy pathAbout.axaml.cs
More file actions
58 lines (50 loc) · 1.79 KB
/
About.axaml.cs
File metadata and controls
58 lines (50 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Reflection;
using Avalonia.Interactivity;
namespace SourceGit.Views
{
public partial class About : ChromelessWindow
{
public About()
{
CloseOnESC = true;
InitializeComponent();
var assembly = Assembly.GetExecutingAssembly();
var ver = assembly.GetName().Version;
if (ver != null)
{
TxtVersion.Text = $"{ver.Major}.{ver.Minor:D2}";
#if DEBUG
TxtVersion.Text += "-dev";
#endif
}
var meta = assembly.GetCustomAttributes<AssemblyMetadataAttribute>();
foreach (var attr in meta)
{
if (attr.Key.Equals("BuildDate", StringComparison.OrdinalIgnoreCase) && DateTime.TryParse(attr.Value, out var date))
{
TxtReleaseDate.Text = App.Text("About.ReleaseDate", date.ToLocalTime().ToString("MMM d yyyy"));
break;
}
}
var copyright = assembly.GetCustomAttribute<AssemblyCopyrightAttribute>();
if (copyright != null)
TxtCopyright.Text = copyright.Copyright;
}
private void OnVisitReleaseNotes(object _, RoutedEventArgs e)
{
Native.OS.OpenBrowser($"https://github.com/sourcegit-scm/sourcegit/releases/tag/v{TxtVersion.Text}");
e.Handled = true;
}
private void OnVisitWebsite(object _, RoutedEventArgs e)
{
Native.OS.OpenBrowser("https://sourcegit-scm.github.io/");
e.Handled = true;
}
private void OnVisitSourceCode(object _, RoutedEventArgs e)
{
Native.OS.OpenBrowser("https://github.com/sourcegit-scm/sourcegit");
e.Handled = true;
}
}
}