Click here to Skip to main content
15,885,365 members
Articles / Desktop Programming / Windows Forms

Diagrams with Reflector and the Graph Plug-in (Part 2)

Rate me:
Please Sign up or sign in to vote.
4.27/5 (7 votes)
23 Feb 2009CPOL6 min read 35.1K   1.1K   38  
Graphing other dependencies, without Reflector now.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;

using System.Windows.Forms;

using Refractor.Common;

namespace Refractor.Plugins.ILDiagrams
{
    /// <summary>
    /// Show a diagram of namespace dependencies.
    /// </summary>
    public partial class AllNamespaces : BaseDiagram
    {

        public AllNamespaces()
        {
            InitializeComponent();
        }
        
        public override string GetID()
        {
            return "All Namespaces";
        }

        public override List<Type> GetHandledTypes()
        {
            return new List<Type> { typeof(RootItem) };
        }

        public override WindowPluginKind GetKind()
        {
            return WindowPluginKind.MainWindow;
        }

        public override PluginOptions GetOptions()
        {
            if (_options == null)
            {
                _options = new NamespacesOptions(this.GetID());
            }

            return _options;
        }

        public override void SetOptions(PluginOptions options)
        {
            if (options == null) return;
            if (!(options is NamespacesOptions)) return;

            _options = options as NamespacesOptions;
        }

        protected override BaseGraphBuilder CreateBuilder()
        {
            return new AllNamespacesGb();
        }

        
        //public override void SetServiceProvider(IServiceProvider serviceProvider)
        //{
        //    base.SetServiceProvider(serviceProvider);

        //    _projectBrowser.OnFilesChanged += new EventHandler(ProjectBrowser_OnFilesChanged);
        //}

        //private void ProjectBrowser_OnFilesChanged(object sender, EventArgs e)
        //{
        //    _activeItem = sender as RootItem;
        //    if (_activeItem == null) return;

        //    SetActiveItem(_activeItem);
        //}

        //private void _cbxFlatten_Click(object sender, EventArgs e)
        //{
        //    if (_options == null) return;
        //    if (!(_options is NamespacesOptions)) return;

        //    _cbxFlatten.Checked = !_cbxFlatten.Checked;
        //    (_options as NamespacesOptions).FlattenNamespaces = _cbxFlatten.Checked;
        //}


    }


    [Serializable]
    public class NamespacesOptions : BaseDiagramOptions
    {
        public NamespacesOptions(string id) : base(id) { }
        public NamespacesOptions() { }

        private bool _flattenNamespaces = false;
        public bool FlattenNamespaces { get { return _flattenNamespaces; } set { _flattenNamespaces = value; } }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United Kingdom United Kingdom
hughdoar@hotmail.com

Comments and Discussions