public void AddVisualizer(Type visType) { IVisualizer visualizer = (IVisualizer)Activator.CreateInstance(visType); Visualizers.Add(visualizer); TabPage page = new TabPage(visualizer.DisplayName); page.Tag = visualizer; var toolbar = new VisualizerToolbar(ActiveSnapshot, visualizer); toolbar.Dock = DockStyle.Top; page.Controls.Add(toolbar); visualizer.Control.Top = toolbar.Height; visualizer.Control.Left = 0; visualizer.Control.Size = new System.Drawing.Size(page.Width, page.Height - toolbar.Height); visualizer.Control.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; page.Controls.Add(visualizer.Control); VisualizerHost.TabPages.Add(page); //We have to initialize here to make sure everything is wired if the visualizer calls back in if (!visualizer.Initialize(this, Connection, ActiveSnapshot)) { VisualizerHost.TabPages.Remove(page); Visualizers.Remove(visualizer); return; } VisualizerHost.SelectedTab = page; m_closeVisualizerButton.Enabled = true; }
public void AddVisualizer(Type visType) { IVisualizer visualizer = (IVisualizer) Activator.CreateInstance(visType); Visualizers.Add(visualizer); TabPage page = new TabPage(visualizer.DisplayName); page.Tag = visualizer; var toolbar = new VisualizerToolbar(ActiveSnapshot, visualizer); toolbar.Dock = DockStyle.Top; page.Controls.Add(toolbar); visualizer.Control.Top = toolbar.Height; visualizer.Control.Left = 0; visualizer.Control.Size = new System.Drawing.Size(page.Width, page.Height - toolbar.Height); visualizer.Control.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; page.Controls.Add(visualizer.Control); VisualizerHost.TabPages.Add(page); //We have to initialize here to make sure everything is wired if the visualizer calls back in if(!visualizer.Initialize(this, Connection, ActiveSnapshot)) { VisualizerHost.TabPages.Remove(page); Visualizers.Remove(visualizer); return; } VisualizerHost.SelectedTab = page; m_closeVisualizerButton.Enabled = true; }