/// <summary> /// Computes the commands using the "Commands" delegate and notifies the listenes that the set of sub-static commands associated /// with this MultiStaticCommand has been generated. /// </summary> public void ComputeCommands() { var newCommands = Commands?.Invoke() ?? Enumerable.Empty <TCommand>(); var oldCommands = subCommands ?? Enumerable.Empty <TCommand>(); subCommands = newCommands; OnCommandsComputed?.Invoke(oldCommands, newCommands); }
/// <summary> /// Computes the commands using the "Commands" delegate and notifies the listenes that the set of sub-dependency commands associated /// with this MultiDependencyCommand has been generated. /// </summary> public void ComputeCommands(object o) { var newCommands = Commands?.Invoke((T)o) ?? Enumerable.Empty <TCommand>(); var oldCommands = subCommands ?? Enumerable.Empty <TCommand>(); if (newCommands.Any(cmd => cmd.DependencyType != DependencyType)) { throw new Exception($"Error : The dependency type of all the dependency commands returned by the getter delegate must match the dependency type of the MultiDependencyCommand."); } subCommands = newCommands; OnCommandsComputed?.Invoke(oldCommands, newCommands); }