Esempio n. 1
0
        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();
                }
            }
        }
Esempio n. 2
0
        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));
            }
        }