public NavigationItem(TypeViewModel type)
 {
     Type = type;
 }
 private static void ExpandAll(TypeViewModel typeViewModel)
 {
     typeViewModel.IsExpanded = true;
     foreach (var type in typeViewModel.DerivedTypes)
     {
         ExpandAll(type);
     }
 }
 public void ShowGraph(TypeViewModel type)
 {
     Navigate(new NavigationItem(type));
 }
 private static void AdjustExpansion(TypeViewModel typeViewModel)
 {
     foreach (var type in typeViewModel.DerivedTypes)
     {
         if (type.DirectDescendantsCount > 3)
         {
             type.IsExpanded = false;
         }
         AdjustExpansion(type);
     }
 }
        private static TypeGraph CreateGraph(TypeViewModel typeViewModel, bool adjustExpansion)
        {
            var graph = new TypeGraph(true);

            if (adjustExpansion)
            {
                ExpandAll(typeViewModel);
                if (typeViewModel.DescendantsCount > 100)
                {
                    AdjustExpansion(typeViewModel);
                }
            }
            else
            {
                typeViewModel.IsExpanded = true;
                if (typeViewModel.DescendantsCount <= 100)
                {
                    ExpandAll(typeViewModel);
                }
            }
            var flattenedHierarchy = typeViewModel.FlattenedHierarchy;
            graph.AddVertexRange(flattenedHierarchy);
            foreach (var viewModel in flattenedHierarchy)
            {
                if (viewModel.BaseType == null || viewModel == typeViewModel)
                {
                    continue;
                }
                graph.AddEdge(new Edge<TypeViewModel>(viewModel, viewModel.BaseType));
            }
            return graph;
        }
 public void Show(TypeViewModel type, bool adjustExpansion)
 {
     _types = null;
     Type = type;
     Graph = CreateGraph(type, adjustExpansion);
     OnGraphChanged();
 }
 public void ShowDetails(TypeViewModel type)
 {
     TypeForDetails = type;
     OnShowDetailsRequest();
 }
Exemple #8
0
 public void ShowGraph(TypeViewModel type)
 {
     Navigate(new NavigationItem(type));
 }
        public void Expand(TypeViewModel typeViewModel)
        {
            typeViewModel.IsExpanded = true;
            AdjustExpansion(typeViewModel);

            foreach (var viewModel in typeViewModel.FlattenedHierarchy)
            {
                if (viewModel == typeViewModel)
                {
                    continue;
                }

                Graph.AddVertex(viewModel);
                if (viewModel.BaseType == null)
                {
                    continue;
                }
                Graph.AddEdge(new Edge<TypeViewModel>(viewModel, viewModel.BaseType));
            }

            _types = null;
            PerformSearch();
        }
Exemple #10
0
 public NavigationItem(TypeViewModel type)
 {
     Type = type;
 }
Exemple #11
0
 public void AddDerivedType(TypeViewModel typeViewModel)
 {
     _derivedTypes.Add(typeViewModel);
     typeViewModel.BaseType = this;
 }
 private bool SatisfiesSearchTerm(TypeViewModel typeViewModel)
 {
     return typeViewModel
         .Name.IndexOf(SearchTerm, StringComparison.InvariantCultureIgnoreCase) >= 0;
 }
        private TypeViewModel MarkSearchTerm(TypeViewModel type)
        {
            var index = type.Name.IndexOf(SearchTerm, StringComparison.InvariantCultureIgnoreCase);
            type.NameStart = type.Name.Substring(0, index);
            type.NameMiddle = type.Name.Substring(index, SearchTerm.Length);
            type.NameEnd = type.Name.Substring(index + SearchTerm.Length);

            return type;
        }
 public TypeViewModel ClearSearchTerm(TypeViewModel type)
 {
     type.ResetName();
     return type;
 }