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(); }
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(); }
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); }
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())); } }
public virtual async Task MoveBackAsync() { if (!CanMoveBack) { return; } var indexOfPreviousPage = NavigationStrategy.GetIndexOfPreviousPage(this); SetCurrentPage(indexOfPreviousPage); RaiseMovedBack(); }
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(); }
public virtual async Task MoveBackAsync() { if (!CanMoveBack) { return; } int indexOfPreviousPage = NavigationStrategy.GetIndexOfPreviousPage(this); SetCurrentPage(indexOfPreviousPage); MovedBack.SafeInvoke(this); }
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)); } }
public NavigationContext(NavigationStrategy strategy) { this.navigationStrategy = strategy; }
/// <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); }