/// <summary>
 /// Writes a collection of options to the XmlDocument
 /// </summary>
 /// <param name="doc"></param>
 /// <param name="parent"></param>
 /// <param name="options"></param>
 /// <param name="alwaysPersist"></param>
 private void WriteOptions(XmlDocument doc, XmlElement parent, XmlConfigurationOptionCollection options, bool alwaysPersist)
 {
     try
     {
         /// write each option in this category
         foreach (XmlConfigurationOption option in options)
         {
             this.WriteOption(doc, parent, option, alwaysPersist);
         }
     }
     catch (System.Exception systemException)
     {
         System.Diagnostics.Trace.WriteLine(systemException);
     }
 }
        public object Clone()
        {
            XmlConfigurationOptionCollection clone = new XmlConfigurationOptionCollection();

            clone.ResetBeforeEdit();
            clone.ResetChanged();
            clone.ResetAfterEdit();
            clone.ResetEditCancelled();

            foreach (XmlConfigurationOption option in base.InnerList)
            {
                XmlConfigurationOption clonedOption = (XmlConfigurationOption)option.Clone();
                clonedOption.Parent = clone;
                clone.Add(clonedOption);
            }

            return(clone);
        }
		private void LoadOptions(XmlConfigurationOptionCollection options)
		{
			if (options == null)
				throw new ArgumentNullException("options");
			
			foreach(XmlConfigurationOption option in options)
			{
				try
				{
					if (!option.Hidden)
					{
						XmlConfigurationOptionPropertyDescriptor pd = new XmlConfigurationOptionPropertyDescriptor(option);                        
						_descriptors.Add(pd);
						_table.Add(pd, option);
					}
				}
				catch(System.Exception systemException)
				{
					System.Diagnostics.Trace.WriteLine(systemException);
				}
			}
		}
        public bool ApplyToSelf(ISupportsEditing editableObject, SupportedEditingActions actions)
        {
            XmlConfigurationOptionCollection options = editableObject as XmlConfigurationOptionCollection;

            if (options != null)
            {
                foreach (XmlConfigurationOption option in options)
                {
                    XmlConfigurationOption myOption = this[option.ElementName];
                    if (myOption != null)
                    {
                        try
                        {
                            myOption.ApplyToSelf((ISupportsEditing)option, actions);
                        }
                        catch (System.Exception systemException)
                        {
                            System.Diagnostics.Trace.WriteLine(systemException);
                        }
                    }
                }
            }
            return(true);
        }
        private void LoadOptions(XmlConfigurationOptionCollection options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            foreach (XmlConfigurationOption option in options)
            {
                try
                {
                    if (!option.Hidden)
                    {
                        XmlConfigurationOptionPropertyDescriptor pd = new XmlConfigurationOptionPropertyDescriptor(option);
                        _descriptors.Add(pd);
                        _table.Add(pd, option);
                    }
                }
                catch (System.Exception systemException)
                {
                    System.Diagnostics.Trace.WriteLine(systemException);
                }
            }
        }
 public XmlConfigurationOptionCollectionTypeDescriptor(XmlConfigurationOptionCollection options) : this()
 {
     this.LoadOptions(options);
 }
		public object Clone()
		{
			XmlConfigurationOptionCollection clone = new XmlConfigurationOptionCollection();
			clone.ResetBeforeEdit();
			clone.ResetChanged();
			clone.ResetAfterEdit();
			clone.ResetEditCancelled();

			foreach(XmlConfigurationOption option in base.InnerList)
			{
				XmlConfigurationOption clonedOption = (XmlConfigurationOption)option.Clone();
				clonedOption.Parent = clone;
				clone.Add(clonedOption);
			} 

			return clone;
		}
		/// <summary>
		/// Writes a collection of options to the XmlDocument
		/// </summary>
		/// <param name="doc"></param>
		/// <param name="parent"></param>
		/// <param name="options"></param>
		/// <param name="alwaysPersist"></param>
		private void WriteOptions(XmlDocument doc, XmlElement parent, XmlConfigurationOptionCollection options, bool alwaysPersist)
		{
			try
			{
				/// write each option in this category
				foreach(XmlConfigurationOption option in options)
					this.WriteOption(doc, parent, option, alwaysPersist);
			}
			catch(System.Exception systemException)
			{
				System.Diagnostics.Trace.WriteLine(systemException);
			}
		}
		public XmlConfigurationOptionCollectionTypeDescriptor(XmlConfigurationOptionCollection options) : this()
		{
			this.LoadOptions(options);
		}
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the XmlConfigurationCategory class
 /// </summary>
 public XmlConfigurationCategory(XmlConfigurationCategory category) : base((XmlConfigurationElement)category)
 {
     _options    = category.Options;
     _categories = category.Categories;
     _parent     = category.Parent;
 }
		/// <summary>
		/// Initializes a new instance of the XmlConfigurationCategory class
		/// </summary>
		public XmlConfigurationCategory(XmlConfigurationCategory category) : base((XmlConfigurationElement)category)
		{
			_options = category.Options;
			_categories = category.Categories;
			_parent = category.Parent;
		}