Hi everyone,
Here is my problem:
I have the following classes:
- DataNode - this class is designed to hold some data and will be contained
in a tree like data structure DataTree. When DataNode is changed, it raises
"Changed" event. The class has a reference to the DataNode it is being
contained in:
- DataTree - tree like data structure that contains DataNodes; When
DataNodes are inserted, deleted or reodered, DataTree raises the following
events: Inserted, Deleted, Reodered. It also listens to Changed event of the
DataNodes it contains. DataTree subscribes to the Changed events of the
DataNodes when they are added.
- DataTreeCollection - contains multiple DataTrees. It also subscribes to
DataTrees' events
So as you can see, DataTreeCollection ends up with the following events
- DataNode's Changed
- DataTree's Inserted, Removed, Reodered
This way in my application I have to listen to only one instance of
DataTreeCollection, but I still can listen to all events, because all the
players propagate their events to their owners. But a negative side to this
is that the parent of all children will have to have all possible events of
his children...
What do you think about a design like this?
I wonder, if there is better way to do this:
I would love to hear some suggestions or critique
Thank you in advance,
Sasha