|
1 using System; |
|
2 using System.Collections.Generic; |
|
3 using System.Linq; |
|
4 using System.Text; |
|
5 using System.Threading.Tasks; |
|
6 using System.Windows; |
|
7 using System.Windows.Controls; |
|
8 |
|
9 namespace UI |
|
10 { |
|
11 public class Controls |
|
12 { |
|
13 public static Button Button(Container container, String label, RoutedEventHandler e) |
|
14 { |
|
15 Button button = new Button(); |
|
16 button.Content = label; |
|
17 container.Add(button, false); |
|
18 |
|
19 button.Click += e; |
|
20 |
|
21 return button; |
|
22 } |
|
23 |
|
24 public static Label Label(Container container, String str, int alignment) |
|
25 { |
|
26 HorizontalAlignment a; |
|
27 switch (alignment) |
|
28 { |
|
29 case 0: a = HorizontalAlignment.Left; break; |
|
30 case 1: a = HorizontalAlignment.Right; break; |
|
31 case 2: a = HorizontalAlignment.Center; break; |
|
32 default: a = HorizontalAlignment.Left; break; |
|
33 } |
|
34 |
|
35 Label label = new Label(); |
|
36 label.HorizontalAlignment = a; |
|
37 label.Content = str; |
|
38 container.Add(label, false); |
|
39 |
|
40 return label; |
|
41 } |
|
42 |
|
43 public static Label Space(Container container) |
|
44 { |
|
45 return Label(container, null, 2); |
|
46 } |
|
47 |
|
48 public static Separator Separator(Container container) |
|
49 { |
|
50 Separator separator = new Separator(); |
|
51 container.Add(separator, false); |
|
52 return separator; |
|
53 } |
|
54 } |
|
55 } |