Exemple #1
0
        /// <summary>
        /// Determines whether this instance can execute the specified parameter.
        /// </summary>
        /// <param name="parameter">The parameter.</param>
        /// <returns>
        ///     <c>true</c> if this instance can execute the specified parameter; otherwise, <c>false</c>.
        /// </returns>
        public virtual bool CanExecute(TCanExecuteParameter parameter)
        {
            if (AuthenticationProvider != null)
            {
                if (!AuthenticationProvider.CanCommandBeExecuted(this, parameter))
                {
                    return(false);
                }
            }

            if (_canExecuteWithParameter != null)
            {
                return(_canExecuteWithParameter(parameter));
            }

            if (_canExecuteWithoutParameter != null)
            {
                return(_canExecuteWithoutParameter());
            }

            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Determines whether this instance can execute the specified parameter.
        /// </summary>
        /// <param name="parameter">The parameter.</param>
        /// <returns>
        /// <c>true</c> if this instance can execute the specified parameter; otherwise, <c>false</c>.
        /// </returns>
        public virtual bool CanExecute(TCanExecuteParameter parameter)
        {
            if (AuthenticationProvider != null)
            {
                if (!AuthenticationProvider.CanCommandBeExecuted(this, parameter))
                {
                    return(false);
                }
            }

            var result = true;

            if (_canExecuteWithParameter != null)
            {
                result = _canExecuteWithParameter(parameter);
            }
            else if (_canExecuteWithoutParameter != null)
            {
                result = _canExecuteWithoutParameter();
            }

            return(result);
        }
Exemple #3
0
        /// <summary>
        /// Determines whether this instance can execute the specified parameter.
        /// </summary>
        /// <param name="parameter">The parameter.</param>
        /// <returns>
        /// <c>true</c> if this instance can execute the specified parameter; otherwise, <c>false</c>.
        /// </returns>
        public virtual bool CanExecute(TCanExecuteParameter parameter)
        {
            if (AuthenticationProvider != null)
            {
                if (!AuthenticationProvider.CanCommandBeExecuted(this, parameter))
                {
                    return(false);
                }
            }
            bool result;

            if (_canExecuteWithParameter != null && _canExecuteWithParameter.Execute(parameter, out result))
            {
                return(result);
            }

            if (_canExecuteWithoutParameter != null && _canExecuteWithoutParameter.Execute(out result))
            {
                return(result);
            }

            return(true);
        }