예제 #1
0
파일: XamlParser.cs 프로젝트: JianwenSun/cc
 /// <summary>
 /// Write attributes of the form PresentationOptions:Whatever to Baml
 /// </summary>
 public virtual void WritePresentationOptionsAttribute(XamlPresentationOptionsAttributeNode xamlPresentationOptionsAttributeNode)
 {
     if (BamlRecordWriter != null)
     {
         BamlRecordWriter.WritePresentationOptionsAttribute(xamlPresentationOptionsAttributeNode);
     }
 }
        // Attributes used to specify WPF-specific parsing options
        internal void WritePresentationOptionsAttribute(XamlPresentationOptionsAttributeNode xamlPresentationOptionsNode)
        {
            // Add definition attribute record.  Store the attribute name in the string table, since
            // the names are likely to be repeated.
            short stringId;
            if (!MapTable.GetStringInfoId(xamlPresentationOptionsNode.Name,
                                          out stringId))
            {
                stringId = MapTable.AddStringInfoMap(BinaryWriter,
                                                     xamlPresentationOptionsNode.Name);
            }

            BamlPresentationOptionsAttributeRecord attributeRecord =
                (BamlPresentationOptionsAttributeRecord) BamlRecordManager.GetWriteRecord(
                                        BamlRecordType.PresentationOptionsAttribute);

            attributeRecord.Value = xamlPresentationOptionsNode.Value;
            attributeRecord.Name = xamlPresentationOptionsNode.Name;
            attributeRecord.NameId = stringId;

            WriteAndReleaseRecord(attributeRecord, xamlPresentationOptionsNode);
        }