Ejemplo n.º 1
0
        /// <summary>
        ///     Retrieves the property descriptor for the given page / value name.  Returns
        ///     null if the property couldn't be found.
        /// </summary>
        private PropertyDescriptor GetOptionProperty(string pageName, string valueName)
        {
            if (pageName == null)
            {
                throw new ArgumentNullException(nameof(pageName));
            }

            if (valueName == null)
            {
                throw new ArgumentNullException(nameof(valueName));
            }

            string[] optionNames = pageName.Split(s_slash);

            DesignerOptionCollection options = Options;

            foreach (string optionName in optionNames)
            {
                options = options[optionName];
                if (options == null)
                {
                    return(null);
                }
            }

            return(options.Properties[valueName]);
        }
Ejemplo n.º 2
0
        protected override void PopulateOptionCollection(DesignerOptionCollection options)
        {
            if (options.Parent != null) return;

            var designerOptions = new DesignerOptions {UseSnapLines = true, UseSmartTags = true};
            var formsDesigner = CreateOptionCollection(options, "WindowsFormsDesigner", null);
            CreateOptionCollection(formsDesigner, "General", designerOptions);
        }
 /// <summary>
 ///     This method is called on demand the first time a user asks for child
 ///     options or properties of an options collection.
 /// </summary>
 protected override void PopulateOptionCollection(DesignerOptionCollection options)
 {
     if (options.Parent == null)
     {
         DesignerOptions designerOptions = CompatibilityOptions;
         if (designerOptions != null)
         {
             CreateOptionCollection(options, "DesignerOptions", designerOptions);
         }
     }
 }
Ejemplo n.º 4
0
        protected override void PopulateOptionCollection(DesignerOptionCollection options)
        {
            if (options.Parent == null)
            {
                DesignerOptionCollection doc =
                    this.CreateOptionCollection(options, "WindowsFormsDesigner", null);

                DesignerOptions doptions = new DesignerOptions();

                doptions.UseSmartTags = true;
                doptions.UseSnapLines = true;
                this.CreateOptionCollection(doc, "General", doptions);
            }
        }
Ejemplo n.º 5
0
        protected override void PopulateOptionCollection(DesignerOptionCollection options)
        {
            if (null != options.Parent)
            {
                return;
            }

            DesignerOptions ops = new DesignerOptions();

            ops.UseSnapLines = true;
            ops.UseSmartTags = true;
            DesignerOptionCollection wfd = this.CreateOptionCollection(options, "WindowsFormsDesigner", null);

            this.CreateOptionCollection(wfd, "General", ops);
        }
        /// <devdoc>
        ///     Creates a new DesignerOptionCollection with the given name, and adds it to 
        ///     the given parent.  The "value" parameter specifies an object whose public 
        ///     properties will be used in the Propeties collection of the option collection.  
        ///     The value parameter can be null if this options collection does not offer 
        ///     any properties.  Properties will be wrapped in such a way that passing 
        ///     anything into the component parameter of the property descriptor will be 
        ///     ignored and the value object will be substituted.
        /// </devdoc>
        protected DesignerOptionCollection CreateOptionCollection (DesignerOptionCollection parent, string name, object value) {
            if (parent == null) {
                throw new ArgumentNullException("parent");
            }

            if (name == null) {
                throw new ArgumentNullException("name");
            }

            if (name.Length == 0) {
                throw new ArgumentException(SR.GetString(SR.InvalidArgument, name.Length.ToString(CultureInfo.CurrentCulture), (0).ToString(CultureInfo.CurrentCulture)), "name.Length");
            }

            return new DesignerOptionCollection(this, parent, name, value);
        }
Ejemplo n.º 7
0
            /// <devdoc>
            ///     Creates a new DesignerOptionCollection.
            /// </devdoc>
            internal DesignerOptionCollection(DesignerOptionService service, DesignerOptionCollection parent, string name, object value)
            {
                _service = service;
                _parent  = parent;
                _name    = name;
                _value   = value;

                if (_parent != null)
                {
                    if (_parent._children == null)
                    {
                        _parent._children = new ArrayList(1);
                    }
                    _parent._children.Add(this);
                }
            }
Ejemplo n.º 8
0
 protected DesignerOptionCollection CreateOptionCollection(DesignerOptionCollection parent, string name, object value)
 {
     if (parent == null)
     {
         throw new ArgumentNullException("parent");
     }
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (name.Length == 0)
     {
         object[] args = new object[] { name.Length.ToString(CultureInfo.CurrentCulture), 0.ToString(CultureInfo.CurrentCulture) };
         throw new ArgumentException(SR.GetString("InvalidArgument", args), "name.Length");
     }
     return(new DesignerOptionCollection(this, parent, name, value));
 }
Ejemplo n.º 9
0
        protected DesignerOptionCollection CreateOptionCollection(DesignerOptionCollection parent, string name, Object value)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (name == String.Empty)
            {
                throw new ArgumentException("name.Length == 0");
            }

            return(new DesignerOptionCollection(parent, name, value, this));
        }
Ejemplo n.º 10
0
        // Go to the page and get the property associated with the option name.
        //
        private PropertyDescriptor GetOptionProperty(string pageName, string valueName)
        {
            string[] pages = pageName.Split(new char[] { '\\' });

            DesignerOptionCollection options = this.Options;

            foreach (string page in pages)
            {
                options = options[page];
                if (options == null)
                {
                    return(null);
                }
            }

            return(options.Properties[valueName]);
        }
Ejemplo n.º 11
0
            /// <summary>
            ///     Creates a new DesignerOptionCollection.
            /// </summary>
            internal DesignerOptionCollection(DesignerOptionService service, DesignerOptionCollection parent, string name, object value)
            {
                _service = service;
                Parent   = parent;
                Name     = name;
                _value   = value;

                if (Parent != null)
                {
                    parent._properties = null;
                    if (Parent._children == null)
                    {
                        Parent._children = new ArrayList(1);
                    }
                    Parent._children.Add(this);
                }
            }
Ejemplo n.º 12
0
            /// <summary>
            ///     Locates the value object to use for getting or setting a property.
            /// </summary>
            private static object RecurseFindValue(DesignerOptionCollection options)
            {
                if (options._value != null)
                {
                    return(options._value);
                }

                foreach (DesignerOptionCollection child in options)
                {
                    object value = RecurseFindValue(child);
                    if (value != null)
                    {
                        return(value);
                    }
                }

                return(null);
            }
Ejemplo n.º 13
0
        protected override void PopulateOptionCollection(DesignerOptionCollection options)
        {
            if (null != options.Parent)
            {
                return;
            }

            DesignerOptions ops = new DesignerOptions();

            ops.GridSize     = new System.Drawing.Size(8, 8);
            ops.SnapToGrid   = false;
            ops.ShowGrid     = false;
            ops.UseSnapLines = false;
            ops.UseSmartTags = true;
            DesignerOptionCollection wfd = this.CreateOptionCollection(options, "WindowsFormsDesigner", null);

            this.CreateOptionCollection(wfd, "General", ops);
        }
Ejemplo n.º 14
0
        /// <summary>
        ///     Creates a new DesignerOptionCollection with the given name, and adds it to
        ///     the given parent.  The "value" parameter specifies an object whose public
        ///     properties will be used in the Properties collection of the option collection.
        ///     The value parameter can be null if this options collection does not offer
        ///     any properties.  Properties will be wrapped in such a way that passing
        ///     anything into the component parameter of the property descriptor will be
        ///     ignored and the value object will be substituted.
        /// </summary>
        protected DesignerOptionCollection CreateOptionCollection(DesignerOptionCollection parent, string name, object value)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }

            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (name.Length == 0)
            {
                throw new ArgumentException(SR.Format(SR.InvalidArgument, name.Length.ToString(CultureInfo.CurrentCulture), (0).ToString(CultureInfo.CurrentCulture)), "name.Length");
            }

            return(new DesignerOptionCollection(this, parent, name, value));
        }
Ejemplo n.º 15
0
            internal DesignerOptionCollection(DesignerOptionCollection parent, string name, object propertiesProvider, DesignerOptionService service)
            {
                _name = name;
                _propertiesProvider = propertiesProvider;
                _parent             = parent;

                if (parent != null)
                {
                    if (parent._children == null)
                    {
                        parent._children = new ArrayList();
                    }
                    parent._children.Add(this);
                }

                _children      = new ArrayList();
                _optionService = service;
                service.PopulateOptionCollection(this);
            }
Ejemplo n.º 16
0
            public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext cxt, object value, Attribute[] attributes)
            {
                PropertyDescriptorCollection props   = new PropertyDescriptorCollection(null);
                DesignerOptionCollection     options = value as DesignerOptionCollection;

                if (options == null)
                {
                    return(props);
                }

                foreach (DesignerOptionCollection option in options)
                {
                    props.Add(new OptionPropertyDescriptor(option));
                }

                foreach (PropertyDescriptor p in options.Properties)
                {
                    props.Add(p);
                }
                return(props);
            }
Ejemplo n.º 17
0
        private PropertyDescriptor GetOptionProperty(string pageName, string valueName)
        {
            if (pageName == null)
            {
                throw new ArgumentNullException("pageName");
            }
            if (valueName == null)
            {
                throw new ArgumentNullException("valueName");
            }
            string[] strArray = pageName.Split(new char[] { '\\' });
            DesignerOptionCollection options = this.Options;

            foreach (string str in strArray)
            {
                options = options[str];
                if (options == null)
                {
                    return(null);
                }
            }
            return(options.Properties[valueName]);
        }
Ejemplo n.º 18
0
 protected override bool ShowDialog(DesignerOptionCollection options, object optionObject)
 {
     ShowDialogValue = optionObject;
     return(true);
 }
Ejemplo n.º 19
0
 public DesignerOptionCollection DoCreateOptionCollection(DesignerOptionCollection parent, string name, object value)
 {
     return(CreateOptionCollection(parent, name, value));
 }
            /// <devdoc>
            ///     Creates a new DesignerOptionCollection.
            /// </devdoc>
            internal DesignerOptionCollection(DesignerOptionService service, DesignerOptionCollection parent, string name, object value) {
                _service = service;
                _parent = parent;
                _name = name;
                _value = value;

                if (_parent != null) {
                    if (_parent._children == null) {
                        _parent._children = new ArrayList(1);
                    }
                    _parent._children.Add(this);
                }
            }
	public int IndexOf(DesignerOptionCollection value) {}
 public int IndexOf(DesignerOptionCollection value)
 {
   return default(int);
 }
 protected override void PopulateOptionCollection(DesignerOptionCollection options)
 {
     PopulateOptionCollectionCallCount++;
     base.PopulateOptionCollection(options);
 }
Ejemplo n.º 24
0
 public int IndexOf(DesignerOptionCollection value)
 {
     throw new NotImplementedException();
 }
		protected DesignerOptionCollection CreateOptionCollection (DesignerOptionCollection parent, string name, Object value)
		{
			if (name == null)
				throw new ArgumentNullException ("name");
			if (parent == null)
				throw new ArgumentNullException ("parent");
			if (name == String.Empty)
				throw new ArgumentException ("name.Length == 0");
				
			return new DesignerOptionCollection (parent, name, value, this);			
		}
 public int IndexOf(DesignerOptionCollection value)
 {
     return(default(int));
 }
            /// <devdoc>
            ///     Locates the value object to use for getting or setting a property.
            /// </devdoc>
            private static object RecurseFindValue(DesignerOptionCollection options) {
                if (options._value != null) {
                    return options._value;
                }

                foreach(DesignerOptionCollection child in options) {
                    object value = RecurseFindValue(child);
                    if (value != null) {
                        return value;
                    }
                }

                return null;
            }
 /// <devdoc>
 ///     Returns the numerical index of the given value.
 /// </devdoc>
 public int IndexOf(DesignerOptionCollection value) {
     EnsurePopulated();
     return _children.IndexOf(value);
 }
Ejemplo n.º 29
0
 public bool DoShowDialog(DesignerOptionCollection options, object optionObject)
 {
     return(base.ShowDialog(options, optionObject));
 }
 /// <summary>
 ///     This method is called on demand the first time a user asks for child
 ///     options or properties of an options collection.
 /// </summary>
 protected override void PopulateOptionCollection(DesignerOptionCollection options) => throw new NotImplementedException(SR.NotImplementedByDesign);
Ejemplo n.º 31
0
 public int IndexOf(DesignerOptionCollection item)
 {
     return(_children.IndexOf(item));
 }
 public void PopulateOptionCollectionEntry(DesignerOptionCollection options)
 {
     PopulateOptionCollection(options);
 }
			public int IndexOf (DesignerOptionCollection item)
			{
				return _children.IndexOf (item);
			}
Ejemplo n.º 34
0
 /// <summary>
 ///     This method must be implemented to show the options dialog UI for the given object.
 /// </summary>
 protected virtual bool ShowDialog(DesignerOptionCollection options, object optionObject)
 {
     return(false);
 }
			internal DesignerOptionCollection (DesignerOptionCollection parent, string name, object propertiesProvider, DesignerOptionService service)
			{
				_name = name;
				_propertiesProvider = propertiesProvider;
				_parent = parent;

				if (parent != null) {
					if (parent._children == null)
						parent._children = new ArrayList ();
					parent._children.Add (this);
				}
				
				_children = new ArrayList ();
				_optionService = service;
				service.PopulateOptionCollection (this);
			}
Ejemplo n.º 36
0
 /// <summary>
 ///     Returns the numerical index of the given value.
 /// </summary>
 public int IndexOf(DesignerOptionCollection value)
 {
     EnsurePopulated();
     return(_children.IndexOf(value));
 }
Ejemplo n.º 37
0
 protected override void PopulateOptionCollection(DesignerOptionCollection options)
 {
     CreateOptionCollection(options, "Name", "Value");
 }
 internal OptionPropertyDescriptor(DesignerOptionCollection option) : base(option.Name, null) {
     _option = option;
 }
Ejemplo n.º 39
0
 public int IndexOf(DesignerOptionCollection value)
 {
 }
Ejemplo n.º 40
0
 internal OptionPropertyDescriptor(DesignerOptionCollection option) : base(option.Name, null)
 {
     _option = option;
 }
 /// <devdoc>
 ///     This method is called on demand the first time a user asks for child 
 ///     options or properties of an options collection. 
 /// </devdoc>
 protected virtual void PopulateOptionCollection(DesignerOptionCollection options) {
 }
Ejemplo n.º 42
0
 /// <summary>
 ///     This method is called on demand the first time a user asks for child
 ///     options or properties of an options collection.
 /// </summary>
 protected virtual void PopulateOptionCollection(DesignerOptionCollection options)
 {
 }
 /// <devdoc>
 ///     This method must be implemented to show the options dialog UI for the given object.  
 /// </devdoc>
 protected virtual bool ShowDialog(DesignerOptionCollection options, object optionObject) {
     return false;
 }