Ejemplo n.º 1
0
        /// <devdoc>
        /// Preprocess all the attributes at parse time, so that we'll be left
        /// with as little work as possible when we build the control.
        /// </devdoc>
        private void PreprocessAttributes(ParsedAttributeCollection attribs) {

            ProcessImplicitResources(attribs);

            //Since the attribute column values are only used for generating line pragmas at design time for intellisense to work,
            //we populate that only at design time so that runtime memory usage is not affected.
            bool isDesignerMode = BuildManagerHost.InClientBuildManager;
            IDictionary<String, Pair> attributeValuePositions = null;

            if (isDesignerMode) {
                //This dictionary indicates the column values at which the attribute value expressions begin and 
                //that is used for generating line pragmas at design time for intellisense.
                attributeValuePositions = attribs.AttributeValuePositionsDictionary;
            }

            // Preprocess all the attributes
            foreach (FilteredAttributeDictionary filteredAttributes in attribs.GetFilteredAttributeDictionaries()) {
                string filter = filteredAttributes.Filter;

                foreach (DictionaryEntry attribute in filteredAttributes) {
                    string name = attribute.Key.ToString();
                    string value = attribute.Value.ToString();
                    int column = 0; 
                    int line = 0;
                    if (isDesignerMode && attributeValuePositions.ContainsKey(name)) {
                        line = (int)attributeValuePositions[name].First;
                        column = (int)attributeValuePositions[name].Second;
                    }

                    PreprocessAttribute(filter, name, value, false, line, column);
                }
            }
        }
 private void PreprocessAttributes(ParsedAttributeCollection attribs)
 {
     this.ProcessImplicitResources(attribs);
     foreach (FilteredAttributeDictionary dictionary in attribs.GetFilteredAttributeDictionaries())
     {
         string filter = dictionary.Filter;
         foreach (DictionaryEntry entry in (IEnumerable) dictionary)
         {
             string attribname = entry.Key.ToString();
             string attribvalue = entry.Value.ToString();
             this.PreprocessAttribute(filter, attribname, attribvalue, false);
         }
     }
 }