Here is an event I use to check when an item has moved.
#region Events public delegate void PositionChangeHandler(Object Sender); public event PositionChangeHandler PositionChangedEvent; protected virtual void OnPositionChanged() { if (PositionChangedEvent != null) PositionChangedEvent(this); } #endregion
And then in the method where I am updating the position of the item:
OnPositionChanged();
After that we can easily hook to the event from the other classes:
ParentObjective.PositionChangedEvent += new Objective.PositionChangeHandler(RelatedObjectives_PositionChangedEvent);
Nice and easy.
No comments:
Post a Comment