private void ProceedToHomePage() { this.navBar = new BottomNavBar(); this.bottomBarPage = navBar.GetBottomBar(); NavigationPage.SetHasNavigationBar(bottomBarPage, false); Application.Current.MainPage = new NavigationPage(bottomBarPage); }
public async Task <bool> Login(string username, string password) { using (UserDialogs.Instance.Loading(Resource.GetDetails, null, null, true, MaskType.Gradient)) { restService = new RestService(); DatabaseService db = new DatabaseService(); if (!await restService.Login(username, password)) { return(false); } UserTable user = db.GetUserInfo(); if (!await restService.GetUser(user)) { db.ClearTablesForUserShifts(); await UserDialogs.Instance.AlertAsync(Resource.GetDetailsError, Resource.Alert, Resource.Okay); return(false); } if (!await restService.GetCompanies(user.DriverId)) { db.ClearTablesForUserShifts(); await UserDialogs.Instance.AlertAsync(Resource.GetDetailsError, Resource.Alert, Resource.Okay); return(false); } // TODO: Fix server call for vehicles //if (!await restService.GetVehicles()) //{ // db.ClearTablesForUserShifts(); // await UserDialogs.Instance.AlertAsync(Resource.GetDetailsError, Resource.Alert, Resource.Okay); // return false; //} // TODO: Fix server call for shifts //if (!await restService.GetShifts(user.DriverId)) //{ // db.ClearTablesForUserShifts(); // await UserDialogs.Instance.AlertAsync(Resource.GetDetailsError, Resource.Alert, Resource.Okay); // return false; //} bottomBarPage = navBar.GetBottomBar(); NavigationPage.SetHasNavigationBar(bottomBarPage, false); loadPage = new NavigationPage(bottomBarPage); MessagingCenter.Send <string>("ReloadPage", "ReloadPage"); MessagingCenter.Send <string>("ReloadOthersPage", "ReloadOthersPage"); MessagingCenter.Send <string>("UpdateVehicles", "UpdateVehicles"); Application.Current.MainPage = loadPage; return(true); } }
public BottomBarPage GetBottomBar() { BottomBarPage bottomBarPage = new BottomBarPage() { FixedMode = true, BarTheme = BottomBarPage.BarThemeTypes.DarkWithoutAlpha }; if (Device.OS == TargetPlatform.iOS) { bottomBarPage.BarTextColor = Color.Black; } else { bottomBarPage.BarTextColor = Color.White; } MenuViewModel menuVM = new MenuViewModel(); foreach (MenuItem item in menuVM.MenuPageList) { switch (item.Title) { case "Home": HomePage home = new HomePage(); FileImageSource homeIcon = (FileImageSource)FileImageSource.FromFile(string.Format(item.ImageSource, item.Title.ToLowerInvariant())); home.Title = item.Title; home.Icon = homeIcon; bottomBarPage.Children.Add(home); break; case "Vehicles": VehiclesPage vehicle = new VehiclesPage(); vehicle.AddToolBar(); FileImageSource vehicleIcon = (FileImageSource)FileImageSource.FromFile(string.Format(item.ImageSource, item.Title.ToLowerInvariant())); vehicle.Title = item.Title; vehicle.Icon = vehicleIcon; bottomBarPage.Children.Add(vehicle); break; case "History": HistoryPage history = new HistoryPage(); FileImageSource historyIcon = (FileImageSource)FileImageSource.FromFile(string.Format(item.ImageSource, item.Title.ToLowerInvariant())); history.Title = item.Title; history.Icon = historyIcon; bottomBarPage.Children.Add(history); break; case "Add Shift": AddShiftPage addShift = new AddShiftPage(); FileImageSource addShiftIcon = (FileImageSource)FileImageSource.FromFile(string.Format(item.ImageSource, item.Title.ToLowerInvariant())); addShift.Title = item.Title; addShift.Icon = addShiftIcon; bottomBarPage.Children.Add(addShift); break; } } OthersPage other = new OthersPage(); bottomBarPage.Children.Add(other); return(bottomBarPage); }