-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCultureSampleWindow.cs
More file actions
52 lines (43 loc) · 1.23 KB
/
CultureSampleWindow.cs
File metadata and controls
52 lines (43 loc) · 1.23 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
using System.Globalization;
using EasyUIBinding.GirCore;
using Microsoft.Extensions.Localization;
namespace GirCoreApp;
public class CultureSampleWindow : Adw.ApplicationWindow
{
private readonly CultureSample _sample;
private readonly IStringLocalizer<CultureSample> L;
public CultureSample CultureSample => _sample;
public CultureSampleWindow(CultureSample sample, IStringLocalizer<CultureSample> localizer)
{
ArgumentNullException.ThrowIfNull(sample);
ArgumentNullException.ThrowIfNull(localizer);
L = localizer;
_sample = sample;
_sample.LanguageChanged += () =>
{
SetTitle(L["Yaml Localization"]);
if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
{
SetDefaultDirection(Gtk.TextDirection.Rtl);
}
else
{
SetDefaultDirection(Gtk.TextDirection.Ltr);
}
};
SetDefaultSize(600, 800);
SetTitle(L["Yaml Localization"]);
var headerBar = Adw.HeaderBar.New();
var toolbarView = Adw.ToolbarView.New();
toolbarView.AddTopBar(headerBar);
var box = UI.Box(Gtk.Orientation.Vertical, 0);
box.Append(toolbarView);
box.Append(UI.Scroll(_sample));
Content = box;
}
public override void Dispose()
{
_sample.Dispose();
base.Dispose();
}
}