本文整理汇总了C#中NavigationPage.PushAsync方法的典型用法代码示例。如果您正苦于以下问题:C# NavigationPage.PushAsync方法的具体用法?C# NavigationPage.PushAsync怎么用?C# NavigationPage.PushAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NavigationPage
的用法示例。
在下文中一共展示了NavigationPage.PushAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: App
public App ()
{
var nav = new NavigationPage ();
nav.BarBackgroundColor = Color.Transparent;
nav.BarTextColor = Color.White;
var listpage = new ContentPage ();
listpage.Content = new ListView { ItemsSource = new List<ContentPage> {
new StackLayoutPageXaml(),
new StackLayoutPageCode(),
new RelativeLayoutPageXaml(),
new RelativeLayoutPageCode(),
new GridPageXaml(),
new GridPageCode(),
new AbsoluteLayoutPageXaml(),
new AbsoluteLayoutPageCode()
}, ItemTemplate = new DataTemplate(typeof(CustomCell))
};
((ListView)listpage.Content).ItemSelected += (object sender, SelectedItemChangedEventArgs e) => {
nav.PushAsync((ContentPage)e.SelectedItem);
};
nav.PushAsync (listpage);
// The root page of your application
MainPage = nav;
}
示例2: App
public App ()
{
NavigationPage nav = new NavigationPage ();
// The root page of your application
MainPage = nav;
nav.PushAsync (new HomeCode ());
}
示例3: App
public App()
{
// Setup page navigation
var navigationPage = new NavigationPage();
navigationPage.PushAsync(new FirstPage(), false);
MainPage = navigationPage;
}
示例4: App
public App()
{
var loginPage = new LoginPage();
loginPage.Login += Login;
loginPage.Register += Register;
MainPage = _navigationPage = new NavigationPage();
_navigationPage.PushAsync(loginPage);
}
示例5: MainPage
public MainPage()
{
var welcomePage = new ContentPage {Title = "Welcome"};
var navigationPage = new NavigationPage {Title = "Detail"};
navigationPage.PushAsync(welcomePage);
var master = new MenuPage(navigationPage) {Title = "Menu"};
Master = master;
Detail = navigationPage;
}
示例6: App
public App()
{
var tabs = new TabbedPage ();
var navPage = new NavigationPage () {Title="App Content"};
tabs.Children.Add (navPage);
bool useXaml = false; //change this to use the code implementation
if (useXaml) {
navPage.PushAsync (new LinkToInAppXaml ());
tabs.Children.Add (new LoadingLabelXaml ());
} else {
navPage.PushAsync (new LinkToInAppCode ());
tabs.Children.Add (new LoadingLabelCode ());
}
MainPage = tabs;
}
示例7: NavBarTitleTestPage
public NavBarTitleTestPage ()
{
var navTab = new NavigationPage { Title = "Hello 1 nav"};
navTab.PushAsync (GetPage (navTab));
var stackPages = new StackLayout ();
var btn3 = new Button {
Text = "tab", Command = new Command (async () => {
var tabbed = new TabbedPage { Title = "Main Tab" };
tabbed.Children.Add (navTab);
tabbed.Children.Add (GetPage (navTab));
await Navigation.PushModalAsync (tabbed);
})
};
var btn4 = new Button {
Text = "mdp", Command = new Command (async () => {
var newNav = new NavigationPage { Title = "Hello 1 nav", BarBackgroundColor = Color.Pink, BarTextColor = Color.Blue };
var mdp = new MasterDetailPage ();
await newNav.PushAsync (GetPage (newNav));
mdp.Master = new ContentPage {
Title = "Master", BackgroundColor = Color.Red, Content = new Button {
Text = "new", Command = new Command (() => {
mdp.Detail = new ContactsPage { Title = "hello 3" };
mdp.IsPresented = false;
})
}
};
mdp.Detail = newNav;
await Navigation.PushModalAsync (mdp);
})
};
var btn5 = new Button {
Text = "nav", Command = new Command (async () => {
var newNav = new NavigationPage { Title = "Hello 1 nav" };
await newNav.PushAsync (GetPage (newNav));
await Navigation.PushModalAsync (newNav);
})
};
var btn6 = new Button {
Text = "change nav", Command = new Command (() => {
(Parent as NavigationPage).BarBackgroundColor = Color.Blue;
(Parent as NavigationPage).BarTextColor = Color.Pink;
})
};
stackPages.Children.Add (btn3);
stackPages.Children.Add (btn4);
stackPages.Children.Add (btn5);
stackPages.Children.Add (btn6);
Content = stackPages;
}
示例8: createTodoPage
private Page createTodoPage()
{
var button = new Button { Text = "button1" };
var page = new TODO();
NavigationPage.SetHasNavigationBar(page, true);
var navPage = new NavigationPage(page) { Title = "TODOs" };
button.Clicked += (s, e) => navPage.PushAsync(new TODO());
return navPage;
}
示例9: StateMachineData
StateMachineData _stateMachineData = new StateMachineData (); // shared data struct, used by all pages to pass data
public StateMachine (Node startNode)
{
// create a new navpage to push the state machine onto, and which then can be popped off at the end
_navigationPage = new NavigationPage();
// create the first page of the sequence
StateMachinePage p = PageFactory.CreatePage (startNode.pageType, _navigationPage, _stateMachineData, HandleSequenceEnd, HandleCancel );
startNode.CreatePages (p, _navigationPage, _stateMachineData, HandleSequenceEnd, HandleCancel);
// start the sequence going ...
_navigationPage.PushAsync (p);
}
示例10: pressCycleThemeButton
public void pressCycleThemeButton(object sender, EventArgs args) {
Theme.cycleTheme();
SQLiteConnection con = DependencyService.Get<IDatabaseHandler>().getDBConnection();
var theme = con.Table<Info>().Where(i => i.key.Equals("theme")).FirstOrDefault();
theme.value = Theme.getActiveThemeId();
con.Update(theme);
con.Close();
NavigationPage page = new NavigationPage(new Home_Screen());
page.PushAsync(new Settings_Screen());
((Orientation.App)App.Current).setMainPage(page);
}
示例11: TestPushRoot
public async Task TestPushRoot ()
{
NavigationPage nav = new NavigationPage ();
Assert.IsNull (nav.CurrentPage);
Label child = new Label {Text = "Label"};
Page childRoot = new ContentPage {Content = child};
await nav.PushAsync (childRoot);
Assert.AreSame (childRoot, nav.CurrentPage);
}
示例12: App
public App (Configuration configuration)
{
if (configuration == null)
{
throw new ArgumentNullException("configuration");
}
_configuration = configuration;
var navigationPage = new NavigationPage();
navigationPage.PushAsync(new AuthenticationPage(navigationPage, _configuration));
MainPage = navigationPage;
}
示例13: TestPushEvent
public async Task TestPushEvent ()
{
NavigationPage nav = new NavigationPage ();
Label child = new Label ();
Page childRoot = new ContentPage {Content = child};
bool fired = false;
nav.Pushed += (sender, e) => fired = true;
await nav.PushAsync (childRoot);
Assert.True (fired);
}
示例14: App
public App ()
{
var mainPage = new CodedPage ();
var navigationPage = new NavigationPage (mainPage);
mainPage.ItemSelected += async (sender, e) => {
var detailPage = new DetailPage {
BindingContext = e,
};
await navigationPage.PushAsync (detailPage);
};
// The root page of your application
MainPage = navigationPage;
MainPage.BindingContext = ViewModel;
}
示例15: App
public App(IUserRepository userRepository = null, IServerFinder serverFinder = null)
{
_serverFinder = serverFinder;
_userRepository = userRepository ?? DependencyService.Get<IUserRepository>();
MainPage = _navigationPage = new NavigationPage();
if (_userRepository.IsLogged())
{
_dashboardPage = new DashboardPage(_userRepository);
_navigationPage.PushAsync(_dashboardPage);
}
else
{
var loginPage = new LoginPage(_userRepository);
loginPage.Login += Login;
loginPage.Register += Register;
_navigationPage.PushAsync(loginPage);
}
}