void InitEditor(TypeBase typeBase) { if (typeBase is CompositeType) { editor = new CompositeTypeEditor().SetCompositeType((CompositeType)typeBase); } else if (typeBase is EnumType) { editor = new EnumTypeEditor().SetEnumType((EnumType)typeBase); } else if (typeBase is DelegateType) { editor = new DelegateTypeEditor().SetDelegateType((DelegateType)typeBase); } else throw new NotSupportedException(typeBase.GetType().FullName); Handler.EditHandler = editor; editor.Dock = System.Windows.Forms.DockStyle.Fill; Controls.Add(editor); UpdateName(); typeBase.Renamed += new EventHandler(typeBase_StateChanged); typeBase.StateChanged += new EventHandler(typeBase_StateChanged); }
public void ShowDialog(TypeBase typeBase, bool memberOnly = false) { type = typeBase; TypeBase copy = null; if (typeBase is CompositeType) { if (type is ClassType) copy = ((ClassType)type).Clone(); else if (type is StructureType) copy = ((StructureType)type).Clone(); else if (type is InterfaceType) copy = ((InterfaceType)type).Clone(); copy.ProjectInfo = type.ProjectInfo; editor = new CompositeTypeEditor().SetCompositeType((CompositeType)copy, memberOnly); MinimumSize = new Size(790, 610); Size = new Size(1000, 700); } else if (typeBase is EnumType) { copy = ((EnumType)type).Clone(); copy.ProjectInfo = type.ProjectInfo; editor = new EnumTypeEditor().SetEnumType((EnumType)copy, memberOnly); } else if (typeBase is DelegateType) { copy = ((DelegateType)type).Clone(); copy.ProjectInfo = type.ProjectInfo; editor = new DelegateTypeEditor().SetDelegateType((DelegateType)copy, memberOnly); } else throw new NotSupportedException(typeBase.GetType().FullName); UpdateButtons(); editor.EditStateChanged += new EventHandler(editor_EditStateChanged); editor.Dock = System.Windows.Forms.DockStyle.Fill; kryptonPanelMain.Controls.Add(editor); ShowDialog(); }