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

CanExecuteCompositeCommand() private method

private CanExecuteCompositeCommand ( object parameter ) : bool
parameter object
return bool
        private bool CanExecuteCompositeCommand(object parameter)
        {
            lock (_lock)
            {
                if (!AllowPartialExecution)
                {
                    var commands = (from commandInfo in _commandInfo
                                    select commandInfo.Command).ToList();

                    foreach (var command in commands)
                    {
                        if (command != null)
                        {
                            if (!command.CanExecute(parameter))
                            {
                                return false;
                            }
                        }
                    }
                }

                if (AtLeastOneMustBeExecutable)
                {
                    if (_actions.Count > 0 || _actionsWithParameter.Count > 0)
                    {
                        return true;
                    }

                    var commands = (from commandInfo in _commandInfo
                                    select commandInfo.Command).ToList();

                    foreach (var command in commands)
                    {
                        if (command != null)
                        {
                            if (command.CanExecute(parameter))
                            {
                                return true;
                            }
                        }
                    }

                    return false;
                }

                return true;
            }
        }