public DependencyBrowserWindowViewModel(IEnumerable <AssemblyInfo> assemblies)
        {
            _assemblies = assemblies.ToList();
            var inputAssemblyViewModels = assemblies
                                          .Select(a => AssemblyViewModel.Create(a))
                                          .ToList();

            foreach (var vm in inputAssemblyViewModels)
            {
                vm.IsMarked = true;
                vm.IsRoot   = true;
            }
            _assemblyGraph      = CreateGraph(inputAssemblyViewModels);
            _assemblyViewModels = _assemblyGraph.Vertices.ToList();

            HideSearchCommand     = new DelegateCommand(HideSearchCommandHandler);
            ShowSearchCommand     = new DelegateCommand(ShowSearchCommandHandler);
            BrowseSelectedCommand = new DelegateCommand(BrowseCommandHandler);
            ClearSelectionCommand = new DelegateCommand(ClearSelectionCommandHandler);
            RemoveSelectedCommand = new DelegateCommand(RemoveSelectedCommandHandler);
            Commands = new ObservableCollection <UserCommand>
            {
                new UserCommand(Resources.FillGraph, OnFillGraphRequest),
                new UserCommand(Resources.OriginalSize, OnOriginalSizeRequest),
                new UserCommand(Resources.SearchInGraph, ShowSearchCommand),
                new UserCommand(Resources.BrowseSelected, BrowseSelectedCommand),
                new UserCommand(Resources.RemoveSelected, RemoveSelectedCommand),
                new UserCommand(Resources.ClearSelection, ClearSelectionCommand)
            };
        }
        private static void AddReferencesRecursive(AssemblyGraph graph, AssemblyViewModel assembly)
        {
            assembly.IsProcessed = true;
            foreach (var refAssembly in assembly.ReferencedAssemblies)
            {
                if (!graph.ContainsVertex(refAssembly))
                {
                    graph.AddVertex(refAssembly);
                }

                var edge = new Edge <AssemblyViewModel>(assembly, refAssembly);

                Edge <AssemblyViewModel> reverseEdge;
                var result = graph.TryGetEdge(refAssembly, assembly, out reverseEdge);
                if (result)
                {
                    reverseEdge.IsTwoWay = true;
                    edge.IsTwoWay        = true;
                }

                graph.AddEdge(edge);
                if (!refAssembly.IsProcessed)
                {
                    AddReferencesRecursive(graph, refAssembly);
                }
            }
        }
 private void ProcessRec(AssemblyViewModel assembly)
 {
     assembly.IsProcessed = true;
     foreach (var refAssembly in assembly.ReferencedAssemblies)
     {
         if (!refAssembly.IsRemoved && !refAssembly.IsProcessed &&
             !refAssembly.IsRoot && !refAssembly.IsSelected)
         {
             ProcessRec(refAssembly);
         }
     }
 }
        private static AssemblyGraph CreateGraph(IEnumerable <AssemblyViewModel> assemblies)
        {
            var graph = new AssemblyGraph(true);

            foreach (var assembly in assemblies)
            {
                if (!graph.ContainsVertex(assembly))
                {
                    graph.AddVertex(assembly);
                }
                AddReferencesRecursive(graph, assembly);
            }

            AssemblyViewModel.ClearCache();
            return(graph);
        }
 private void ProcessRec(AssemblyViewModel assembly)
 {
     assembly.IsProcessed = true;
     foreach (var refAssembly in assembly.ReferencedAssemblies)
     {
         if (!refAssembly.IsRemoved && !refAssembly.IsProcessed
             && !refAssembly.IsRoot && !refAssembly.IsSelected)
         {
             ProcessRec(refAssembly);
         }
     }
 }
        private static void AddReferencesRecursive(AssemblyGraph graph, AssemblyViewModel assembly)
        {
            assembly.IsProcessed = true;
            foreach (var refAssembly in assembly.ReferencedAssemblies)
            {
                if (!graph.ContainsVertex(refAssembly))
                {
                    graph.AddVertex(refAssembly);
                }

                var edge = new Edge<AssemblyViewModel>(assembly, refAssembly);

                Edge<AssemblyViewModel> reverseEdge;
                var result = graph.TryGetEdge(refAssembly, assembly, out reverseEdge);
                if (result)
                {
                    reverseEdge.IsTwoWay = true;
                    edge.IsTwoWay = true;
                }

                graph.AddEdge(edge);
                if (!refAssembly.IsProcessed)
                {
                    AddReferencesRecursive(graph, refAssembly);
                }
            }
        }