public RandomNetworkGenElement Create(Guid id, IElementDefinition defType) { RandomNetworkGenElement el = new RandomNetworkGenElement(id, defType); IInputPortMgr inPortMgr = CreateInputPortMgr(el); IOutputPortMgr outPortMgr = CreateOutputPortMgr(el); el.InPortMgr = inPortMgr; el.OutPortMgr = outPortMgr; IRandomNetGenParamMgr paramMgr = CreateParamMgr(); el.ParamMgr = paramMgr; Guid fxId = Guid.NewGuid(); IRandomNetworkGenFx fx = CreateMyFx(fxId, id); el.Fx = fx; using (SettingsMgrFactory fac = new SettingsMgrFactory()) { ISimpleSettingsMgr settingsMgr = fac.CreateSettingsMgr(el); el.SettingsMgr = settingsMgr; } using (OptionsMgrFactory fac = new OptionsMgrFactory()) { ISimpleOptionsMgr optsMgr = fac.CreateOptionsMgr(el); el.OptionsMgr = optsMgr; } return el; }
public RandomNetworkGenElement Create(IElementTicket ticket, IElementDefinition defType) { if (ticket.TypeId != defType.ElementTypeId) { // TODO throw new InvalidOperationException(Properties.Resources.MssgTicketTypeIdDoesNotMatchDefTypeIdFormat(ticket.TypeId, defType.ElementTypeId)); } RandomNetworkGenElement el = new RandomNetworkGenElement(ticket.ElementId, defType); IInputPortMgr inPortMgr = CreateInputPortMgr(el); IOutputPortMgr outPortMgr = CreateOutputPortMgr(el, ticket.OutputPortMgrId, ticket.OutputPortIds[0]); el.InPortMgr = inPortMgr; el.OutPortMgr = outPortMgr; IRandomNetGenParamMgr paramMgr = CreateParamMgr(ticket.ParamMgrId); el.ParamMgr = paramMgr; IRandomNetworkGenFx fx = CreateMyFx(ticket.FxId, ticket.ElementId); el.Fx = fx; using (SettingsMgrFactory fac = new SettingsMgrFactory()) { ISimpleSettingsMgr settingsMgr = fac.CreateSettingsMgr(el); el.SettingsMgr = settingsMgr; } using (OptionsMgrFactory fac = new OptionsMgrFactory()) { ISimpleOptionsMgr optsMgr = fac.CreateOptionsMgr(el); el.OptionsMgr = optsMgr; } return el; }