public App() { InitializeComponent(); SqliteUtil.Current.CreateAllTablesAsync(); AppCenter.Start("android=edece6f4-538e-4a97-b9f7-5a24c95a00d8;ios=8b7847a8-ceae-4e21-bc51-a9da9a6e7ecc;", typeof(Analytics), typeof(Crashes)); ViewModelBase.Init(); XamBottomBarPage bottomBarPage = new XamBottomBarPage() { Title = "博客园" }; if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.Android) { bottomBarPage.BarTextColor = (Color)Application.Current.Resources["Primary"]; bottomBarPage.FixedMode = true; bottomBarPage.BarTheme = XamBottomBarPage.BarThemeTypes.Light; } bottomBarPage.Children.Add(new ArticlesTopTabbedPage()); bottomBarPage.Children.Add(new NewsTopTabbedPage()); bottomBarPage.Children.Add(new StatusesTopTabbedPage()); bottomBarPage.Children.Add(new QuestionsTopTabbedPage()); bottomBarPage.Children.Add(new AccountPage()); MainPage = new XamNavigationPage(bottomBarPage); //MainPage = new NavigationPage(new Page1() { Title = "测试" }); }
public App() { InitializeComponent(); SqliteUtil.Current.CreateAllTablesAsync(); AppCenter.Start("android=72a75e57-6edb-4ba2-aee6-4cf0ddfba501;ios=3fc5d636-dc00-46cb-b7a6-b685749e6e77;", typeof(Analytics), typeof(Crashes)); ViewModelBase.Init(); XamBottomBarPage bottomBarPage = new XamBottomBarPage() { Title = "²©¿ÍÔ°" }; if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.Android) { bottomBarPage.BarTextColor = (Color)Application.Current.Resources["Primary"]; bottomBarPage.FixedMode = true; bottomBarPage.BarTheme = XamBottomBarPage.BarThemeTypes.Light; } bottomBarPage.Children.Add(new ArticlesTopTabbedPage()); bottomBarPage.Children.Add(new NewsTopTabbedPage()); bottomBarPage.Children.Add(new StatusesTopTabbedPage()); bottomBarPage.Children.Add(new QuestionsTopTabbedPage()); bottomBarPage.Children.Add(new AccountPage()); MainPage = new XamNavigationPage(bottomBarPage); //MainPage = new NavigationPage(new Page1() { Title = "²âÊÔ" }); }
protected override void OnStart() { ViewModelBase.Init(); var bottomBarPage = new HomeTabbedPage() { Title = "博客园" }; bottomBarPage.BackgroundColor = (Color)Xamarin.Forms.Application.Current.Resources["NavigationText"]; bottomBarPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom).SetOffscreenPageLimit(5).SetElevation(5); if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.Android) { var rootPage = new Pages.Android.RootPage(); rootPage.Children.Add(bottomBarPage); rootPage.Children.Add(new SearchPage()); var navigationPage = new XamNavigationPage(rootPage); navigationPage.BarTextColor = (Color)Xamarin.Forms.Application.Current.Resources["TitleText"]; navigationPage.BarBackgroundColor = (Color)Xamarin.Forms.Application.Current.Resources["NavigationText"]; MainPage = navigationPage; } else if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS) { MainPage = new XamNavigationPage(bottomBarPage); } OnResume(); }
public async Task NavigateAsync(int menuId) { XamNavigationPage newPage = null; if (!pages.ContainsKey(menuId)) { switch (menuId) { case (int)AppPage.Articles: pages.Add(menuId, new XamNavigationPage(new ArticlesTopTabbedPage())); break; case (int)AppPage.News: pages.Add(menuId, new XamNavigationPage(new NewsTopTabbedPage())); break; case (int)AppPage.KbArticles: pages.Add(menuId, new XamNavigationPage(new KbArticlesPage())); break; case (int)AppPage.Statuses: pages.Add(menuId, new XamNavigationPage(new StatusesTopTabbedPage())); break; case (int)AppPage.Questions: pages.Add(menuId, new XamNavigationPage(new QuestionsTopTabbedPage())); break; case (int)AppPage.Setting: pages.Add(menuId, new XamNavigationPage(new SettingPage())); break; case (int)AppPage.About: pages.Add(menuId, new XamNavigationPage(new AboutPage())); break; } } if (newPage == null) { newPage = pages[menuId]; } if (newPage == null) { return; } if (Detail == newPage) { await newPage.Navigation.PopToRootAsync(); } Detail = newPage; }
public App() { InitializeComponent(); VersionTracking.Track(); SqliteUtil.Current.CreateAllTablesAsync(); AppCenter.Start("", typeof(Analytics), typeof(Crashes)); ViewModelBase.Init(); var bottomBarPage = new HomeTabbedPage() { Title = "博客园" }; bottomBarPage.BackgroundColor = Color.White; bottomBarPage.On <Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom).SetOffscreenPageLimit(5).SetElevation(5F); bottomBarPage.Children.Add(new ArticlesTopTabbedPage()); bottomBarPage.Children.Add(new NewsTopTabbedPage()); bottomBarPage.Children.Add(new StatusesTopTabbedPage()); bottomBarPage.Children.Add(new QuestionsTopTabbedPage()); bottomBarPage.Children.Add(new AccountPage()); if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.Android) { var rootPage = new Pages.Android.RootPage(); rootPage.Children.Add(bottomBarPage); rootPage.Children.Add(new SearchPage()); MainPage = new XamNavigationPage(rootPage); } else if (Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.iOS) { MainPage = new XamNavigationPage(bottomBarPage); } }