init
This commit is contained in:
37
docs/ai/Common/DTS.Common/Classes/DTS.Viewer/Commands.md
Normal file
37
docs/ai/Common/DTS.Common/Classes/DTS.Viewer/Commands.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Classes/DTS.Viewer/Commands/RelayCommand.cs
|
||||
generated_at: "2026-04-17T16:40:01.838480+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "24962272b11a45e1"
|
||||
---
|
||||
|
||||
# Commands
|
||||
|
||||
## Documentation: `DTS.Common.Classes.Viewer.Commands.RelayCommand`
|
||||
|
||||
### 1. Purpose
|
||||
This module provides an implementation of the `System.Windows.Input.ICommand` interface designed to delegate logic to methods passed as parameters. It exists to support the MVVM (Model-View-ViewModel) pattern within the DTS Viewer application, allowing UI controls (like buttons) to bind to actions defined in ViewModels without requiring the creation of separate concrete command classes for every action.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
**Constructors**
|
||||
|
||||
* `public RelayCommand(Action<object> execute)`
|
||||
* Initializes a new instance of the `RelayCommand` class that can always execute.
|
||||
* **Parameter:** `execute` — The execution logic delegate.
|
||||
* **Behavior:** Calls the overloaded constructor with `null` for the `canExecute` predicate.
|
||||
|
||||
* `public RelayCommand(Action<object> execute, Predicate<object> canExecute)`
|
||||
* Initializes a new instance of the `RelayCommand` class.
|
||||
* **Parameters:**
|
||||
* `execute` — The execution logic delegate.
|
||||
* `canExecute` — The execution status logic delegate (optional).
|
||||
* **Behavior:** Throws an `ArgumentNullException` named "execute" if the `execute` delegate is null. Assigns delegates to internal readonly fields.
|
||||
|
||||
**Methods**
|
||||
|
||||
* `public bool CanExecute(object parameter)`
|
||||
* Determines if the command can execute in its current state.
|
||||
* **Behavior:** Returns `true` if `_canExecute` is `null`. Otherwise, returns the result of invoking `_canExecute(parameter)`
|
||||
Reference in New Issue
Block a user