-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppShell.xaml.cs
70 lines (54 loc) · 1.37 KB
/
AppShell.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using Microsoft.Maui.Controls;
namespace PracticaPalabrasMAUI;
public partial class AppShell : Shell
{
//tengo que sacar los calores del Resources
public AppShell()
{
Label lblLang=null;
TapGestureRecognizer tabLbl;
InitializeComponent();
BindingContext = this;
foreach(string lang in Language.LangCodes)
{
lblLang = new Label()
{
Text = lang,
};
tabLbl = new TapGestureRecognizer();
tabLbl.Tapped += (s,e) =>
{
Label l = s as Label;
Language.LangCode = l.Text;
App.CurrentApp.UpdateLang();
UpdateLangLabelColor(l.Text);
};
lblLang.GestureRecognizers.Add(tabLbl);
lstLangs.Add(lblLang);
lblLang = new Label()
{
Text = " | ",
};
lstLangs.Add(lblLang);
}
if (lblLang != null)
{
lstLangs.Remove(lblLang);
}
UpdateLangLabelColor(Language.LangCode);
}
private void UpdateLangLabelColor(string langActual)
{
foreach (Label l in lstLangs.Children.OfType<Label>())
{
if(l.Text == langActual)
{
l.TextColor = (Color)App.CurrentApp.Colors["LangActivated"];
}
else if (Language.LangCodes.Contains(l.Text))
{
l.TextColor = (Color)App.CurrentApp.Colors["LangDesactivated"];
}
}
}
}