-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.Localization.cs
More file actions
60 lines (51 loc) · 1.82 KB
/
MainWindow.Localization.cs
File metadata and controls
60 lines (51 loc) · 1.82 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
59
60
using System.Windows;
namespace WindowThumbWall;
public partial class MainWindow
{
private void ApplyLocalization()
{
Title = LocalizedText.Get("app.title");
FilterLabel.Text = LocalizedText.Get("label.filter");
AppListLabel.Text = LocalizedText.Get("label.autoApps");
FullScreenButton.Content = LocalizedText.Get("button.fullscreen");
SettingsButton.Content = LocalizedText.Get("label.settings");
ShortcutGuideButton.Content = BuildQuickHelpText();
}
private static string BuildQuickHelpText()
{
string summary = LocalizedText.Get("hint.summary");
string[] lines = summary
.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (lines.Length <= 4)
return string.Join('\n', lines);
var visible = new List<string>(4);
visible.AddRange(lines.Take(3));
visible.Add(LocalizedText.Get("hint.more"));
return string.Join('\n', visible);
}
private void ShortcutGuideButton_Click(object sender, RoutedEventArgs e)
{
if (_shortcutGuideWindow is { IsLoaded: true })
{
_shortcutGuideWindow.Activate();
return;
}
_shortcutGuideWindow = new ShortcutGuideWindow
{
Owner = this
};
_shortcutGuideWindow.Closed += (_, _) => _shortcutGuideWindow = null;
_shortcutGuideWindow.Show();
}
private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
var settingsWindow = new SettingsWindow(
_notificationAttentionRequested,
SupportsNotificationAttentionRuntime(),
enabled => SetNotificationAttentionEnabled(enabled))
{
Owner = this
};
settingsWindow.ShowDialog();
}
}