private void AddType() { if (this.assemblyBrowser.SelectedNode is TypeNode) { TypeNode typeNode = (TypeNode)this.assemblyBrowser.SelectedNode; // NOTE: Allow multiple instances of the same type (this is probably common) //if (!this.typeDocuments.ContainsKey (typeNode.Type)) //{ WrappedType wrappedType = new WrappedType(typeNode.Type); WrappingOptions wrappingOptions = new WrappingOptions(wrappedType); wrappingOptions.MethodsListViewSelectedIndexChanged += this.OnListViewSelectedIndexChanged; wrappingOptions.PropertiesListViewSelectedIndexChanged += this.OnListViewSelectedIndexChanged; wrappingOptions.EventsListViewSelectedIndexChanged += this.OnListViewSelectedIndexChanged; WrappedTypeDocument document = new WrappedTypeDocument(wrappingOptions); document.SuspendLayout(); document.Guid = new Guid("A694E86E-73C0-417e-B85D-A04361C3CDC4"); document.SizeChanged += this.OnDockControlSizeChanged; document.PerformLayout(); this.documentContainer.AddDocument(document); //this.typeDocuments[typeNode.Type] = document; //} //this.typeDocuments[typeNode.Type].Activate (); document.Activate(); } }
protected override void OnControlAdded(System.Windows.Forms.ControlEventArgs e) { if (this.Controls.Count > 1 || !(e.Control is WrappingOptions)) { throw new InvalidOperationException(this.GetType().Name + " can contain only one " + this.wrappingOptions.GetType().Name + " and no other controls"); } this.wrappingOptions = (WrappingOptions)e.Control; this.Text = this.wrappingOptions.WrappedType.FieldName; this.wrappingOptions.WrappedType.FieldNameChanged += this.OnWrappedTypeFieldNameChanged; base.OnControlAdded(e); }
public WrappedTypeDocument(WrappingOptions wrappingOptions) { this.Controls.Add(wrappingOptions); }