-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbout.xaml.cs
40 lines (29 loc) · 1.03 KB
/
About.xaml.cs
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
using Microsoft.Maui.Storage;
using System.Diagnostics;
using System.Reflection;
using Microsoft.Maui.ApplicationModel;
namespace PFBv01;
public partial class About : ContentPage
{
public About()
{
InitializeComponent();
}
protected override async void OnAppearing()
{
base.OnAppearing();
string filePath = "AboutAssets.txt";
BuildDateLabel.Text = await ReadTextFileAsync(filePath);
var version = AppInfo.Current.Version;
string formattedVersion = $"{version.Major}.{version.Minor}.{version.Build}";
BuildVersionLabel.Text = "App Version: " + formattedVersion;
}
public async Task<string> ReadTextFileAsync(string filePath)
{
string fileContents = string.Empty;
using Stream fileStream = await FileSystem.Current.OpenAppPackageFileAsync(filePath);
using StreamReader reader = new StreamReader(fileStream);
fileContents = await reader.ReadToEndAsync();
return fileContents;
}
}