本文整理汇总了C#中NavigationPage.PopAsync方法的典型用法代码示例。如果您正苦于以下问题:C# NavigationPage.PopAsync方法的具体用法?C# NavigationPage.PopAsync怎么用?C# NavigationPage.PopAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NavigationPage
的用法示例。
在下文中一共展示了NavigationPage.PopAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestNavigationImplPop
public async Task TestNavigationImplPop ()
{
NavigationPage nav = new NavigationPage ();
Label child = new Label ();
Page childRoot = new ContentPage {Content = child};
Label child2 = new Label ();
Page childRoot2 = new ContentPage {Content = child2};
await nav.Navigation.PushAsync (childRoot);
await nav.Navigation.PushAsync (childRoot2);
bool fired = false;
nav.Popped += (sender, e) => fired = true;
var popped = await nav.Navigation.PopAsync ();
Assert.True (fired);
Assert.AreSame (childRoot, nav.CurrentPage);
Assert.AreEqual (childRoot2, popped);
await nav.PopAsync ();
var last = await nav.Navigation.PopAsync ();
Assert.IsNull (last);
}
示例2: CurrentPageNotNullPoppingRoot
public async Task CurrentPageNotNullPoppingRoot()
{
var root = new ContentPage { Title = "Root" };
var navPage = new NavigationPage (root);
var popped = await navPage.PopAsync ();
Assert.That (popped, Is.Null);
Assert.That (navPage.CurrentPage, Is.SameAs (root));
}