本文整理汇总了C#中NavigationPage.Layout方法的典型用法代码示例。如果您正苦于以下问题:C# NavigationPage.Layout方法的具体用法?C# NavigationPage.Layout怎么用?C# NavigationPage.Layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NavigationPage
的用法示例。
在下文中一共展示了NavigationPage.Layout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NavigateTo
public void NavigateTo(MenuItem menu)
{
try
{
App.ClearToolbarItems();
if (menu == null)
return;
Children.Clear();
Page displayPage = (Page)Activator.CreateInstance(menu.TargetType);
Detail = new NavigationPage(displayPage);
if (menu.TargetType != typeof(CalendarDayView))
Detail.Title = "SUBPAGE";
else
Detail.Title = "MAINPAGE";
Children.Add(Detail);
Detail.Layout(new Rectangle(0, 0, Width, Height));
Children.Remove(MasterPage);
Children.Add(MasterPage);
Children.Remove(ShortCutPage);
Children.Add(ShortCutPage);
doSmoothClose();
doShortcutSmoothClose();
ToolbarItems.Clear();
for (int i = 4; i >= 0; i--)
{
if (App.toolbarItems[i] != null)
ToolbarItems.Add(App.toolbarItems[i]);
}
}
catch (Exception ex)
{
DisplayAlert("", ex.Message, "");
}
}
示例2: OnBackButtonPressed
protected override bool OnBackButtonPressed()
{
if (Detail.Title == "MAINPAGE")
{
Device.BeginInvokeOnMainThread(async () =>
{
var result = await DisplayAlert("تایید", "آبا مایل به خروج از برنامه می باشید؟", "بله", "خیر");
if (result)
{
if (Device.OS == TargetPlatform.Android)
{
Android.OS.Process.KillProcess(Android.OS.Process.MyPid());
}
}
});
}
else
{
if (App.HomePage.Detail.Navigation.NavigationStack.Count > 1)
{
App.HomePage.Detail.Navigation.PopAsync();
if (App.HomePage.Detail.Navigation.NavigationStack.Count == 2)
Detail.Title = "MAINPAGE";
}
else
{
try
{
App.ClearToolbarItems();
Children.Clear();
Page displayPage = (Page)Activator.CreateInstance(typeof(CalendarDayView));
Detail = new NavigationPage(displayPage);
Detail.Title = "MAINPAGE";
Children.Add(Detail);
Detail.Layout(new Rectangle(0, 0, Width, Height));
Children.Remove(MasterPage);
Children.Add(MasterPage);
Children.Remove(ShortCutPage);
Children.Add(ShortCutPage);
doSmoothClose();
doShortcutSmoothClose();
ToolbarItems.Clear();
for (int i = 4; i >= 0; i--)
{
if (App.toolbarItems[i] != null)
ToolbarItems.Add(App.toolbarItems[i]);
}
}
catch (Exception ex)
{
DisplayAlert("", ex.Message, "");
}
}
}
return true;
}