コード例 #1
0
        public NavigationPage GetCurrentRootPage()
        {
            var masterDetailPage = _pageProvider.GetMasterDetailPage();
            var rootPage         = masterDetailPage?.Detail;

            return(rootPage as NavigationPage);
        }
コード例 #2
0
        public async Task SetRootAsync(Type viewmodelType)
        {
            if (viewmodelType == null)
            {
                throw new ArgumentNullException(nameof(viewmodelType));
            }

            var rootPage = await GetRootPage(viewmodelType);

            var masterDetailPage = _masterDetailPageProvider.GetMasterDetailPage();

            masterDetailPage.Detail = rootPage;

            // TODO: improve log message
            _logger.LogDebug("Changed root page!");
        }
コード例 #3
0
        // TODO: refactor the page creation logic out of here
        protected override async void OnStart()
        {
            base.OnStart();

            await _databaseInitializationService.InitializeDatabaseAsync();

            await _resourceInitializationService.InitializeResourcesAsync();

            var mainPage   = _masterDetailPageProvider.GetMasterDetailPage();
            var masterPage = _pageFactory.CreatePage <MasterPage>();

            mainPage.Master = masterPage;
            await masterPage.InitializeViewmodelAsync(null);

            MainPage = mainPage;
            _logger.LogInformation("Application has successfully started!");
        }
コード例 #4
0
        private void OnEntrySelected(object sender, SelectedItemChangedEventArgs e)
        {
            if (SelectCommand == null)
            {
                return;
            }

            var entry = e.SelectedItem;

            if (SelectCommand.CanExecute(entry))
            {
                SelectCommand.Execute(entry);
            }

            var masterDetailPage = _pageProvider.GetMasterDetailPage();

            masterDetailPage.IsPresented = false;
        }