Ejemplo n.º 1
0
        public static void NavigateTo(string regionName, FrameworkElement view)
        {
            var regionManager = NavigationRepo.Regions.FirstOrDefault(t => NavigationRegion.GetRegionName(t.Region) == regionName);

            if (regionManager != null)
            {
                AdaptView(view, regionManager);
                regionManager.Views.Push(view);
            }
        }
Ejemplo n.º 2
0
        public static bool CanGoBack(string regionName)
        {
            var regionManager = NavigationRepo.Regions.FirstOrDefault(t => NavigationRegion.GetRegionName(t.Region) == regionName);

            if (regionManager != null)
            {
                return(regionManager.Views.Count() > 1);
            }
            return(false);
        }
Ejemplo n.º 3
0
        public static void GoBack(string regionName)
        {
            var regionManager = NavigationRepo.Regions.FirstOrDefault(t => NavigationRegion.GetRegionName(t.Region) == regionName);

            if (regionManager != null)
            {
                regionManager.Views.Pop();
                var view = regionManager.Views.Peek();
                AdaptView(view, regionManager);
            }
        }
Ejemplo n.º 4
0
        public static void ClearViews(string regionName)
        {
            var regionManager = NavigationRepo.Regions.FirstOrDefault(t => NavigationRegion.GetRegionName(t.Region) == regionName);

            if (regionManager != null)
            {
                regionManager.Views.Clear();
                if (regionManager.Region is ContentControl)
                {
                    ((ContentControl)regionManager.Region).Content = null;
                }
                else if (regionManager.Region is ItemsControl)
                {
                    ((ItemsControl)regionManager.Region).Items.Clear();
                }
                else
                {
                    throw new InvalidOperationException("The container is not a vaild region.");
                }
            }
        }