public IComponent NewCommonComponent(ComponentTypeInfo commonComponentType) { IComponent newCommon = ComponentBuildersService.CommonBuilder.GetNew(commonComponentType); Form newCommonForm = newCommon as Form; if (newCommonForm != null) { newCommonForm.MdiParent = MainForm as Form; newCommonForm.FormClosing += this.CommonComponent_Closing; } CommonComponents.Add(newCommon); return(newCommon); }
public IExtraWorkplaceComponent NewExtraWorkplaceComponent(ComponentTypeInfo extraComponentType) { IExtraWorkplaceComponent newExtra = WorkplaceExtraBuilder.GetNew(extraComponentType); newExtra.ParentWorkplace = this; Form newExtraForm = newExtra as Form; if (newExtraForm != null) { newExtraForm.MdiParent = MainForm as Form; newExtraForm.FormClosing += this.ExtraWorkplaceComponent_Closing; } ExtraComponents.Add(newExtra); if (newExtra.GetType().GetCustomAttribute <InitializeAfterCreateAttribute>()?.InitializeAfterCreate ?? false) { newExtra.Initialize(this); } return(newExtra); }