void createItem_Click(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; Type type = (Type)item.Tag; IFxpaBaseCompoent component = null; if (type.IsSubclassOf(typeof(Analyzer))) { component = new LocalAnalyzerHost(CustomNameAttribute.GetClassAttributeName(type), type); } else { ConstructorInfo info = type.GetConstructor(new Type[] { }); if (info != null) { component = (IFxpaBaseCompoent)info.Invoke(new object[] { }); } } // ... if (component == null) { MessageBox.Show("Failed to create component.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Set settings for component. if (component.SetInitialState(fxpaBaseForm.Settings) == false) { MessageBox.Show("Component failed to initialize from initial state.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Register to platform. fxpaBaseForm.RegisterComponent(component); }
/// <summary> /// /// </summary> public FxpaSource() //: base(false) { this.Name = CustomNameAttribute.GetClassAttributeName(typeof(FxpaSource)); //this._id.Name = this.Name; }