Exemple #1
0
            //=====================================================================

            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="owner">The owning property page</param>
            /// <param name="buildProperty">The build property to edit or null for a new property</param>
            public PropertyItem(UserDefinedPropertiesPageControl owner, ProjectProperty buildProperty)
            {
                string newPropName;
                int    idx = 1;

                this.Owner = owner;
                projProp   = buildProperty;

                if (projProp != null)
                {
                    name      = projProp.Name;
                    condition = projProp.Xml.Condition;
                    propValue = projProp.UnevaluatedValue;
                }
                else
                {
                    do
                    {
                        newPropName = "NewProperty" + idx.ToString(CultureInfo.InvariantCulture);
                        idx++;
                    } while(!this.Owner.Project.IsValidUserDefinedPropertyName(newPropName) ||
                            this.Owner.UserDefinedProperties.Where(p => p.Name == newPropName).Count() != 0);

                    name      = newPropName;
                    propValue = String.Empty;
                }
            }
            //=====================================================================

            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="owner">The owning property page</param>
            /// <param name="buildProperty">The build property to edit or null for a new property</param>
            public PropertyItem(UserDefinedPropertiesPageControl owner, ProjectProperty buildProperty)
            {
                string newPropName;
                int idx = 1;

                this.Owner = owner;
                projProp = buildProperty;

                if(projProp != null)
                {
                    name = projProp.Name;
                    condition = projProp.Xml.Condition;
                    propValue = projProp.UnevaluatedValue;
                }
                else
                {
                    do
                    {
                        newPropName = "NewProperty" + idx.ToString(CultureInfo.InvariantCulture);
                        idx++;

                    } while(!this.Owner.Project.IsValidUserDefinedPropertyName(newPropName) ||
                        this.Owner.UserDefinedProperties.Where(p => p.Name == newPropName).Count() != 0);

                    name = newPropName;
                    propValue = String.Empty;
                }
            }