public bool ProcessNode(XamlReader reader, XamlWriter targetWriter, int currentDepth, IXamlLineInfo readerLineInfo)
 {
     if ((currentDepth == this.Depth) && ((reader.NodeType == XamlNodeType.NamespaceDeclaration) || (reader.NodeType == XamlNodeType.None)))
     {
         this.bufferedNodes.Writer.WriteNode(reader, readerLineInfo);
         reader.Read();
         return(true);
     }
     if ((((reader.NodeType == XamlNodeType.StartObject) && reader.Type.IsGeneric) && ((reader.Type.UnderlyingType != null) && (reader.Type.Name == "PropertyReferenceExtension"))) && (reader.Type.UnderlyingType.GetGenericTypeDefinition() == typeof(PropertyReferenceExtension <>)))
     {
         if (this.bufferedNodes.Count > 0)
         {
             XamlServices.Transform(this.bufferedNodes.Reader, targetWriter, false);
             this.bufferedNodes = null;
         }
         XamlType   type     = reader.Type;
         XamlReader reader2  = reader.ReadSubtree();
         XamlType   xamlType = reader.SchemaContext.GetXamlType(typeof(ActivityBuilder));
         XamlType   type3    = reader.SchemaContext.GetXamlType(typeof(ActivityPropertyReference));
         targetWriter.WriteStartMember(xamlType.GetAttachableMember("PropertyReference"), readerLineInfo);
         reader2.Read();
         targetWriter.WriteStartObject(type3, readerLineInfo);
         targetWriter.WriteStartMember(type3.GetMember("TargetProperty"), readerLineInfo);
         targetWriter.WriteValue(this.currentMember.Name, readerLineInfo);
         targetWriter.WriteEndMember(readerLineInfo);
         bool flag  = reader2.Read();
         bool flag2 = false;
         while (flag)
         {
             if (((reader2.NodeType == XamlNodeType.StartMember) && (reader2.Member.DeclaringType == type)) && (reader2.Member.Name == "PropertyName"))
             {
                 flag2 = true;
             }
             else if (flag2)
             {
                 if (reader2.NodeType == XamlNodeType.EndMember)
                 {
                     flag2 = false;
                 }
                 else if (reader2.NodeType == XamlNodeType.Value)
                 {
                     targetWriter.WriteStartMember(type3.GetMember("SourceProperty"), readerLineInfo);
                     targetWriter.WriteValue((string)reader2.Value, readerLineInfo);
                     targetWriter.WriteEndMember(readerLineInfo);
                 }
             }
             flag = reader2.Read();
         }
         targetWriter.WriteEndObject(readerLineInfo);
         targetWriter.WriteEndMember(readerLineInfo);
         this.ExitObject = true;
         reader2.Close();
     }
     else
     {
         this.FlushBuffer(targetWriter);
         targetWriter.WriteNode(reader, readerLineInfo);
     }
     return(false);
 }
        /// <summary>Closes the current object.</summary>
        /// <returns>Current evaluated object or null.</returns>
        public object WriteEndObject()
        {
            // write pending text
            WritePendingText(false);

            xamlTypes.Pop();
            writer.WriteEndObject();
            return(GetResult());
        }         // proc WriteEndObject
        // Given the viewStateInfo dictionary, this method returns a xaml node list matching a ViewStateManager
        // object.
        static XamlNodeList CreateViewStateManagerNodeList(Dictionary <string, XamlNodeList> viewStateInfo, XamlSchemaContext schemaContext)
        {
            XamlNodeList viewStateManagerNodeList = new XamlNodeList(schemaContext);

            XamlMember viewStateDataMember  = new XamlMember(typeof(ViewStateManager).GetProperty("ViewStateData"), schemaContext);
            XamlType   viewStateManagerType = new XamlType(typeof(ViewStateManager), schemaContext);
            XamlType   viewStateDataType    = new XamlType(typeof(ViewStateData), schemaContext);
            XamlMember idMember             = new XamlMember(typeof(ViewStateData).GetProperty("Id"), schemaContext);

            using (XamlWriter viewStateManagerNodeWriter = viewStateManagerNodeList.Writer)
            {
                viewStateManagerNodeWriter.WriteStartObject(viewStateManagerType);
                viewStateManagerNodeWriter.WriteStartMember(viewStateDataMember);
                viewStateManagerNodeWriter.WriteGetObject();
                viewStateManagerNodeWriter.WriteStartMember(XamlLanguage.Items);

                foreach (KeyValuePair <string, XamlNodeList> entry in viewStateInfo)
                {
                    viewStateManagerNodeWriter.WriteStartObject(viewStateDataType);

                    viewStateManagerNodeWriter.WriteStartMember(idMember);
                    viewStateManagerNodeWriter.WriteValue(entry.Key);
                    viewStateManagerNodeWriter.WriteEndMember(); // idMember

                    XamlReader viewStateValueReader = entry.Value.GetReader();
                    while (viewStateValueReader.Read())
                    {
                        viewStateManagerNodeWriter.WriteNode(viewStateValueReader);
                    }

                    viewStateManagerNodeWriter.WriteEndObject(); // viewStateDataType
                }

                viewStateManagerNodeWriter.WriteEndMember(); // XamlLanguage.Items
                viewStateManagerNodeWriter.WriteEndObject(); // GetObject
                viewStateManagerNodeWriter.WriteEndMember(); // viewStateDataMember
                viewStateManagerNodeWriter.WriteEndObject(); // viewStateManagerType
                viewStateManagerNodeWriter.Close();
            }

            return(viewStateManagerNodeList);
        }
Beispiel #4
0
        public override void WriteEndObject()
        {
            _indent        -= 1;
            CurrentNodeText = "EO";
            BuildString();

            if (_wrappedWriter != null)
            {
                _wrappedWriter.WriteEndObject();
            }
        }
Beispiel #5
0
 internal static void WriteNodeList(XamlWriter writer, XamlNodeList nodeList)
 {
     // We need to pass the ErrorNodes contents through as a NodeList, because XOW doesn't
     // currently support unknown types, even inside a DeferLoad block.
     // But if a NodeList is written to XOW as a Value, XOW will unpack, forcing us to re-buffer
     // the nodes in our deferring loader. So we wrap the NodeList value inside a dummy StartObject.
     writer.WriteStartObject(XamlLanguage.Object);
     writer.WriteStartMember(XamlLanguage.Initialization);
     writer.WriteValue(nodeList);
     writer.WriteEndMember();
     writer.WriteEndObject();
 }
Beispiel #6
0
 public override void WriteTo(XamlWriter writer)
 {
     Log("GetObject");
     writer.WriteGetObject();
     Debug.Indent();
     foreach (XamlNode node in this.Children)
     {
         node.WriteTo(writer);
     }
     Debug.Unindent();
     Log("EndObject");
     writer.WriteEndObject();
 }
        public override void WriteEndObject()
        {
            --_depth;
            Indent();

            _out.Write("EO");

            var xamlType = _stack.Peek().Type;

            if (ShowCloseComments)
            {
                _out.Write("        // ");

                if (xamlType == null)
                {
                    _out.Write(_nullString);
                }
                else
                {
                    var xmlNamespaces = xamlType.GetXamlNamespaces();
                    var prefix        = _stack.FindPrefixFromXmlnsList(xmlNamespaces);

                    if (!string.IsNullOrEmpty(prefix))
                    {
                        _out.Write("{0}:", prefix);
                    }
                    _out.Write("{0}", xamlType.Name);
                }
            }
            _out.WriteLine("     {0}", LineInfoString);

            _stack.Pop();

            if (_wrappedWriter != null)
            {
                _wrappedWriter.WriteEndObject();
            }
        }
 public static void WriteEndObject(this XamlWriter writer, IXamlLineInfo lineInfo)
 {
     PropagateLineInfo(writer, lineInfo);
     writer.WriteEndObject();
 }