コード例 #1
0
		public CoreRootPage(Page rootPage, NavigationBehavior navigationBehavior = NavigationBehavior.PushAsync)
		{
			ValidateRegistrar();

			var galleryFactory = DependencyService.Get<IPlatformSpecificCoreGalleryFactory>();

			Title = galleryFactory?.Title ?? "Core Gallery";

			var corePageView = new CorePageView(rootPage, navigationBehavior);

			var searchBar = new SearchBar()
			{
				AutomationId = "SearchBar"
			};

			searchBar.TextChanged += (sender, e) =>
			{
				corePageView.FilterPages(e.NewTextValue);
			};

			var testCasesButton = new Button
			{
				Text = "Go to Test Cases",
				AutomationId = "GoToTestButton",
				TabIndex = -2,
				Command = new Command(async () =>
				{
					if (!string.IsNullOrEmpty(searchBar.Text))
						await corePageView.PushPage(searchBar.Text);
					else
						await Navigation.PushModalAsync(TestCases.GetTestCases());
				})
			};

			var stackLayout = new StackLayout()
			{
				Children = {
					testCasesButton,
					searchBar,
					new Button {
						Text = "Click to Force GC",
						TabIndex = -2,
						Command = new Command(() => {
							GC.Collect ();
							GC.WaitForPendingFinalizers ();
							GC.Collect ();
						})
					}

				}
			};