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); }
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; }
/// <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(); }
/// <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; }