private async Task <bool> TryShowPage(MvxViewModelRequest request)
        {
            var page = MvxPresenterHelpers.CreatePage <Page>(request);

            if (page == null)
            {
                return(false);
            }

            var viewModel = MvxPresenterHelpers.LoadViewModel(request);

            if (NavigationPage == null)
            {
                Xamarin.Forms.Forms.Init();
                NavigationPage = new NavigationPage(page);
                _rootFrame.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            }
            else
            {
                await NavigationPage.PushAsync(page);
            }

            page.BindingContext = viewModel;
            return(true);
        }
Ejemplo n.º 2
0
        private async Task <bool> TryShowPage(MvxViewModelRequest request)
        {
            var page = MvxPresenterHelpers.CreatePage <Page>(request);

            if (page == null)
            {
                return(false);
            }

            var viewModel = MvxPresenterHelpers.LoadViewModel(request);

            if (_navigationPage == null)
            {
                _navigationPage             = new NavigationPage(page);
                _window.RootViewController  = _navigationPage.CreateViewController();
                this.context.CurrentContext = _window.RootViewController;
            }
            else
            {
                await _navigationPage.PushAsync(page);
            }

            page.BindingContext = viewModel;
            return(true);
        }
Ejemplo n.º 3
0
        public static T CreatePage <T>(MvxViewModelRequest request)
            where T : class
        {
            var viewType = MvxPresenterHelpers.ResolveViewType(request.ViewModelType);

            if (viewType == null)
            {
                Mvx.Trace("Page not found for {0}", request.ViewModelType.Name);
                return(null);
            }

            var page = Activator.CreateInstance(viewType) as T;

            if (page == null)
            {
                Mvx.Error("Failed to create ContentPage {0}", viewType.Name);
            }
            return(page);
        }
Ejemplo n.º 4
0
        private bool TryShowPage(MvxViewModelRequest request)
        {
            if (this.NavigationProvider == null)
            {
                return(false);
            }

            var page = MvxPresenterHelpers.CreatePage <Page>(request);

            if (page == null)
            {
                return(false);
            }

            var viewModel = MvxPresenterHelpers.LoadViewModel(request);

            page.BindingContext = viewModel;

            this.NavigationProvider.Push(page);

            return(true);
        }