Exemplo n.º 1
0
        private void StartTimers(ioc.IContainer container)
        {
            Timer _timer;

            _timer = new Timer(Convert.ToInt32(Config.AppSettings["AutomationTimerInterval"]) * 1000);
            ElapsedEventHandler triggerMethod = null;

            triggerMethod  += container.Resolve <ISendService>().DoOnMainTimer;
            _timer.Elapsed += triggerMethod;
            if (Config.AppSettings["ServerType"] == "Internet")
            {
                _timer.Start();
            }
        }
Exemplo n.º 2
0
        public void Start(ioc.IContainer container)
        {
            var svcInterfaces = asm.GetAssembly(typeof(svc.IService))
                                .GetTypes()
                                .Where(t => t.IsInterface && t != typeof(svc.IService));

            var svcClasses = asm.GetAssembly(this.GetType())
                             .GetTypes()
                             .Where(t => t.IsClass && t.IsSubclassOf(typeof(Service)));

            foreach (var svcInterface in svcInterfaces)
            {
                var svcClass = svcClasses.FirstOrDefault(e => svcInterface.IsAssignableFrom(e));
                if (svcClass != null)
                {
                    container.RegisterType(from: svcInterface, to: svcClass);
                }
            }
        }