protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                this.workerThread.Join();
                this.workerThread = null;

                if (this.codeMetricManager != null)
                {
                    this.codeMetricManager.BeginRun       -= new EventHandler(this.CodeMetricManager_BeginRun);
                    this.codeMetricManager.BeginRunMetric -= new CodeMetricEventHandler(this.CodeMetricManager_BeginRunMetric);
                    this.codeMetricManager.EndRun         -= new EventHandler(this.CodeMetricManager_EndRun);
                    this.codeMetricManager.EndRunMetric   -= new CodeMetricEventHandler(this.CodeMetricManager_EndRunMetric);
                    this.codeMetricManager = null;
                }
            }

            base.Dispose(disposing);
        }
        public CodeMetricWindow(IServiceProvider serviceProvider)
        {
            this.Visible = false;

            this.TabStop = false;
            this.Dock    = DockStyle.Fill;

            this.serviceProvider = serviceProvider;

            this.codeMetricManager = new CodeMetricManager();
            this.codeMetricManager.Register(new TypeCodeMetric());
            this.codeMetricManager.Register(new MethodCodeMetric());
            this.codeMetricManager.Register(new ModuleCodeMetric());

            this.codeMetricManager.BeginRun       += new EventHandler(this.CodeMetricManager_BeginRun);
            this.codeMetricManager.BeginRunMetric += new CodeMetricEventHandler(this.CodeMetricManager_BeginRunMetric);
            this.codeMetricManager.EndRun         += new EventHandler(this.CodeMetricManager_EndRun);
            this.codeMetricManager.EndRunMetric   += new CodeMetricEventHandler(this.CodeMetricManager_EndRunMetric);

            this.contentHost         = new Control();
            this.contentHost.TabStop = false;
            this.contentHost.Dock    = DockStyle.Fill;
            this.Controls.Add(this.contentHost);

            this.commandBarManager = new CommandBarManager();
            this.commandBar        = new CommandBar(this.commandBarManager, CommandBarStyle.ToolBar);

            this.startButton = this.commandBar.Items.AddButton(CommandBarImages.Refresh, "Start Analysis", new EventHandler(this.StartButton_Click), Keys.Control | Keys.E);
            this.commandBar.Items.AddSeparator();
            this.saveButton         = this.commandBar.Items.AddButton(CommandBarImages.Save, "Save", new EventHandler(this.SaveButton_Click), Keys.Control | Keys.S);
            this.copyButton         = this.commandBar.Items.AddButton(CommandBarImages.Copy, "Copy", new EventHandler(this.CopyButton_Click), Keys.Control | Keys.C);
            this.codeMetricComboBox = this.commandBar.Items.AddComboBox("Code Metric Selector", new ComboBox());
            this.codeMetricComboBox.ComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            this.codeMetricComboBox.ComboBox.SelectedIndexChanged += new EventHandler(this.CodeMetricComboBox_SelectedIndexChanged);

            this.commandBarManager.CommandBars.Add(this.commandBar);
            this.Controls.Add(this.commandBarManager);

            this.assemblySelector = new AssemblySelectorControl(serviceProvider, this.codeMetricManager);

            this.NewAnalysis();
        }
            public AssemblySelectorControl(IServiceProvider serviceProvider, CodeMetricManager codeMetricManager)
            {
                this.assemblyManager   = (IAssemblyManager)serviceProvider.GetService(typeof(IAssemblyManager));
                this.assemblyBrowser   = (IAssemblyBrowser)serviceProvider.GetService(typeof(IAssemblyBrowser));
                this.codeMetricManager = codeMetricManager;

                ColumnHeader[] columnHeaders = new ColumnHeader[3];
                columnHeaders[0]       = new ColumnHeader();
                columnHeaders[0].Text  = "Name";
                columnHeaders[0].Width = 250;
                columnHeaders[1]       = new ColumnHeader();
                columnHeaders[1].Text  = "Version";
                columnHeaders[1].Width = 80;
                columnHeaders[2]       = new ColumnHeader();
                columnHeaders[2].Text  = "Location";
                columnHeaders[2].Width = 400;

                this.Dock = DockStyle.Fill;
                this.Columns.AddRange(columnHeaders);
                this.FullRowSelect = true;
                this.TabIndex      = 0;
                this.CheckBoxes    = true;
                this.View          = View.Details;
            }