public void AddCommand(ICommand command, Func <T, string> getTranslationFunc) { var namedCommand = new NamedCommand(command); Action <T> action = translation => namedCommand.Name = getTranslationFunc(translation); action(_translation); _commands.Add(namedCommand); _updateTranslationFunctions.Add(action); }
public void AddCommand(ICommand command, Func <T, string> getTranslationFunc) { command.CanExecuteChanged += (sender, args) => OnPropertyChanged(nameof(Enabled)); var namedCommand = new NamedCommand(command); Action <T> action = translation => namedCommand.Name = getTranslationFunc(translation); action(_translation); _commands.Add(namedCommand); _updateTranslationFunctions.Add(action); }