Show / Hide Table of Contents

Class ObservingCommand

Describe un comando que observa a un objeto que implemente INotifyPropertyChanged y escucha cualquier cambio ocurrido en el valor de sus propiedades para habilitar o deshabilitar automáticamente la ejecución del comando.

Inheritance
object
CommandBase
ObservingCommand
Implements
ICommand
Inherited Members
CommandBase.CanExecuteChanged
CommandBase.CanExecute()
CommandBase.Execute(object)
CommandBase.Execute()
CommandBase.TryExecute(object)
CommandBase.TryExecute()
CommandBase.RaiseCanExecuteChanged()
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TheXDS.MCART.Component
Assembly: MCART.Mvvm.dll
Syntax
public class ObservingCommand : CommandBase, ICommand

Constructors

| Edit this page View Source

ObservingCommand(INotifyPropertyChanged, Action)

Inicializa una nueva instancia de la clase ObservingCommand.

Declaration
public ObservingCommand(INotifyPropertyChanged observedSource, Action action)
Parameters
Type Name Description
INotifyPropertyChanged observedSource

Origen de datos observado.

Action action

Acción a ejecutar.

| Edit this page View Source

ObservingCommand(INotifyPropertyChanged, Action<object?>)

Inicializa una nueva instancia de la clase ObservingCommand.

Declaration
public ObservingCommand(INotifyPropertyChanged observedSource, Action<object?> action)
Parameters
Type Name Description
INotifyPropertyChanged observedSource

Origen de datos observado.

Action<object> action

Acción a ejecutar.

| Edit this page View Source

ObservingCommand(INotifyPropertyChanged, Func<object?, Task>)

Inicializa una nueva instancia de la clase ObservingCommand.

Declaration
public ObservingCommand(INotifyPropertyChanged observedSource, Func<object?, Task> task)
Parameters
Type Name Description
INotifyPropertyChanged observedSource

Origen de datos observado.

Func<object, Task> task

Tarea a ejecutar.

| Edit this page View Source

ObservingCommand(INotifyPropertyChanged, Func<Task>)

Inicializa una nueva instancia de la clase ObservingCommand.

Declaration
public ObservingCommand(INotifyPropertyChanged observedSource, Func<Task> task)
Parameters
Type Name Description
INotifyPropertyChanged observedSource

Origen de datos observado.

Func<Task> task

Tarea a ejecutar.

Properties

| Edit this page View Source

ObservedProperties

Enumera las propiedades que están siendo observadas por este ObservingCommand.

Declaration
public IEnumerable<string> ObservedProperties { get; }
Property Value
Type Description
IEnumerable<string>
| Edit this page View Source

ObservedSource

Referencia al origen de datos observado por este ObservingCommand.

Declaration
public INotifyPropertyChanged ObservedSource { get; }
Property Value
Type Description
INotifyPropertyChanged

Methods

| Edit this page View Source

CanExecute(object?)

Define el método que determina si el comando puede ejecutarse en su estado actual.

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

Datos que usa el comando. Si el comando no exige pasar los datos, se puede establecer este objeto en null.

Returns
Type Description
bool

true si se puede ejecutar este comando; de lo contrario, false.

Overrides
CommandBase.CanExecute(object?)
| Edit this page View Source

RegisterObservedProperty(Expression<Func<object?>>)

Registra una nueva propiedad a observar en este comando.

Declaration
public ObservingCommand RegisterObservedProperty(Expression<Func<object?>> property)
Parameters
Type Name Description
Expression<Func<object>> property

Nombre de la propiedad a observar.

Returns
Type Description
ObservingCommand

Esta misma instancia, lo que permite usar esta función con sintaxis fluent.

| Edit this page View Source

RegisterObservedProperty(params string[])

Registra una nueva propiedad a observar en este comando.

Declaration
public ObservingCommand RegisterObservedProperty(params string[] properties)
Parameters
Type Name Description
string[] properties

Nombre(s) de la(s) propiedad(es) a observar.

Returns
Type Description
ObservingCommand

Esta misma instancia, lo que permite usar esta función con sintaxis fluent.

| Edit this page View Source

SetCanExecute(Func<bool>)

Establece la función de comprobación a ejecutar cuando se desee saber si es posible ejecutar el comando.

Declaration
public ObservingCommand SetCanExecute(Func<bool> canExecute)
Parameters
Type Name Description
Func<bool> canExecute

Función a ejecutar para determinar la posibilidad de ejecutar el comando.

Returns
Type Description
ObservingCommand

Esta misma instancia, lo que permite usar esta función con sintaxis fluent.

| Edit this page View Source

SetCanExecute(Func<INotifyPropertyChanged, object?, bool>?)

Establece la función de comprobación a ejecutar cuando se desee saber si es posible ejecutar el comando.

Declaration
public ObservingCommand SetCanExecute(Func<INotifyPropertyChanged, object?, bool>? canExecute)
Parameters
Type Name Description
Func<INotifyPropertyChanged, object, bool> canExecute

Función a ejecutar para determinar la posibilidad de ejecutar el comando.

Returns
Type Description
ObservingCommand

Esta misma instancia, lo que permite usar esta función con sintaxis fluent.

| Edit this page View Source

SetCanExecute(Func<object?, bool>)

Establece la función de comprobación a ejecutar cuando se desee saber si es posible ejecutar el comando.

Declaration
public ObservingCommand SetCanExecute(Func<object?, bool> canExecute)
Parameters
Type Name Description
Func<object, bool> canExecute

Función a ejecutar para determinar la posibilidad de ejecutar el comando.

Returns
Type Description
ObservingCommand

Esta misma instancia, lo que permite usar esta función con sintaxis fluent.

| Edit this page View Source

UnsetCanExecute()

Desconecta la función establecida para comprobar la posibilidad de ejecutar este comando.

Declaration
public void UnsetCanExecute()

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>)
ObservingCommandExtensions.CanExecuteIfNotDefault(ObservingCommand, params Expression<Func<ValueType>>[])
ObservingCommandExtensions.CanExecuteIfNotDefault<T>(ObservingCommand, params Expression<Func<T, ValueType>>[])
ObservingCommandExtensions.CanExecuteIfNotNull(ObservingCommand, params Expression<Func<object?>>[])
ObservingCommandExtensions.CanExecuteIfNotNull<T>(ObservingCommand, params Expression<Func<T, object?>>[])
ObservingCommandExtensions.ListensToCanExecute(ObservingCommand, Expression<Func<bool>>)
ObservingCommandExtensions.ListensToCanExecute<T>(ObservingCommand, Expression<Func<T, bool>>)
ObservingCommandExtensions.ListensToProperties(ObservingCommand, params Expression<Func<object?>>[])
ObservingCommandExtensions.ListensToProperties<TProperty>(ObservingCommand, params Expression<Func<TProperty>>[])
ObservingCommandExtensions.ListensToProperties<T>(ObservingCommand, params Expression<Func<T, object?>>[])
ObservingCommandExtensions.ListensToProperties<T, TProperty>(ObservingCommand, params Expression<Func<T, TProperty>>[])
ObservingCommandExtensions.ListensToProperty(ObservingCommand, Expression<Func<object?>>)
ObservingCommandExtensions.ListensToProperty<T>(ObservingCommand, Expression<Func<T, object?>>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX