示例#1
0
        public override void ChangePresentation(MvxPresentationHint hint)
        {
            var closeHint = hint as MvxClosePresentationHint;
            if (closeHint != null)
            {
                if (_currentModal != null)
                {
                    ((UIViewController)_currentModal).DismissViewController(true, null);
                    return;
                }

                for (int i = _generalNavigationController.ViewControllers.Length - 1; i >= 1; i--)
                {
                    var vc = _generalNavigationController.ViewControllers[i];
                    var touchView = vc as IMvxIosView;
                    if (touchView != null && touchView.ViewModel == closeHint.ViewModelToClose)
                    {
                        _generalNavigationController.PopToViewController(_generalNavigationController.ViewControllers[i - 1], true);
                        return;
                    }
                }

                //If it didnt trigger above it's because it was probably the root.
                _generalNavigationController.PopToRootViewController(true);
            }
        }
        public override void ChangePresentation(MvxPresentationHint hint)
        {
            base.ChangePresentation(hint);

            if (hint is MvxClosePresentationHint)
            {
                Close((hint as MvxClosePresentationHint).ViewModelToClose);
            }
        }
        public bool ChangePresentation(MvxPresentationHint hint)
        {
            var closeHint = hint as MvxClosePresentationHint;
            if (closeHint == null)
            {
                throw new NotImplementedException();
            }

            return Close(closeHint.ViewModelToClose);
        }
 public override void ChangePresentation(MvxPresentationHint hint)
 {
     if (this.MasterDetailPresenter != null)
     {
         this.MasterDetailPresenter.ChangePresentation(hint);
     }
     else
     {
         base.ChangePresentation(hint);
     }
 }
        public override void ChangePresentation(MvxPresentationHint hint)
        {
            if (base.HandlePresentationChange(hint)) return;

            if (hint is MvxClosePresentationHint)
            {
                this.Close((hint as MvxClosePresentationHint).ViewModelToClose);
                return;
            }

            MvxTrace.Warning("Hint ignored {0}", hint.GetType().Name);
        }
        public override void ChangePresentation(MvxPresentationHint hint)
        {
            if (HandlePresentationChange(hint)) return;

            var presentationHint = hint as MvxClosePresentationHint;
            if (presentationHint != null)
            {
                this.Close(presentationHint.ViewModelToClose);
                return;
            }

            MvxTrace.Warning("Hint ignored {0}", hint.GetType().Name);
        }
        public override void ChangePresentation(MvxPresentationHint hint)
        {
            if (hint is MvxPanelPopToRootPresentationHint)
            {
                var mainView = _contentControl.Content as MainView;
                if (mainView != null)
                {
                    mainView.PopToRoot();
                }
            }

            base.ChangePresentation(hint);
        }
        public override void ChangePresentation(MvxPresentationHint hint)
        {
            if (HandlePresentationChange(hint)) return;

            if (hint is MvxClosePresentationHint)
            {
                var mainPage = MvxFormsApp.MainPage as NavigationPage;

                if (mainPage == null)
                {
                    Mvx.TaggedTrace("MvxFormsPresenter:ChangePresentation()", "Oops! Don't know what to do");
                }
                else
                {
                    mainPage.PopAsync();
                }
            }
        }
        /// <summary>
        /// Processes the pop to root presentation.
        /// </summary>
        /// <param name="hint">The hint.</param>
        private void ProcessPopToRootPresentation(MvxPresentationHint hint)
        {
            var popHint = hint as MvxPanelPopToRootPresentationHint;
            if (popHint != null)
            {
                var panelHint = popHint;

                switch (panelHint.Panel)
                {
                    case MvxPanelEnum.Center:
                        if (CentrePanelUiNavigationController() != null)
                            CentrePanelUiNavigationController().PopToRootViewController(false);
                        break;
                    case MvxPanelEnum.Left:
                        if (LeftPanelUiNavigationController() != null)
                            LeftPanelUiNavigationController().PopToRootViewController(false);
                        break;
                    case MvxPanelEnum.Right:
                        if (RightPanelUiNavigationController() != null)
                            RightPanelUiNavigationController().PopToRootViewController(false);
                        break;
                }
            }
        }
        public override void ChangePresentation(MvxPresentationHint hint)
        {
            if (this.HandlePresentationChange(hint)) return;

            MvxTrace.Warning("Hint ignored {0}", hint.GetType().Name);
        }
        /// <summary>
        /// Processes the active panel presentation.
        /// </summary>
        /// <param name="hint">The hint.</param>
        private void ProcessActivePanelPresentation(MvxPresentationHint hint)
        {
            var activePresentationHint = hint as MvxActivePanelPresentationHint;
            if (activePresentationHint != null)
            {
                var panelHint = activePresentationHint;

                _activePanel = panelHint.ActivePanel;

                if (panelHint.ShowPanel)
                {
                    ShowPanel(panelHint.ActivePanel);
                }
            }
        }
        /*
 * Create the page for the modal ViewModel. 
 * Create class attribute(yay) for the Page class and evaluate it here, pushing the new page with PushModal
 * 
 * var detailPage = new DetailPage ();
...
await Navigation.PushModalAsync (detailPage);
 */

        public override async void ChangePresentation(MvxPresentationHint hint)
        {
            if (HandlePresentationChange(hint)) return;

            if (hint is MvxClosePresentationHint)
            {
                var mainPage = Application.Current.MainPage as NavigationPage;

                if (mainPage == null)
                {
                    Mvx.TaggedTrace("MvxFormsPresenter:ChangePresentation()", "Shit, son! Don't know what to do");
                }
                else
                {

                    try
                    {
                        if (mainPage.CurrentPage.BindingContext is IKillable)
                        {
                            ((IKillable)mainPage.CurrentPage.BindingContext).Kill();
                        }

                        if (mainPage.CurrentPage is IKillable)
                        {
                            ((IKillable)mainPage.CurrentPage).Kill();
                        }

                        //do not switch statements.Will break lifecycle
                        if (_viewStack.Any())
                        {
                            _viewStack.Remove(_viewStack.Last());
                        }

                        // Pop differently if modal
                        if (IsModal(hint as MvxClosePresentationHint))
                        {
                            await mainPage.Navigation.PopModalAsync(true);
                        }
                        else
                        {
                            await mainPage.PopAsync();
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message);
                    }

                }
            }
        }
 public async void ChangePresentation(MvxPresentationHint hint)
 {
     if (hint is MvxClosePresentationHint)
     {
         Page page = await ((NavigationPage) this.masterDetailPage.Detail).PopAsync();
     }
 }
示例#14
0
 public bool ChangePresentation(MvxPresentationHint hint)
 {
     Hints.Add(hint);
     return true;
 }
 public bool ChangePresentation(MvxPresentationHint hint)
 {
     throw new NotImplementedException();
 }
 public bool ChangePresentation(MvxPresentationHint hint)
 {
     var navigation = Mvx.Resolve<IMvxConsoleNavigation>();
     return this.RequestMainThreadAction(() => navigation.ChangePresentation(hint));
 }
        /// <summary>
        /// Processes the reset root presentation.
        /// </summary>
        /// <param name="hint">The hint.</param>
        private void ProcessResetRootPresentation(MvxPresentationHint hint)
        {
            var popHint = hint as MvxPanelResetRootPresentationHint;
            if (popHint != null)
            {
                var panelHint = popHint;

                switch (panelHint.Panel)
                {
                    case MvxPanelEnum.Center:
                        _multiPanelController.CenterPanel = null;
                        break;
                    case MvxPanelEnum.Left:
                        _multiPanelController.LeftPanel = null;
                        break;
                    case MvxPanelEnum.Right:
                        _multiPanelController.RightPanel = null;
                        break;
                }
            }
        }
 public bool ChangePresentation(MvxPresentationHint hint)
 {
     return this.RequestMainThreadAction(() => this._presenter.ChangePresentation(hint));
 }
        /// <summary>
        /// Changes the presentation.
        /// </summary>
        /// <param name="hint">The hint.</param>
        public override void ChangePresentation(MvxPresentationHint hint)
        {
            ProcessActivePanelPresentation(hint);
            ProcessResetRootPresentation(hint);
            ProcessPopToRootPresentation(hint);

            base.ChangePresentation(hint);
        }
 public override void ChangePresentation(MvxPresentationHint hint)
 {
     base.ChangePresentation(hint);
 }