public void Dispatch(PropertyKey key, ExecuteEventHandlerArgs args) { ExecuteWithArgsDelegate executeWithArgsDelegate = commands[key] as ExecuteWithArgsDelegate; if (executeWithArgsDelegate != null) { executeWithArgsDelegate(args); return; } CommandId commandId = (CommandId)commands[key]; Command command = CommandManager.Get(commandId); command.PerformExecuteWithArgs(args); }
/// <summary> /// Associates a commandid with the property key. /// </summary> /// <param name="key"></param> /// <param name="executeWithArgsDelegate"></param> public void AddCommand(PropertyKey key, ExecuteWithArgsDelegate executeWithArgsDelegate) { commands.Add(key, executeWithArgsDelegate); }