protected virtual Task <bool> ClosePage(IMvxViewModel viewModel, MvxBasePresentationAttribute attribute)
        {
            var currentView = _rootFrame.Content as IMvxView;

            if (currentView == null)
            {
                return(Task.FromResult(false));
            }

            if (currentView.ViewModel != viewModel)
            {
                return(Task.FromResult(false));
            }

            if (!_rootFrame.CanGoBack)
            {
                return(Task.FromResult(false));
            }

            _rootFrame.GoBack();

            HandleBackButtonVisibility();

            return(Task.FromResult(true));
        }
Пример #2
0
        protected virtual bool ClosePage(IMvxViewModel viewModel, MvxBasePresentationAttribute attribute)
        {
            var currentView = _rootFrame.Content as IMvxView;

            if (currentView == null)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe has no current page");
                return(false);
            }

            if (currentView.ViewModel != viewModel)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe's current page is not the view for the requested viewmodel");
                return(false);
            }

            if (!_rootFrame.CanGoBack)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe refuses to go back");
                return(false);
            }

            _rootFrame.GoBack();

            HandleBackButtonVisibility();

            return(true);
        }
Пример #3
0
        public override void Close(IMvxViewModel viewModel)
        {
            var currentView = _rootFrame.Content as IMvxView;

            if (currentView == null)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe has no current page");
                return;
            }

            if (currentView.ViewModel != viewModel)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe's current page is not the view for the requested viewmodel");
                return;
            }

            if (!_rootFrame.CanGoBack)
            {
                Mvx.Warning("Ignoring close for viewmodel - rootframe refuses to go back");
                return;
            }

            _rootFrame.GoBack();

            HandleBackButtonVisibility();
        }