Esempio n. 1
0
        public RootPage()
        {
            //Common.RootPage = this;

            //FashionBook.Mobile.Data.PingData.Ping();

            NavigationPage.SetHasNavigationBar(this, true);

            //Home
            homePage = new MainPage();
            //homePage.Icon = "ic_home.png";
            //homePage.Title = AppResources.Home;
            BottomBarPageExtensions.SetTabColor(homePage, Color.FromHex("#0075E6"));
            this.Children.Add(homePage);

            //Catalogue
            var cataloguePage = new Test();

            cataloguePage.Title = "Test";
            //cataloguePage.Icon = "ic_catalogue.png";
            BottomBarPageExtensions.SetTabColor(cataloguePage, Color.FromHex("#0B87FF"));
            this.Children.Add(cataloguePage);

            ////Orders list
            //var ordersListPage = new OrdersListPage();
            //ordersListPage.Title = AppResources.Orders;
            //ordersListPage.Icon = "ic_orders.png";
            //BottomBarPageExtensions.SetTabColor(ordersListPage, Color.FromHex("#0B8900"));
            //this.Children.Add(ordersListPage);

            ////Orders list
            //var cartPage = new CartPage();
            //cartPage.Title = AppResources.Cart;
            //cartPage.Icon = "ic_cart.png";
            //BottomBarPageExtensions.SetTabColor(cartPage, Color.FromHex("#0B8900"));
            //this.Children.Add(cartPage);

            ////Profile
            //var profilePage = new ProfilePage();
            //profilePage.Icon = "ic_profile.png";
            //profilePage.Title = AppResources.Profile;
            //BottomBarPageExtensions.SetTabColor(profilePage, Color.FromHex("#0054A5"));
            //this.Children.Add(profilePage);

            ////Settings
            //var settingsPage = new SettingsMainPage();
            //settingsPage.Icon = "ic_settings.png";
            //settingsPage.Title = AppResources.Settings;
            //BottomBarPageExtensions.SetTabColor(settingsPage, Color.FromHex("#004282"));
            //this.Children.Add(settingsPage);

            //Check is must redirect to login
            //if (Session.Current == "")
            //    LogOut();
            //else
            //{
            //    var ret = Auth.TokenValidate(Session.Current);
            //    if (ret.succeed == false)
            //    {
            //        LogOut();
            //    }
            //}
        }
Esempio n. 2
0
        public App()
        {
            //InitializeComponent();

            MainPage = new NavigationPage(new RootPage());

            BottomBarPage bottomBarPage = new BottomBarPage();

            //MainPage = new BarPage();


            string[] tabTitles      = { "Favorites", "Friends", "Nearby", "Recents", "Restaurants" };
            string[] tabColors      = { null, "#5D4037", "#7B1FA2", "#FF5252", "#FF9800" };
            int[]    tabBadgeCounts = { 0, 1, 5, 3, 4 };
            string[] tabBadgeColors = { "#000000", "#FF0000", "#000000", "#000000", "#000000" };

            FileImageSource iconFavorites = (FileImageSource)FileImageSource.FromFile("ic_home.png");
            var             tabPageHome   = new MainPage()
            {
                Icon = iconFavorites
            };

            BottomBarPageExtensions.SetTabColor(tabPageHome, Color.FromHex("#0075E6"));
            bottomBarPage.Children.Add(tabPageHome);

            FileImageSource iconTest    = (FileImageSource)FileImageSource.FromFile("ic_catalogue.png");
            var             tabPageTest = new Test()
            {
                Icon = iconTest
            };

            BottomBarPageExtensions.SetTabColor(tabPageTest, Color.FromHex("#0075E6"));
            bottomBarPage.Children.Add(tabPageTest);


            //for (int i = 0; i < tabTitles.Length; ++i)
            //{
            //    string title = tabTitles[i];
            //    string tabColor = tabColors[i];
            //    int tabBadgeCount = tabBadgeCounts[i];
            //    string tabBadgeColor = tabBadgeColors[i];

            //    FileImageSource icon = (FileImageSource)FileImageSource.FromFile(string.Format("ic_{0}.png", title.ToLowerInvariant()));

            //    // create tab page
            //    var tabPage = new MainPage()
            //    {
            //        Title = title,
            //        Icon = icon
            //    };

            //    // set tab color
            //    if (tabColor != null)
            //    {
            //        BottomBarPageExtensions.SetTabColor(tabPage, Color.FromHex(tabColor));
            //    }

            //    // Set badges
            //    BottomBarPageExtensions.SetBadgeCount(tabPage, tabBadgeCount);
            //    BottomBarPageExtensions.SetBadgeColor(tabPage, Color.FromHex(tabBadgeColor));

            //    // set label based on title
            //    tabPage.UpdateLabel();

            //    // add tab pag to tab control
            //    bottomBarPage.Children.Add(tabPage);
            //}

            MainPage = bottomBarPage;
        }