public App() { // The root page of your application // The root page of your application //Current = this; // MainPage = new Profile(); BlobCache.ApplicationName = "CPMobile"; var authLoginToken = Settings.AuthLoginToken; if (string.IsNullOrEmpty(authLoginToken)) MainPage = new LoginPage(); else MainPage = new RootPage(); //var isLoggedIn = Properties.ContainsKey("IsLoggedIn")?(bool)Properties ["IsLoggedIn"]:false; // we remember if they're logged in, and only display the login page if they're not //if (isLoggedIn) // MainPage = new RootPage (); //else // MainPage = new RootPage(); }
public MenuPage(RootPage rootPage) { Icon = "menu.png"; Title = "menu"; // The Title property must be set. this.rootPage = rootPage; var logoutButton = new Button { Text = "Logout" }; logoutButton.Clicked += (sender, e) => { App.Current.LogOut(); }; var layout = new StackLayout { Spacing = 0, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("2C3E50"), }; var section = new TableSection() { new MenuCell {Text = "Home",Host= this,ImageSrc="home.png"}, new MenuCell {Text = "Favorites",Host= this,ImageSrc="favorite.png"}, new MenuCell {Text = "About",Host= this,ImageSrc="about.png"}, }; var root = new TableRoot() { section }; tableView = new MenuTableView() { Root = root, Intent = TableIntent.Data, BackgroundColor = Color.FromHex("2C3E50"), }; var settingView = new SettingsUserView(); //settingView.tapped += (object sender, TapViewEventHandler e) => //{ // Navigation.PushAsync(new Profile()); // // var home = new NavigationPage(new Profile()); // // rootPage.Detail = home; //}; layout.Children.Add(settingView); //layout.Children.Add(new BoxView() //{ // HeightRequest = 1, // BackgroundColor = AppStyle.DarkLabelColor, //}); layout.Children.Add(tableView); layout.Children.Add(logoutButton); Content = layout; var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (sender, e) => { NavigationPage profile = new NavigationPage(new Profile(settingView.profileViewModel.myProfile)) { BarBackgroundColor = App.BrandColor }; rootPage.Detail = profile; rootPage.IsPresented = false; }; settingView.GestureRecognizers.Add(tapGestureRecognizer); }
public MenuPage(RootPage rootPage) { Icon = "menu.png"; Title = "menu"; // The Title property must be set. this.rootPage = rootPage; var logoutButton = new Button { Text = "Logout", TextColor = Color.White }; logoutButton.Clicked += (sender, e) => { Settings.AuthLoginToken = ""; Navigation.PushModalAsync(new LoginPage()); //Special Handel for Android Back button if (Device.OS == TargetPlatform.Android) { Application.Current.MainPage = new LoginPage(); } }; var layout = new StackLayout { Spacing = 0, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("#FF9800"), }; var section = new TableSection() { new MenuCell { Text = "Home", Host = this, ImageSrc = "home_black.png" }, new MenuCell { Text = "Favorites", Host = this, ImageSrc = "star_black.png" }, new MenuCell { Text = "About", Host = this, ImageSrc = "about_black.png" }, }; var root = new TableRoot() { section }; tableView = new MenuTableView() { Root = root, Intent = TableIntent.Data, //BackgroundColor = Color.FromHex("2C3E50"), BackgroundColor = Color.White, }; var settingView = new SettingsUserView(); //settingView.tapped += (object sender, TapViewEventHandler e) => //{ // Navigation.PushAsync(new Profile()); // // var home = new NavigationPage(new Profile()); // // rootPage.Detail = home; //}; layout.Children.Add(settingView); //layout.Children.Add(new BoxView() //{ // HeightRequest = 1, // BackgroundColor = AppStyle.DarkLabelColor, //}); layout.Children.Add(tableView); layout.Children.Add(logoutButton); Content = layout; var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (sender, e) => { NavigationPage profile = new NavigationPage(new Profile(settingView.profileViewModel.myProfile)) { BarBackgroundColor = App.BrandColor, BarTextColor = Color.White }; rootPage.Detail = profile; rootPage.IsPresented = false; }; settingView.GestureRecognizers.Add(tapGestureRecognizer); }