-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathSettingsPage.xaml.cs
44 lines (38 loc) · 1.29 KB
/
SettingsPage.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
41
42
43
44
using Microsoft.UI.Xaml.Controls;
using System.Diagnostics;
using System;
using Microsoft.UI.Xaml.Documents;
using Microsoft.UI.Xaml.Input;
namespace WinUI3Localizer.SampleApp;
public sealed partial class SettingsPage : Page, IHasLocalizedItem
{
public SettingsPage()
{
InitializeComponent();
this.StringResourcesFolderHyperLink.Click += StringResourcesFolderHyperLink_Click;
this.StringResourcesFolderHyperLink.Inlines.Clear();
this.StringResourcesFolderHyperLink.Inlines.Add(new Run() { Text = App.StringsFolderPath });
}
public event PointerEventHandler? LocalizedItemPointerEntered;
private void StringResourcesFolderHyperLink_Click(Hyperlink sender, HyperlinkClickEventArgs args)
{
try
{
if (App.StringsFolderPath is string path &&
string.IsNullOrEmpty(path) is false)
{
sender.Inlines.Clear();
sender.Inlines.Add(new Run() { Text = path });
_ = Process.Start("explorer.exe", path);
}
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
private void LocalizedItem_PointerEntered(object sender, PointerRoutedEventArgs e)
{
LocalizedItemPointerEntered?.Invoke(sender, e);
}
}