public MailboxManagerFactory(EWSConnectionManger connectionManger)
 {
     _connectionManger = connectionManger;
 }
示例#2
0
文件: Main.cs 项目: FukSunFc/mail2bug
        private static void InitInstances(IEnumerable<Config> configs)
        {
            _instances = new List<IInstanceRunner>();
            _ewsConnectionManger = new EWSConnectionManger(true);
            var mailboxManagerFactory = new MailboxManagerFactory(_ewsConnectionManger);

            foreach (var config in configs)
            {
                foreach (var instance in config.Instances)
                {
                    try
                    {
                        var usePersistentInstances = ReadBoolFromAppConfig("UsePersistentInstances", true);
                        Logger.InfoFormat("Initializing engine for instance '{0}' (Persistent? {1})", instance.Name, usePersistentInstances);
                        
                        if (usePersistentInstances)
                        {
                            _instances.Add(new PersistentInstanceRunner(instance, mailboxManagerFactory));
                        }
                        else
                        {
                            _instances.Add(new TemporaryInstanceRunner(instance, mailboxManagerFactory));
                        }

                        Logger.InfoFormat("Finished initialization of engine for instance '{0}'", instance.Name);
                    }
                    catch (Exception ex)
                    {
                        Logger.ErrorFormat("Exception while initializing instance '{0}'\n{1}", instance.Name, ex);
                    }
                }
            }
        }