예제 #1
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();
        }
예제 #2
0
        public virtual async Task MoveBackAsync()
        {
            if (!CanMoveBack)
            {
                return;
            }

            var indexOfPreviousPage = NavigationStrategy.GetIndexOfPreviousPage(this);

            var isMoving = RaiseMovingBack(_currentPage, Pages.ElementAt(indexOfPreviousPage));

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

            OnMovingBack();

            SetCurrentPage(indexOfPreviousPage);

            OnMovedBack();

            RaiseMovedBack();
        }
예제 #3
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);
        }
예제 #4
0
 private void SaveNavigation(Memory memory)
 {
     memory.Set("navigating", navigating);
     if (navigating)
     {
         memory.Set("navigation_strategy", NavigationStrategy.ToString());
         memory.Set("navigation_steps", String.Join(",", Steps.ConvertAll(s => s.Reference).ToArray()));
         memory.Set("navigation_locks", String.Join(",", Steps.ConvertAll(s => s.LockNavigation.ToString()).ToArray()));
         memory.Set("navigation_completed", String.Join(",", Steps.ConvertAll(s => stepCompleted.ContainsKey(s) && stepCompleted[s]).ConvertAll(b => b.ToString()).ToArray()));
         memory.Set("navigation_elems_completed", String.Join(",", Steps.ConvertAll(s => completedElementsForStep.ContainsKey(s) ? completedElementsForStep[s] : 0).ConvertAll(i => i.ToString()).ToArray()));
     }
 }
예제 #5
0
        public virtual async Task MoveBackAsync()
        {
            if (!CanMoveBack)
            {
                return;
            }

            var indexOfPreviousPage = NavigationStrategy.GetIndexOfPreviousPage(this);

            SetCurrentPage(indexOfPreviousPage);

            RaiseMovedBack();
        }
예제 #6
0
        public virtual async Task MoveBackAsync()
        {
            if (!CanMoveBack)
            {
                return;
            }

            var indexOfPreviousPage = NavigationStrategy.GetIndexOfPreviousPage(this);

            SetCurrentPage(indexOfPreviousPage);

            MovedBack?.Invoke(this, EventArgs.Empty);
        }
 private void SaveNavigation()
 {
     PlayerPrefs.SetInt("navigating", navigating ? 1 : 0);
     if (navigating)
     {
         PlayerPrefs.SetString("navigation_strategy", NavigationStrategy.ToString());
         PlayerPrefs.SetString("navigation_steps", String.Join(",", Steps.ConvertAll(s => s.Reference).ToArray()));
         PlayerPrefs.SetString("navigation_locks", String.Join(",", Steps.ConvertAll(s => s.LockNavigation.ToString()).ToArray()));
         PlayerPrefs.SetString("navigation_completed", String.Join(",", Steps.ConvertAll(s => stepCompleted.ContainsKey(s) ? stepCompleted[s] : false).ConvertAll(b => b.ToString()).ToArray()));
         PlayerPrefs.SetString("navigation_elems_completed", String.Join(",", Steps.ConvertAll(s => completedElementsForStep.ContainsKey(s) ? completedElementsForStep[s] : 0).ConvertAll(i => i.ToString()).ToArray()));
     }
     PlayerPrefs.Save();
 }
예제 #8
0
        public virtual async Task MoveBackAsync()
        {
            if (!CanMoveBack)
            {
                return;
            }

            int indexOfPreviousPage = NavigationStrategy.GetIndexOfPreviousPage(this);

            SetCurrentPage(indexOfPreviousPage);

            MovedBack.SafeInvoke(this);
        }
예제 #9
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();
        }
        /// <summary>
        /// Crea una Xml Bag in base alla strategia richiesta
        /// </summary>
        /// <param name="xmlString">xml in formato stringa da valutare</param>
        /// <param name="navigationStrategy">Strategia di navigazione</param>
        /// <param name="editable">Se le operazioni sull'xml sono in sola lettura conviene utilizzare in modalita non modificabile, altrimenti true</param>
        /// <returns>Implementazione della strategia di navigazione</returns>
        public static IXmlBag Create(string xmlString, NavigationStrategy navigationStrategy = NavigationStrategy.XElementNavigator, bool editable = false)
        {
            if (xmlString == null)
            {
                throw new ArgumentNullException(nameof(xmlString));
            }

            switch (navigationStrategy)
            {
            case NavigationStrategy.XPathNavigator:
                return(new XPathNavigatorBag(xmlString, editable));

            case NavigationStrategy.XElementNavigator:
                return(new XElementBag(xmlString));

            default:
                throw new ArgumentOutOfRangeException(nameof(navigationStrategy));
            }
        }
예제 #11
0
 public NavigationContext(NavigationStrategy strategy)
 {
     this.navigationStrategy = strategy;
 }
예제 #12
0
 /// <summary>
 /// Costruisce un'xml bag che valuta gli xPath a seconda della strategia impostata
 /// </summary>
 /// <param name="xmlString">Xml da valutare</param>
 /// <param name="navigationStrategy">Strategia, default:XElementNavigator</param>
 public XmlBag(string xmlString, NavigationStrategy navigationStrategy = NavigationStrategy.XElementNavigator)
 {
     _currentXmlBag = XmlBagFactory.Create(xmlString, navigationStrategy);
 }
예제 #13
0
 public NavigationContext(NavigationStrategy strategy)
 {
     this.navigationStrategy = strategy;
 }