public static CostManagerFactory GetInstance(CostLineType costType) { string costManagerTypeName = EAppRuntime.Instance.CurrentApp.ConfigSource.Config.MiscSettings[costType.ToString()].value; specifiedCostManagerType = Type.GetType(costManagerTypeName); if (!EAppRuntime.Instance.CurrentApp.ObjectContainer.Registered(specifiedCostManagerType)) { EAppRuntime.Instance.CurrentApp.ObjectContainer.RegisterType(specifiedCostManagerType, ObjectLifetimeMode.Singleton); } return(costManagerFactory); }
protected override object RunCore(IPluginServiceProvider serviceProvider) { CostLineType currentCostType = (CostLineType)serviceProvider.GetService(typeof(CostLineType)); CostManagerFactory costManagerFactory = CostManagerFactory.GetInstance(currentCostType); object currentCostManagerObject = EAppRuntime.Instance.CurrentApp.ObjectContainer.Resolve(costManagerFactory.CurrentCostManagerType); ProxyGenerator proxyGenerator = new ProxyGenerator(); var options = new ProxyGenerationOptions(); options.AddMixinInstance(currentCostManagerObject); ICostManager costManager = (ICostManager)proxyGenerator.CreateClassProxy <CostManagerFactory>(options); costManager.AddCostLine(); return(costManager.CurrentDisplayedCostLines); }