Exemple #1
0
        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 MenuPage(RootPage root)
        {
            this.root = root;
            InitializeComponent();

            NavView.NavigationItemSelected += async(sender, e) =>
            {
                this.root.IsPresented = false;

                await Task.Delay(225);

                await this.root.NavigateAsync(e.Index);
            };
        }
Exemple #3
0
        public App()
        {
            InitializeComponent();
            ViewModelBase.Init();

            switch (Device.RuntimePlatform)
            {
            case Device.Android:
                MainPage = new Pages.Android.RootPage();
                //MainPage = new Page1();
                break;

            case Device.iOS:
                break;
            }
        }
Exemple #4
0
        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);
            }
        }