public async Task LogoutAsync() { NavigationPage detail = Detail as NavigationPage; // Home (BannerView/AppView) -> Dialogs var homeView = detail.Navigation.NavigationStack.FirstOrDefault(); if (homeView != null) { detail.Navigation.InsertPageBefore( new LoginView(), homeView); } else { StackAppView(new LoginView()); } while (!(detail.CurrentPage is LoginView)) { await Detail.Navigation.PopAsync(); } BaseViewModels baseModels = ((DeployApp)Application.Current) .BaseViewModels; if (baseModels.AuthViewModel.IsAuthenticated) { baseModels.AuthViewModel.Platform.Permit.Invalid(); } }
public App() { InitializeComponent(); // This is helps to trace issues with // the API calls on the server _log = new LogService(Path.Combine( Path.GetTempPath(), "NesterLog")); _baseModels = new BaseViewModels(); _mainSideView = new MainView(); MainPage = _mainSideView; }
public async Task GoHomeAsync() { NavigationPage detail = Detail as NavigationPage; // Home (BannerView/AppView) -> Dialogs var homeView = detail.Navigation.NavigationStack.FirstOrDefault(); if (homeView == null) { BannerView noAppsSign = new BannerView(); StackAppView(noAppsSign); } else { bool isAppView = homeView is AppView; if (!isAppView) { // An appView is needed. BaseViewModels baseModels = ((DeployApp)Application.Current) .BaseViewModels; AppViewModel loadAppViewModel = baseModels.AppCollectionViewModel .AppModels.FirstOrDefault(); if (loadAppViewModel != null) { detail.Navigation.InsertPageBefore( await GetAppViewAsync(loadAppViewModel), homeView); } } while (detail.Navigation.NavigationStack.Count > 1) { await Detail.Navigation.PopAsync(); } } }
public async Task UpdateViewAsync(AppViewModel loadAppViewModel = null) { BaseViewModels baseModels = ((DeployApp)Application.Current) .BaseViewModels; if (loadAppViewModel == null) { // No appmodel provided - get one from the collection loadAppViewModel = baseModels.AppCollectionViewModel .AppModels.FirstOrDefault(); if (loadAppViewModel == null) { BannerView noAppsSign = new BannerView(); StackAppView(noAppsSign); return; } } bool isAppViewCurrent = ((Detail as NavigationPage).CurrentPage is AppView); // if the the app is currently displayed - ignore load. if (isAppViewCurrent) { if (((Detail as NavigationPage).CurrentPage as AppView).AppViewModel.EditApp.Id != loadAppViewModel.EditApp.Id) { StackAppView(await GetAppViewAsync(loadAppViewModel)); } } else { StackAppView(await GetAppViewAsync(loadAppViewModel)); } }
public MainPage() { InitializeComponent(); BindingContext = new BaseViewModels(); }