/// <summary> /// Unregisters a global handler. /// </summary> /// <param name='handler'> /// The handler. /// </param> public void UnregisterGlobalHandler (object handler) { globalHandlerChain = CommandTargetChain.RemoveTarget (globalHandlerChain, handler); }
public static CommandTargetChain AddTarget (CommandTargetChain chain, object target) { if (chain == null) return new CommandTargetChain (target); else { chain.Next = AddTarget (chain.Next, target); return chain; } }
/// <summary> /// Registers a global command handler. /// </summary> /// <param name='handler'> /// The handler /// </param> /// <remarks> /// Global command handler are added to the end of the command route. /// </remarks> public void RegisterGlobalHandler (object handler) { globalHandlerChain = CommandTargetChain.AddTarget (globalHandlerChain, handler); }
public static CommandTargetChain RemoveTarget (CommandTargetChain chain, object target) { if (chain == null) return null; if (chain.target == target) return chain.Next; else if (chain.Next != null) chain.Next = CommandTargetChain.RemoveTarget (chain.Next, target); return chain; }