public PropertyNode AddProperty(IResourceProperty property) { PropertyNode propertyNode = new PropertyNode(property); _properties.Add(propertyNode); return(propertyNode); }
private void AddProperty(ResourceNode resourceNode, IResourceProperty property, TreeNode parentNode) { int iconIndex = Core.ResourceIconManager.GetPropTypeIconIndex(property.PropId); string linkDisplayName = _resourceStore.PropTypes.GetPropDisplayName(property.PropId); TreeNode treeSubNode = new TreeNode(linkDisplayName, iconIndex, iconIndex); PropertyNode propertyNode = resourceNode.AddProperty(property); treeSubNode.Tag = new SerializableTag(propertyNode, SerializableTag.Type.Link); parentNode.Nodes.Add(treeSubNode); _resourceTreeView.SetNodeCheckState(treeSubNode, NodeCheckState.Checked); }
private void AddLink(ResourceNode resourceNode, IResourceProperty property, TreeNode parentNode) { int iconIndex = Core.ResourceIconManager.GetPropTypeIconIndex(property.PropId); string linkDisplayName = _resourceStore.PropTypes.GetPropDisplayName(property.PropId); Tracer._Trace("LINKNAME = " + linkDisplayName + " LINKID = " + property.PropId.ToString()); TreeNode treeSubNode = new TreeNode(linkDisplayName, iconIndex, iconIndex); LinkNode linkNode = resourceNode.AddLink(linkDisplayName, property.Name, property.PropId < 0); treeSubNode.Tag = new SerializableTag(linkNode, SerializableTag.Type.Link); parentNode.Nodes.Add(treeSubNode); _resourceTreeView.SetNodeCheckState(treeSubNode, NodeCheckState.Checked); if (AddLinkedResources(treeSubNode, resourceNode.Resource, property.PropId, linkNode) == 0) { parentNode.Nodes.Remove(treeSubNode); } }
private static void WriteResourceProperty2Entry(IResource res, IResourceProperty prop, XmlTextWriter writer) { int propId = Core.ResourceStore.PropTypes[prop.Name].Id; string name = prop.Name; ContactManager cMgr = (ContactManager)Core.ContactManager; if (prop.DataType != PropDataType.Link) { string val = HtmlTools.SafeHtmlDecode(prop.Value.ToString()); writer.WriteStartElement("prop"); writer.WriteAttributeString("name", name); writer.WriteAttributeString("value", val); writer.WriteEndElement(); } else if (!cMgr.IsMajorLink(propId) && !cMgr.IsNameLink(propId) && (propId != Core.Props.Reply)) { IResourceList linked = res.GetLinksOfType(null, propId); string val = HtmlTools.SafeHtmlDecode(linked[0].DisplayName); if (linked.Count == 1) { writer.WriteStartElement("prop"); writer.WriteAttributeString("name", name); writer.WriteAttributeString("value", val); writer.WriteEndElement(); } else { writer.WriteStartElement(name + "-set"); foreach (IResource linkRes in linked) { val = HtmlTools.SafeHtmlDecode(linkRes.DisplayName); writer.WriteStartElement("prop"); writer.WriteAttributeString("name", name); writer.WriteAttributeString("value", val); writer.WriteEndElement(); } writer.WriteEndElement(); } } }
private SerializationMode GetSerializationMode(IResourceSerializer serializer, IResource resource, IResourceProperty property) { SerializationMode serMode = serializer.GetSerializationMode(resource, property.Name); if (serMode == SerializationMode.Default) { IPropType propType = Core.ResourceStore.PropTypes [property.Name]; if (propType.HasFlag(PropTypeFlags.AskSerialize)) { return(SerializationMode.AskSerialize); } if (propType.HasFlag(PropTypeFlags.NoSerialize)) { return(SerializationMode.NoSerialize); } if (property.DataType == PropDataType.Link && propType.HasFlag(PropTypeFlags.Internal)) { return(SerializationMode.NoSerialize); } return(SerializationMode.Serialize); } return(serMode); }
public PropertyNode(IResourceProperty property) { _property = property; }