Hey there,
Can anybody tell me how I can decide if a link was created by the user, or by code.
When I write the data back to my database ( in the OnChange override like the manual says) it works fine if the Link was created by the user interface.
But this method gets also called when i add a new link in code ( when an other component changes the data and I have to update the links).
So I would try to update the data again ! ! !
Here the code : The Connect Method commits the data to the database !
protected override void OnChanged(ModelChangedEventArgs e) { base.OnChanged(e); if (e.Change == ModelChange.AddedLink) { var wire = e.Data as Wire; var sourceNode = FindNodeByKey(wire.From); var sinkNode = FindNodeByKey(wire.To); var createdConnections = Connect(sourceNode, wire.FromPort, sinkNode, wire.ToPort); wire.Connections = createdConnections; } }
Is there a build in way to solve this problem ?
Can I find out if the Link (Wire in my case) was created from the user interface or in code ?
Or is this the wron way to persist the data ?
Thanks in advance
Daniel