示例#1
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            Pop3ManagerConfig config = new Pop3ManagerConfig();

            foreach (XmlNode item in section.ChildNodes)
            {
                try
                {
                    switch (item.Name)
                    {
                    case "add":
                        config.Handlers.Add(new Pop3MessageHandlerInfo(item.Attributes["name"].Value,
                                                                       item.Attributes["type"].Value,
                                                                       item.Attributes["propertyControl"] != null?item.Attributes["propertyControl"].Value:string.Empty));
                        break;

                    case "remove":
                        config.Handlers.Remove(item.Attributes["name"].Value);
                        break;

                    case "clear":
                        config.Handlers.Clear();
                        break;
//						default:
//							throw new NotSupportedException(string.Format("Wrong Xml Element: {0}",item.OuterXml));
                    }
                }
                catch (Exception ex)
                {
                    throw new ConfigurationErrorsException(ex.Message, ex, item);
                }
            }

            return(config);
        }
示例#2
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            Pop3ManagerConfig config = new Pop3ManagerConfig();

            foreach(XmlNode item in section.ChildNodes)
            {
                try
                {
                    switch(item.Name)
                    {
                        case "add":
                            config.Handlers.Add(new Pop3MessageHandlerInfo(item.Attributes["name"].Value,
                                item.Attributes["type"].Value,
                                item.Attributes["propertyControl"]!=null?item.Attributes["propertyControl"].Value:string.Empty)	);
                            break;
                        case "remove":
                            config.Handlers.Remove(item.Attributes["name"].Value);
                            break;
                        case "clear":
                            config.Handlers.Clear();
                            break;
            //						default:
            //							throw new NotSupportedException(string.Format("Wrong Xml Element: {0}",item.OuterXml));
                    }
                }
                catch(Exception ex)
                {
                    throw new ConfigurationErrorsException(ex.Message, ex,item);
                }
            }

            return config;
        }
示例#3
0
        /// <summary>
        /// Initializes the <see cref="Pop3Manager"/> class.
        /// </summary>
        static Pop3Manager()
        {
            Pop3ManagerConfig config = (Pop3ManagerConfig)ConfigurationManager.GetSection("pop3Modules");

            _current = new Pop3Manager(config);

            // Fixed: Remove Handler.Init from constructor !!! _current ==  null
            _current.Init();
        }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pop3Manager"/> class.
 /// </summary>
 /// <param name="config">The config.</param>
 private Pop3Manager(Pop3ManagerConfig config)
 {
     Pop3Manager._current = this;
     _config = config;
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pop3Manager"/> class.
 /// </summary>
 /// <param name="config">The config.</param>
 private Pop3Manager(Pop3ManagerConfig config)
 {
     Pop3Manager._current = this;
     _config = config;
 }