async void _navigationModal()
        {
            try
            {
                var vm = _xNavigation.ModalContentObject as XViewModel;

                if (vm == null)
                {
                    var mRoot = _xamarinNavigation.ModalStack?.LastOrDefault();

                    if (mRoot != null)
                    {
                        var iPopOut = mRoot as XNavigationPageView;
                        if (iPopOut != null)
                        {
                            await iPopOut.AnimateOut();
                        }
                    }
                    await _xamarinNavigation.PopModalAsync();

                    return;
                }

                var rootFrame = XFrame.CreateRootFrame <XRootFrame>(_scope);
                rootFrame.IsModal = true;

                var frameManager = _scope.Resolve <IFrameManager>();

                vm.ParentModel = rootFrame;

                var rootNavigationVm = rootFrame.CreateContentModel <XNavigationPageViewModel>();

                var initalViewController = frameManager.Init(rootFrame, rootNavigationVm);



                rootFrame.NavigateTo(vm);

                var i = initalViewController as XNavigationPageView;
                if (i != null)
                {
                    i.PrepForAnimation();
                }

                await _xamarinNavigation.PushModalAsync(initalViewController, true);

                if (i != null)
                {
                    i.AnimateIn();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
예제 #2
0
            public NavigationPackage(ILifetimeScope container)
            {
                _container = container;

                var frameManager = _container.Resolve <IFrameManager>();

                RootFrame = XFrame.CreateRootFrame <XRootFrame>(_container);
                var rootNavigationVm = RootFrame.CreateContentModel <XNavigationPageViewModel>();

                Page      = frameManager.Init(RootFrame, rootNavigationVm);
                ViewModel = RootFrame.CreateContentModel <T>();
            }
예제 #3
0
파일: XCore.cs 프로젝트: sk8tz/Xamling-Core
        public Page InitRoot()
        {
            var glue = new TGlue();

            glue.Init();

            Container = glue.Container;

            ContainerHost.Container = Container; //sometimes we need to resolve around the place outside of strucutre.

            RootFrame = XFrame.CreateRootFrame <XRootFrame>(glue.Container.BeginLifetimeScope());

            var rootPage = GetRootPage <TRootViewModel>();

            return(rootPage);
        }
            public NavigationPackage(ILifetimeScope container)
            {
                _container = container;

                var frameManager = _container.Resolve <IXUWPFrameManager>();

                _frameManager = frameManager;
                RootFrame     = XFrame.CreateRootFrame <XUWPRootFrame>(_container);
                var rootNavigationVm = RootFrame.CreateContentModel <XUWPNavigationPageViewModel>();

                Page      = frameManager.Init(RootFrame, rootNavigationVm, false);
                ViewModel = RootFrame.CreateContentModel <T>();


                RootFrame.Activated   += RootFrame_Activated;
                RootFrame.Deactivated += RootFrame_Deactivated;
            }
예제 #5
0
        public void InitRoot()
        {
            var glue = new TGlue();

            glue.Init();

            Container = glue.Container;

            ContainerHost.Container = Container; //sometimes we need to resolve around the place outside of strucutre.

            RootFrame = XFrame.CreateRootFrame <XUWPRootFrame>(glue.Container.BeginLifetimeScope());

            //if (!(typeof(TRootViewModel) is XUWPMasterDetailViewModel))
            //{
            //    RootFrame.Activated += RootFrame_Activated;
            //    RootFrame.Deactivated += RootFrame_Deactivated;
            //}

            _init <TRootViewModel>();
        }