Exemple #1
0
        public virtual async Task MoveForwardAsync()
        {
            if (!CanMoveForward)
            {
                return;
            }

            var currentPage = _currentPage;

            if (currentPage != null)
            {
                var vm = currentPage.ViewModel;
                if (vm != null)
                {
                    var result = await vm.SaveAndCloseViewModelAsync();

                    if (!result)
                    {
                        return;
                    }
                }
            }

            var indexOfNextPage = NavigationStrategy.GetIndexOfNextPage(this);

            SetCurrentPage(indexOfNextPage);

            MovedForward.SafeInvoke(this);
        }
Exemple #2
0
        public virtual async Task MoveForwardAsync()
        {
            if (!CanMoveForward)
            {
                if (_currentPage?.ViewModel is IWizardPageViewModel wizardPageViewModel)
                {
                    wizardPageViewModel.EnableValidationExposure();
                }

                return;
            }

            var currentPage = _currentPage;

            if (currentPage != null)
            {
                var vm = currentPage.ViewModel;
                if (vm != null)
                {
                    var result = await vm.SaveAndCloseViewModelAsync();

                    if (!result)
                    {
                        return;
                    }
                }
            }

            var indexOfNextPage = NavigationStrategy.GetIndexOfNextPage(this);

            SetCurrentPage(indexOfNextPage);

            RaiseMovedForward();
        }
Exemple #3
0
        public virtual async Task MoveForwardAsync()
        {
            if (!CanMoveForward)
            {
                if (_currentPage?.ViewModel is IWizardPageViewModel wizardPageViewModel)
                {
                    wizardPageViewModel.EnableValidationExposure();
                }

                return;
            }

            var indexOfNextPage = NavigationStrategy.GetIndexOfNextPage(this);
            var isMoving        = RaiseMovingForward(_currentPage, Pages.ElementAt(indexOfNextPage));

            if (!isMoving)
            {
                Log.Debug("Cancel move based on raised event returned arguments");
                return;
            }

            // Note: keep *after* the RaiseMovingForward. This allows any vm to handle events and
            // correctly unsubscribe in the CloseAsync method
            var currentPage = _currentPage;

            if (currentPage is not null)
            {
                var viewModel = currentPage.ViewModel;
                if (viewModel is not null)
                {
                    var result = await viewModel.SaveAndCloseViewModelAsync();

                    if (!result)
                    {
                        return;
                    }
                }
            }

            OnMovingForward();

            SetCurrentPage(indexOfNextPage);

            OnMovedForward();

            RaiseMovedForward();
        }