コード例 #1
0
        private void InitializeNode()
        {
            foreach (var module in AssociatedObject.Modules.OrderBy(m => m.Name))
            {
                var moduleView = new ModuleNode(module);

                // References
                if (module.HasAssemblyReferences)
                {
                    var referencesView = new SimpleNode(DefaultImages.AssemblyBrowser.Reference, "References");
                    foreach (var reference in module.AssemblyReferences)
                    {
                        referencesView.Items.Add(new AssemblyReferenceNode(DeclaringAssembly, reference));
                    }

                    moduleView.Items.Add(referencesView);
                }

                // Namespace cache
                var namespaceCache = new Dictionary <string, NamespaceNode>();

                // Types
                foreach (var type in module.Types.OrderBy(t => t.Namespace).ThenBy(t => t.Name))
                {
                    NamespaceNode namespaceView;

                    if (!namespaceCache.TryGetValue(type.Namespace, out namespaceView))
                    {
                        namespaceView = new NamespaceNode(DeclaringAssembly, type.Namespace);
                        namespaceCache.Add(type.Namespace, namespaceView);
                        moduleView.Items.Add(namespaceView);
                    }

                    namespaceView.AssociatedObject.Types.Add(type);
                }

                Items.Add(moduleView);
            }

            if (AssociatedObject.MainModule.HasResources && AssociatedObject.IsSilverlight())
            {
                var resourceFolder = new FolderNode("Resources");
                Items.Add(resourceFolder);

                foreach (var resource in AssociatedObject.MainModule.Resources)
                {
                    if (resource.ResourceType != ResourceType.Embedded)
                    {
                        continue;
                    }

                    var resourceNode = new ResourceNode(AssociatedObject, _assemblySource, resource);
                    resourceFolder.Items.Add(resourceNode);
                }
            }
        }
コード例 #2
0
ファイル: AssemblyNode.cs プロジェクト: nnieslan/IL.View
        private void InitializeNode()
        {
            foreach (var module in AssociatedObject.Modules.OrderBy(m => m.Name))
            {
                var moduleView = new ModuleNode(module);

                // References
                if (module.HasAssemblyReferences)
                {
                    var referencesView = new SimpleNode(DefaultImages.AssemblyBrowser.Reference, "References");
                    foreach (var reference in module.AssemblyReferences)
                    {
                        referencesView.Items.Add(new AssemblyReferenceNode(DeclaringAssembly, reference));
                    }

                    moduleView.Items.Add(referencesView);
                }

                // Namespace cache
                var namespaceCache = new Dictionary <string, NamespaceNode>();

                // Types
                foreach (var type in module.Types.OrderBy(t => t.Namespace).ThenBy(t => t.Name))
                {
                    NamespaceNode namespaceView;

                    if (!namespaceCache.TryGetValue(type.Namespace, out namespaceView))
                    {
                        namespaceView = new NamespaceNode(DeclaringAssembly, type.Namespace);
                        namespaceCache.Add(type.Namespace, namespaceView);
                        moduleView.Items.Add(namespaceView);
                    }

                    namespaceView.AssociatedObject.Types.Add(type);
                }

                Items.Add(moduleView);
            }
        }