/// <summary> /// Adds a handler for the element that is raised when the element is detached from a functional tree. /// </summary> public static void AddDetachedFromFunctionalTreeHandler(this IFunctionalTreeElement source, FunctionalTreeEventHandler handler) { if (source == null) return; if (handler == null) throw new ArgumentNullException("handler", "handler is null."); FunctionalTreeHelper.GetFunctionalTree(source).GetFunctionalElement(source).AddDetachedFromTreeHandler(handler); }
internal void AddAttachedToTreeHandler(FunctionalTreeEventHandler handler) { if (AttachedToTreeHandlerList == null) AttachedToTreeHandlerList = handler; else Delegate.Combine(AttachedToTreeHandlerList, handler); //Handlers added to the root are different, since they're not fired on addChild/removeChild since they're not really added. //That's why handlers from the root are fired right away //TODO not sure bool isFunctionalTreeRoot = Parent == null; if (isFunctionalTreeRoot && handler != null) handler(FunctionalTreeHelper.GetFunctionalTree(Element)); }
internal void RemoveDetachedFromTreeHandler(FunctionalTreeEventHandler handler) { if (DetachedFromTreeHandlerList != null) Delegate.Remove(DetachedFromTreeHandlerList, handler); }
internal void AddDetachedFromTreeHandler(FunctionalTreeEventHandler handler) { if (DetachedFromTreeHandlerList == null) DetachedFromTreeHandlerList = handler; else Delegate.Combine(DetachedFromTreeHandlerList, handler); }