public App() { InitializeComponent(); // display root page MainPage = new RootNavigationPage(new HomePage()); }
public async Task NavigateAsync(MenuType id) { Page newPage; if (!Pages.ContainsKey(id)) { switch (id) { case MenuType.Products: var page = new RootNavigationPage(new ProductListPage { BindingContext = new ProductsViewModel() { Navigation = this.Navigation }, Title = "Produtos", Icon = new FileImageSource { File = "products.png" } }); SetDetailIfNull(page); Pages.Add(id, page); break; } } newPage = Pages[id]; if (newPage == null) { return; } //pop to root for Windows Phone if (Detail != null && Device.OS == TargetPlatform.WinPhone) { await Detail.Navigation.PopToRootAsync(); } Detail = newPage; if (Device.Idiom != TargetIdiom.Tablet) { IsPresented = false; } }
protected override void OnLaunched(LaunchActivatedEventArgs args) { LogFactory.Init(Path.Combine(ApplicationData.Current.LocalFolder.Path, "Logs")); Logger logger = LogFactory.GetLogger(nameof(OnLaunched)); logger.Log($"PreviousExecutionState {args.PreviousExecutionState}"); #if DEBUG if (Debugger.IsAttached) { //DebugSettings.EnableFrameRateCounter = true; } #endif UIElement rootContent = Window.Current.Content; if (rootContent == null) { _rootNavigationViewModel = new RootNavigationViewModel(args.PreviousExecutionState); rootContent = new RootNavigationPage { DataContext = _rootNavigationViewModel }; Window.Current.Content = rootContent; } Type type = typeof(SamePage); if (args.TileId.StartsWith(type.Name)) { Type landingPageType = typeof(CertTutorial); string landingParams = args.Arguments; _rootNavigationViewModel.SetLandingPage(landingPageType, landingParams); } if (args.PrelaunchActivated) { return; } // Ensure the current window is active Window.Current.Activate(); }
public IosNavigationService(RootNavigationPage navigationPage, ILifecycleService lifecycleService) : base(navigationPage, lifecycleService) { }