Show / Hide Table of Contents

Class CommandBase

Base class for MCART implementations of the ICommand interface.

Inheritance
object
CommandBase
ObservingCommand
SimpleCommand
Implements
ICommand
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Types.Base
Assembly: MCART.Mvvm.dll
Syntax
public abstract class CommandBase : ICommand

Constructors

| Edit this page View Source

CommandBase(Action<object?>)

Base class for MCART implementations of the ICommand interface.

Declaration
protected CommandBase(Action<object?> action)
Parameters
Type Name Description
Action<object> action

Action to associate with this command.

Methods

| Edit this page View Source

CanExecute()

Determines whether the command can execute in its current state.

Declaration
public bool CanExecute()
Returns
Type Description
bool

true if this command can execute; otherwise, false.

| Edit this page View Source

CanExecute(object?)

Determines whether the command can execute in its current state.

Declaration
public abstract bool CanExecute(object? parameter)
Parameters
Type Name Description
object parameter

Data used by the command. If the command does not require data, this object can be set to null.

Returns
Type Description
bool

true if this command can execute; otherwise, false.

| Edit this page View Source

Execute()

Executes the action associated with this command.

Declaration
public void Execute()
| Edit this page View Source

Execute(object?)

Executes the action associated with this command.

Declaration
public virtual void Execute(object? parameter)
Parameters
Type Name Description
object parameter

Data used by the command. If the command does not require data, this object can be set to null.

| Edit this page View Source

RaiseCanExecuteChanged()

Raises the CanExecuteChanged event.

Declaration
protected void RaiseCanExecuteChanged()
| Edit this page View Source

TryExecute()

Checks whether the action can execute and, if so, executes it.

Declaration
public bool TryExecute()
Returns
Type Description
bool

true if the action was executed after checking; otherwise, false.

| Edit this page View Source

TryExecute(object?)

Checks whether the action can execute and, if so, executes it.

Declaration
public bool TryExecute(object? arg)
Parameters
Type Name Description
object arg

Argument to use both for the check and for executing the action.

Returns
Type Description
bool

true if the action was executed after checking; otherwise, false.

Events

| Edit this page View Source

CanExecuteChanged

Raised when changes occur that affect whether the command should execute.

Declaration
public event EventHandler? CanExecuteChanged
Event Type
Type Description
EventHandler

Implements

ICommand

Extension Methods

Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Common.IfNotNull<T>(T?, Action<T>)
Objects.Itself<T>(T)
Objects.ShallowCopyTo<T>(T, T)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX