public Admin() { this.asmLoader = ContainerManager.Container.Resolve<AssemblyManager>(); this.appEventHandler = ContainerManager.Container.Resolve<IAppEventHandler>(); this.frameworkAddinManager = ContainerManager.Container.Resolve<IAddinManager>(); this.Logger = ContainerManager.Container.Resolve<ILogger>(); UpdateAddinStatus(); }
public Admin() { this.asmLoader = ContainerManager.Container.Resolve <AssemblyManager>(); this.appEventHandler = ContainerManager.Container.Resolve <IAppEventHandler>(); this.frameworkAddinManager = ContainerManager.Container.Resolve <IAddinManager>(); this.Logger = ContainerManager.Container.Resolve <ILogger>(); UpdateAddinStatus(); }
/// <summary> /// Release all resources. /// </summary> public void ShutDownApp() { if (appContainer != null) { IAppEventHandler appEventHandler = appContainer.Resolve <IAppEventHandler>(); appEventHandler.ShutDown(); appContainer = null; } }
public static IWindsorContainer BuildContainer() { string assemblyName; Func <SAPbobsCOM.Company>[] companyFactory = (customCompanyFactory == null) ? new Func <SAPbobsCOM.Company>[] { SAPServiceFactory.CompanyFactory } : customCompanyFactory; Container = new WindsorContainer(); Container.Kernel.Resolver.AddSubResolver(new ArrayResolver(Container.Kernel)); // proxy for forms. Container.Register(Component.For <IInterceptor>().ImplementedBy <FormProxy>().Named("formProxy")); // proxy for Transactions Container.Register(Component.For <IInterceptor>().ImplementedBy <TransactionProxy>().Named("transactionProxy")); // forms are Transient. Container.Register(Classes.FromThisAssembly().IncludeNonPublicTypes().InNamespace("Dover.Framework.Form") .WithService.DefaultInterfaces().LifestyleTransient()); // SAP App Facttory. Container.Register(Component.For <SAPbouiCOM.Application>().UsingFactoryMethod(SAPServiceFactory.ApplicationFactory)); // company factory (use default, that initializes DI API from App if none was provided). for (int i = 0; i < companyFactory.Length; i++) { Container.Register(Component.For <SAPbobsCOM.Company>().UsingFactoryMethod(companyFactory[i]).Named("company" + i)); } for (int i = 0; i < companyFactory.Length; i++) { Container.Register(Component.For <BusinessOneDAO>().ImplementedBy <BusinessOneDAOSQLImpl>() .DependsOn(Dependency.OnComponent(typeof(SAPbobsCOM.Company), "company" + i)).Named("b1dao" + i)); } string runningFolder = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); // AddinManager registration. If I'm an AddIn, get addinManager from AppDomain, so // both (addin AppDomain and inception AppDomain) references the same implementation. IAddinManager addinManager = (IAddinManager)AppDomain.CurrentDomain.GetData("frameworkManager"); if (addinManager != null) { addinManagerSponsor = new Sponsor <IAddinManager>(addinManager); Container.Register(Component.For <IAddinManager>().Instance(addinManager).Named("IAddinManager")); } IAppEventHandler appEventHandler = (IAppEventHandler)AppDomain.CurrentDomain.GetData("appHandler"); if (appEventHandler != null) { appEventHandlerSponsor = new Sponsor <IAppEventHandler>(appEventHandler); Container.Register(Component.For <IAppEventHandler>().Instance(appEventHandler).Named("IAppEventHandler")); } // Register this Service as interface, not the underlying class. Container.Register(Component.For <ITempAssemblyLoader>().ImplementedBy <TempAssemblyLoader>()); // DAO registration. Abstract classes, they're singleton. Container.Register(Component.For <BusinessOneUIDAO>().ImplementedBy <BusinessOneUIDAOImpl>()); Container.Register(Component.For <AssemblyDAO>().ImplementedBy <AssemblyDAOImpl>()); Container.Register(Component.For <PermissionDAO>().ImplementedBy <PermissionDAOSQLImpl>()); Container.Register(Component.For <LicenseDAO>().ImplementedBy <LicenseDAOImpl>()); // Core and MicroCore Container.Register(Component.For <MicroCore>().LifestyleSingleton()); Container.Register(Component.For <MicroBoot>().LifestyleSingleton()); Container.Register(Component.For <Boot>().LifestyleSingleton()); assemblyName = Assembly.GetEntryAssembly() == null ? (string)AppDomain.CurrentDomain.GetData("assemblyName") : Assembly.GetEntryAssembly().GetName().Name; if (assemblyName == "Framework") { #if DEBUG CheckProxy(Assembly.Load(assemblyName)); // if passed on debug tests, we do not need this on production. #endif assemblyName = "Dover"; // Framework should be threated the same as Dover. } string logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, assemblyName + ".config"); if (!File.Exists(logPath)) { logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DoverTemp.config"); // Temp AppDomain logging. } Container.AddFacility <LoggingFacility>(f => f.UseLog4Net(logPath)); Container.Register(Component.For <TransactionProxy>().ImplementedBy <TransactionProxy>()); Container.Register(Component.For <EventProxy>().ImplementedBy <EventProxy>()); Container.Register(Component.For <AddinManager, IAddinManager>().Interceptors(typeof(TransactionProxy))); Container.Register(Component.For <FormEventHandler, IFormEventHandler>().Interceptors(typeof(EventProxy))); // Service registration, they are singleton. Container.Register(Classes.FromThisAssembly().IncludeNonPublicTypes().InNamespace("Dover.Framework.Service") .WithServiceAllInterfaces().LifestyleSingleton()); var logger = Container.Resolve <ILogger>(); logger.Debug(DebugString.Format(Messages.StartupFolder, runningFolder)); SAPServiceFactory.Logger = logger; var b1dao = Container.Resolve <BusinessOneDAO>(); SAPAppender.B1DAO = b1dao; return(Container); }
public UserPasswordRecoveryAppEventConsumer(IAppEventHandler <IUserPasswordRecoveryAppEvent> handler, ILog log) { this.handler = handler; this.log = log; }
public RequestDeedlineAppEventConsumer(IAppEventHandler <IRequestDeedlineAppEvent> handler, ILog log) { this.handler = handler; this.log = log; }
public MicroCoreEventDispatcher(SAPbouiCOM.Application sapApp, IAppEventHandler appEventHandler) { this.sapApp = sapApp; this.appEventHandler = appEventHandler; }
public UserRegisterAppEventConsumer(IAppEventHandler <IUserRegisterAppEvent> handler, ILog log) { this.handler = handler; this.log = log; }
public MenuConfiguration(BusinessOneDAO b1DAO, LicenseManager licenseManager, IAppEventHandler appEvent) { this.b1DAO = b1DAO; this.appEvent = appEvent; this.licenseManager = licenseManager; }
public RequestAppEventConsumer(IAppEventHandler <IRequestAppEvent> handler, ILog log, IEnumerable <ISender> senders) { this.handler = handler; this.log = log; }