Catel.MVVM.CompositeCommand.ExecuteCompositeCommand C# (CSharp) Method

ExecuteCompositeCommand() private method

private ExecuteCompositeCommand ( object parameter ) : void
parameter object
return void
        private void ExecuteCompositeCommand(object parameter)
        {
            lock (_lock)
            {
                var commands = (from commandInfo in _commandInfo
                                select commandInfo.Command).ToList();

                foreach (var command in commands)
                {
                    try
                    {
                        if (command != null)
                        {
                            if (command.CanExecute(parameter))
                            {
                                command.Execute(parameter);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "Failed to execute one of the commands in the composite commands, execution will continue");
                    }
                }

                var actions = _actions.ToList();
                foreach (var action in actions)
                {
                    try
                    {
                        if (action != null)
                        {
                            action();
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "Failed to execute one of the actions in the composite commands, execution will continue");
                    }
                }

                var actionsWithParameter = _actionsWithParameter.ToList();
                foreach (var actionWithParameter in actionsWithParameter)
                {
                    try
                    {
                        if (actionWithParameter != null)
                        {
                            actionWithParameter(parameter);
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "Failed to execute one of the actions in the composite commands, execution will continue");
                    }
                }
            }
        }