Hi,
For example,
I have two Node(NodeViewModel).
A Node and B Node, connected each by a Connector
A Node have a out port(NodePortViewModel) and the Connector started there and ended in B Node input port.
Today, I want to start from A Node and follow the Connector to find B Node.
I tried the following method but no luck :(
step 1:
(A_node.Ports as ObservableCollection)[0].Info
The "Info" Object's object type is NodePortWrapper, and this class is internal that means I can't casting "Info" as NodePortWrapper and access it.
step 2:
But in the runtime, I using Visual Studio's tracking feature find in the "Info", it has "OutConnectors" property.
step 3:
This OutConnectors property seen like some collection, and the ConnectorViewModel able to see this connector will targeting what node it point to(TargetNode property)
step 4:
So I try reflection it by using GetType().GetProperty().GetValue().
But here is question, the "OutConnectors" property's type is System.Linq.Enumerable.WhereSelectListIterator
It can't casting in the code, for example:
var foo = (A_node.Ports as ObservableCollection)[0].Info.GetType().GetProperty("OutConnectors").GetValue((A_node.Ports as ObservableCollection)[0].Info, null);
object foo can't convert to List or other things.
(foo's type is System.Linq.Enumerable.WhereSelectListIterator)
And this code only able run at runtime:
((Enumerable.WhereSelectListIterator)(A_node.Ports as ObservableCollection)[0].Info.GetType().GetProperty("OutConnectors").GetValue((A_node.Ports as ObservableCollection)[0].Info, null)).ToList()[0];
The result will seen the connector between A and B Node.
-----------------------------------------------------------------------
I started doubt is I'm in the right way to get my information?
Or there is better way to get I want?
Thanks!