-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainPage.xaml.cs
135 lines (133 loc) · 4.19 KB
/
MainPage.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
namespace Globeng.MAUI.Pages;
public partial class ExamTasks : ContentPage
{
public ExamTasks()
{
InitializeComponent();
LoadAnswersLayout();
}
private Button CreateEndButton()
{
Button innerbutt = new()
{
HorizontalOptions = LayoutOptions.Fill,
TextColor = Color.FromRgb(255, 255, 255),
Text = ("tovább").ToUpper(),
CornerRadius = 20,
Margin = new Thickness(15, 10, 15, 30)
};
innerbutt.Clicked += End_Clicked;
return innerbutt;
}
private void End_Clicked(object sender, EventArgs e)
{
Navigation.PopAsync();
}
private Label CreateLabel(string text, Color color = null)
{
Label innerlab = new()
{
HorizontalTextAlignment = TextAlignment.Start,
HorizontalOptions = LayoutOptions.Fill,
Text = text,
TextColor = color ?? Color.FromRgb(0, 0, 0)
};
return innerlab;
}
private StackLayout CreateTRFA()
{
Button Selected = null;
StackLayout inner = new()
{
HorizontalOptions = LayoutOptions.Fill,
Orientation = StackOrientation.Horizontal
};
Button check = new()
{
//Text = "✔️",
Text = "✅",
TextColor = Color.FromArgb("#FFFFFFFF")
};
check.HeightRequest = 60;
check.WidthRequest = 60;
check.BackgroundColor = Color.FromRgba("#00000000");
check.BorderWidth = 5;
check.BorderColor = Color.FromRgba("#FFFFFFFF");
check.TextColor = Color.FromRgba("#FFFFFFFF");
check.Clicked += TRFA_Clicked;
Button cross = new()
{
Text = "❌",
TextColor = Color.FromArgb("#FFFFFFFF")
};
cross.HeightRequest = 60;
cross.WidthRequest = 60;
cross.BackgroundColor = Color.FromRgba("#00000000");
cross.BorderWidth = 5;
cross.BorderColor = Color.FromRgba("#FFFFFFFF");
cross.TextColor = Color.FromRgba("#FFFFFFFF");
cross.Clicked += TRFA_Clicked;
Button didntsay = new()
{
Text = ("Nem hangzott el").ToUpper(),
TextColor = Color.FromArgb("#FFFFFFFF")
};
didntsay.HeightRequest = 60;
didntsay.CornerRadius = 30;
didntsay.BackgroundColor = Color.FromRgba("#00000000");
didntsay.BorderWidth = 5;
didntsay.BorderColor = Color.FromRgba("#FFFFFFFF");
didntsay.TextColor = Color.FromRgba("#FFFFFFFF");
didntsay.Clicked += TRFA_Clicked;
inner.Add(check);
inner.Add(cross);
inner.Add(didntsay);
if (Selected != null)
{
Selected.BackgroundColor = Color.FromRgb(80, 80, 80);
}
return inner;
}
private void TRFA_Clicked(object sender, EventArgs e)
{
try
{
Button Button = sender as Button;
Button.BackgroundColor = Color.FromRgb(80, 80, 80);
switch (Button.Text)
{
//case "✔️": {
case "✅":
{
Button.BackgroundColor = Color.FromRgb(80, 80, 80);
break;
}
case "❌":
{
Button.BackgroundColor = Color.FromRgb(80, 80, 80);
break;
}
case "NEM HANGZOTT EL":
{
Button.BackgroundColor = Color.FromRgb(80, 80, 80);
break;
}
}
//Selection[answer.Id] = Button;
}
catch (Exception ex) { Console.WriteLine(ex.Message); }
}
private void LoadAnswersLayout()
{
Dispatcher.Dispatch(() =>
{
//List<GraduateTestTask> testTasks = task.GraduateTestTasks.ToList();
for (int i = 0; i < 10; i++)
{
correctview.Add(CreateLabel("This is a label", Color.FromArgb("#FFFFFFFF")));
correctview.Add(CreateTRFA());
}
correctview.Add(CreateEndButton());
});
}
}