summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/NavReproApp.cs
blob: 1c55d0b1653ff85e73abeb224f4682c1c1fe49ae (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
using System;

namespace Xamarin.Forms.Controls
{
	// Not quite sure how to turn this into a test case, effectively replace the normal Application with this to repro issues reported.
	// Full repro requires assignment to MainPage, hence the issue
	public class NavReproApp : Application
	{
		NavigationPage navPage1 = new NavigationPage ();

		public NavReproApp ()
		{

			var btn = new Button () { Text = "Start" };

			btn.Clicked += Btn_Clicked;

			navPage1.PushAsync (new ContentPage () { Content = btn });

			MainPage = navPage1;

		}

		async void Btn_Clicked (object sender, EventArgs e)
		{
			await navPage1.PushAsync (new ContentPage () { Content = new Label () { Text = "Page 2" } });
			await navPage1.PushAsync (new ContentPage () { Content = new Label () { Text = "Page 3" } });


			var navPage2 = new NavigationPage ();

			var btn = new Button () { Text = "Start Next" };
			btn.Clicked += Btn_Clicked1;

			await navPage2.PushAsync (new ContentPage () { Content = btn });

			MainPage = navPage2;


		}

		async void Btn_Clicked1 (object sender, EventArgs e)
		{
			MainPage = navPage1;
			await navPage1.PopAsync ();


			await navPage1.PushAsync (new ContentPage () { Content = new Label () { Text = "Page 3a" } });
		}

		protected override void OnStart ()
		{
			// Handle when your app starts
		}

		protected override void OnSleep ()
		{
			// Handle when your app sleeps
		}

		protected override void OnResume ()
		{
			// Handle when your app resumes
		}
	}
}