Esempio n. 1
0
        public void RequestNavigate(string regionName, string viewName, string stateName)
        {
            if (_isInTransition) return;
            _isInTransition = true;

            if (string.IsNullOrEmpty(regionName))
                throw new ArgumentNullException("regionName");

            if (string.IsNullOrEmpty(viewName))
                throw new ArgumentNullException("viewName");

            INavigationRegion region = EnsureRegion(regionName);
            NavigationDescriptor descriptor = ActivateView(viewName, region);
            ViewState viewState = EnsureState(regionName, viewName, stateName, descriptor);

            OnNavigationStart(_previousDescriptor, descriptor, viewState);

            Presenter.TransitionCompleted -= OnTransitionCompleted;

            if (_previousDescriptor != null && _previousDescriptor.ViewName != descriptor.ViewName)
            {
                _targetDescriptor = descriptor;
                _sourceDescriptor = _previousDescriptor;
                _targetState = viewState;
                Presenter.TransitionCompleted += OnTransitionCompleted;
                Presenter.ApplyTransition(_previousDescriptor.ViewResolver(), descriptor.ViewResolver());
            }
            else
            {
                PostTransition();
            }

            _previousDescriptor = descriptor;
        }
 public StateNavigationViewModel(ViewState viewState, NavigationDescriptor descriptor, string regionName)
 {
     _viewState = viewState;
     _descriptor = descriptor;
     _regionName = regionName;
     _navigationService = ServiceLocator.Current.GetInstance<INavigationService>();
     _navigationService.NavigationStart += OnNavigationStart;
 }
Esempio n. 3
0
 public StateChangingEventArgs(ViewState currentState, ViewState targetState)
 {
     CurrentState = currentState;
     TargetState = targetState;
 }
Esempio n. 4
0
 public StateChangedEventArgs(ViewState previousState, ViewState currentState)
 {
     PreviousState = previousState;
     CurrentState = currentState;
 }
Esempio n. 5
0
 private void OnNavigationStart(NavigationDescriptor sourceDescriptor, NavigationDescriptor targetDescriptor, ViewState targetState)
 {
     if (NavigationStart != null)
         NavigationStart(this,
             new NavigationEventArgs(sourceDescriptor, targetDescriptor) { TargetState = targetState });
 }
Esempio n. 6
0
 private void NotifyStateChanging(NavigationDescriptor descriptor, ViewState state)
 {
     if(descriptor.StateChanging != null)
         descriptor.StateChanging(state);
 }