XContainer
holding node and link data, replace this model's NodesSource and LinksSource collections with collections of new node data and new link data.
Visual Basic (Declaration) | |
---|---|
Public Overloads Sub Load (Of NodeDataType As GraphLinksModelNodeData(Of NodeKey), LinkDataType As GraphLinksModelLinkData(Of NodeKey,PortKey))( _ ByVal root As XContainer, _ ByVal nodedataallocator As Func(Of XElement,NodeDataType), _ ByVal linkdataallocator As Func(Of XElement,LinkDataType) _ ) |
C# | |
---|---|
public void Load<NodeDataType,LinkDataType>( XContainer root, Func<XElement,NodeDataType> nodedataallocator, Func<XElement,LinkDataType> linkdataallocator )where NodeDataType: GraphLinksModelNodeData<NodeKey> where LinkDataType: GraphLinksModelLinkData<NodeKey,PortKey> |
Parameters
- root
- the
XContainer
holding all of the data - nodedataallocator
- a function that takes an
XElement
and returns either a newly constructed object of type NodeDataType or null if thatXElement
is to be ignored - linkdataallocator
- a function that takes an
XElement
and returns either a newly constructed object of type LinkDataType or null if thatXElement
is to be ignored
Type Parameters
- NodeDataType
- this must be a class inheriting from Northwoods.GoXam.Model.GraphLinksModelNodeData<NodeKey>
- LinkDataType
- this must be a class inheriting from Northwoods.GoXam.Model.GraphLinksModelLinkData<NodeKey,PortKey>
This will iterate over all of the child elements of the root container, calling nodedataallocator on each one. If that function returns non-null, it calls LoadFromXElement on the new data and then adds it to the NodesSource collection. It will then iterate again over all of the child elements of the root container, calling linkdataallocator on each one. If that function returns non-null, it calls GraphLinksModelLinkData<NodeKey,PortKey>.LoadFromXElement on the new data and then adds it to the LinksSource collection.
All of the changes to this model are performed within a transaction.
This does not set the IsModified property to false. You may wish to do so, depending on your application requirements. You might also wish to clear the UndoManager.