summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/ControlGalleryPages/AutomationIDGallery.cs
blob: 4ba2666744acbc5b7ab8d2bfae80a71042e712cd (plain)
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
using System;

namespace Xamarin.Forms.Controls
{
	public class AutomationIdGallery : ContentPage
	{

		public AutomationIdGallery ()
		{
			var scrollView = new ScrollView { AutomationId = "scrollMain" };
			var rootLayout = new StackLayout { AutomationId = "stckMain" };

			var btn = new Button {
				AutomationId = "btnTest1",
				Text = "Test1",
				Command = new Command (async () => await Navigation.PushModalAsync (new TestPage1 ()))
			};

			var btn2 = new Button {
				AutomationId = "btnTest2",
				Text = "Test2",
				Command = new Command (async () => await Navigation.PushModalAsync (new TestPage2 ()))
			};
	
			rootLayout.Children.Add (btn);
			rootLayout.Children.Add (btn2);

			var toolBarItem = new ToolbarItem { AutomationId = "tbItemHello", Text= "Hello", Command = new Command(async ()=> { await DisplayAlert("Hello","","ok"); }) };
			var toolBarItem2 = new ToolbarItem { AutomationId = "tbItemHello2", Order= ToolbarItemOrder.Secondary, Text= "Hello2", Command = new Command(async ()=> { await DisplayAlert("Hello2","","ok"); }) };

			ToolbarItems.Add (toolBarItem);
			ToolbarItems.Add (toolBarItem2);

			scrollView.Content = rootLayout;
			Content = scrollView;
		}

		internal class TestPage1 : ContentPage
		{
			public TestPage1 ()
			{
				var rootLayout = new StackLayout { AutomationId = "stckMain" };
				var btn = new Button {
					AutomationId = "popModal",
					Text = "Pop",
					Command = new Command (async () => await Navigation.PopModalAsync ())
				};
				rootLayout.Children.Add (btn);
				rootLayout.Children.Add (new ActivityIndicator { AutomationId = "actHello", IsRunning = true });
				rootLayout.Children.Add (new BoxView {
					AutomationId = "bxvHello",
					WidthRequest = 40,
					HeightRequest = 40,
					BackgroundColor = Color.Red
				});
				rootLayout.Children.Add (new Button { AutomationId = "btnHello", Text = "Hello" });
				rootLayout.Children.Add (new DatePicker { AutomationId = "dtPicker", Date = DateTime.Parse ("01/01/2014") });
				rootLayout.Children.Add (new TimePicker { AutomationId = "tPicker", Time = new TimeSpan (14, 45, 50)  });
				rootLayout.Children.Add (new Label { AutomationId = "lblHello", Text = "Hello Label" });
				rootLayout.Children.Add (new Editor { AutomationId = "editorHello", Text = "Hello Editor" });
				rootLayout.Children.Add (new Entry { AutomationId = "entryHello", Text = "Hello Entry" });

				Content = rootLayout;
			}
		}

		internal class TestPage2 : ContentPage
		{
			public TestPage2 ()
			{
				var rootLayout = new StackLayout { AutomationId = "stckMain" };
				var btn = new Button {
					AutomationId = "popModal",
					Text = "Pop",
					Command = new Command (async () => await Navigation.PopModalAsync ())
				};
				rootLayout.Children.Add (btn);
				rootLayout.Children.Add (new Image { AutomationId = "imgHello", Source = "menuIcon" });
				rootLayout.Children.Add (new ListView {
					AutomationId = "lstView",
					ItemsSource = new string[2] { "one", "two" },
					HeightRequest = 50
				});
				rootLayout.Children.Add (new Picker { AutomationId = "pickerHello", Items = { "one", "two" } });
				rootLayout.Children.Add (new ProgressBar { AutomationId = "progressHello", Progress = 2 });
				rootLayout.Children.Add (new SearchBar { AutomationId = "srbHello", Text = "Hello Search" });
				rootLayout.Children.Add (new Slider { AutomationId = "sliHello", Value = 0.5 });
				rootLayout.Children.Add (new Stepper { AutomationId = "stepperHello", Value = 5 });
				rootLayout.Children.Add (new Switch { AutomationId = "switchHello" });
				rootLayout.Children.Add (new WebView {
					AutomationId = "webviewHello",
					WidthRequest = 100,
					HeightRequest = 50,
					Source = new UrlWebViewSource { Url = "http://blog.xamarin.com/" }
				});
				
				Content = rootLayout;
			}
		}


	}
}