public MainForm() { this.topologyContainer = new TopologyContainer(); this.topologyForm = new TopologyForm(this.topologyContainer); InitializeComponent(); // find all object that inherit from iSequence to get all the available sequences foreach (Type type in AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(p => typeof(PluginsFramework.iSequence).IsAssignableFrom(p) && p.IsClass)) { var newSequence = new SequenceDefinition(type, this.tcMain, this.topologyContainer); this.sequences.Add(newSequence); this.addSequenceToolStripMenuItem.DropDownItems.Add(newSequence.Menu); } // find all objects that inherit from iTopology to get all the available topologies foreach (Type type in AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(p => typeof(PluginsFramework.iTopology).IsAssignableFrom(p) && p.IsClass)) { var newTopology = new TopologyDefinition(type, this.topologyForm); this.topologyToolStripMenuItem.DropDownItems.Add(newTopology.Menu); } this.DoubleBuffered = true; this.topologyForm.Show(); this.BringToFront(); }
public TopologyDefinition(Type type, TopologyForm form) { this.topology = (PluginsFramework.iTopology)Activator.CreateInstance(type); this.menu = new ToolStripMenuItem(this.topology.TopologyName); this.menu.Click += new EventHandler(this.OnMenuClick); this.form = form; }