Ejemplo n.º 1
0
        private void NavigationLogic(ShowViewEvent evt)
        {
            if (CurrentView != null && CurrentView.ID == evt.ID)
            {
                return;
            }

            if (evt.ID == ViewList.Views.Back && PreviousView != null)
            {
                if (PreviousView.Count() > 0)
                {
                    CurrentView = PreviousView.Pop();
                    if (CurrentView != null && !CurrentView.IsOverLay)
                    {
                        PreviousView.Clear();
                    }
                }

                return;
            }

            if (AvalableViews.ContainsKey(evt.ID))
            {
                PreviousView.Push(CurrentView);
                CurrentView = AvalableViews[evt.ID];
                if (!CurrentView.IsOverLay)
                {
                    PreviousView.Clear();
                }
            }

            FocusManager.SetIsFocusScope((DependencyObject)CurrentView.View, true);

            CommandManager.InvalidateRequerySuggested();
        }
 /// <summary>
 /// Navigates to the target view.
 /// </summary>
 /// <param name="view">The view.</param>
 public void NavigateTo(UIElement view)
 {
     if (CurrentView == null)
     {
         CurrentView = ContentHost.Children.Count > 0 ? ContentHost.Children[0] : null;
     }
     PreviousView.Push(CurrentView);
     CurrentView = null;
     CurrentView = view;
     ContentHost.Children.Clear();
     ContentHost.Children.Add(CurrentView);
 }