public override void WriteGetObject() { CurrentNodeText = "GO"; BuildString(); _indent += 1; if (_wrappedWriter != null) { _wrappedWriter.WriteGetObject(); } }
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(); }
// 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); }
public static void WriteGetObject(this XamlWriter writer, IXamlLineInfo lineInfo) { PropagateLineInfo(writer, lineInfo); writer.WriteGetObject(); }
} // proc WriteStartObject /// <summary>Write GetObject</summary> public void WriteGetObject() => writer.WriteGetObject();
private void WriteObject(XamlType xamlType, bool isFromMember) { Indent(); if (isFromMember) { _out.Write("GO"); } else { _out.Write("SO "); } SimpleWriterFrame frame; if (_stack.CurrentIndex == 0 || _stack.Peek().NodeType == XamlNodeType.StartObject || _stack.Peek().NodeType == XamlNodeType.GetObject) { frame = new SimpleWriterFrame(); _stack.Push(frame); } else { frame = _stack.Peek(); } frame.Type = xamlType; if (xamlType == null) { if (isFromMember) { frame.NodeType = XamlNodeType.GetObject; } else { _out.Write(_nullString); } } else { // Figure out prefix frame.NodeType = XamlNodeType.StartObject; var xmlNamespaces = xamlType.GetXamlNamespaces(); var prefix = _stack.FindPrefixFromXmlnsList(xmlNamespaces); _stack.Peek().TypePrefix = prefix; switch (prefix) { case null: var nullStr = isFromMember ? _nullObjectFromMember : _nullString; _out.Write(nullStr + ":"); break; case "": break; default: _out.Write("{0}:", prefix); break; } if (xamlType.TypeArguments != null) { _out.Write("{0}({1})", xamlType.Name, Join(xamlType.TypeArguments, PrintType, ", ")); } else { _out.Write("{0}", xamlType.Name); } } if (!isFromMember && xamlType.IsUnknown) { _out.Write(" [{0}]", UnknownText); } _out.WriteLine(" {0}", LineInfoString); ++_depth; if (_wrappedWriter != null) { if (isFromMember) { _wrappedWriter.WriteGetObject(); } else { _wrappedWriter.WriteStartObject(xamlType); } } }