Files
DP44/docs/ai/Common/DTS.Common/Interactivity.md
2026-04-17 14:55:32 -04:00

66 lines
2.6 KiB
Markdown

---
source_files:
- Common/DTS.Common/Interactivity/IConfirmation.cs
- Common/DTS.Common/Interactivity/IInteractionRequest.cs
- Common/DTS.Common/Interactivity/Notification.cs
- Common/DTS.Common/Interactivity/Confirmation.cs
- Common/DTS.Common/Interactivity/INotification.cs
- Common/DTS.Common/Interactivity/IInteractionRequestAware.cs
- Common/DTS.Common/Interactivity/InteractionRequestTrigger.cs
- Common/DTS.Common/Interactivity/InteractionRequestedEventArgs.cs
- Common/DTS.Common/Interactivity/InteractionRequest.cs
generated_at: "2026-04-17T16:34:18.351118+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "265c037d82ad3991"
---
# DTS.Common.Interactivity Documentation
## 1. Purpose
This module implements an MVVM-friendly interactivity pattern for WPF applications, enabling ViewModels to request user interactions (such as notifications and confirmations) without creating direct dependencies on UI components. It provides a decoupled event-driven mechanism where ViewModels raise interaction requests via `InteractionRequest<T>`, which are handled by the View through triggers and behaviors. This pattern is commonly used in frameworks like Prism to maintain separation of concerns between presentation logic and UI implementation.
---
## 2. Public Interface
### Interfaces
**`INotification`**
- `string Title { get; set; }` — Gets or sets the title for the notification.
- `object Content { get; set; }` — Gets or sets the content of the notification.
**`IConfirmation : INotification`**
- `bool Confirmed { get; set; }` — Gets or sets a value indicating whether the confirmation was accepted.
**`IInteractionRequest`**
- `event EventHandler<InteractionRequestedEventArgs> Raised` — Event fired when an interaction is requested.
**`IInteractionRequestAware`**
- `INotification Notification { get; set; }` — The notification passed when the interaction request was raised.
- `Action FinishInteraction { get; set; }` — An action that can be invoked to finish the interaction.
---
### Classes
**`Notification : INotification`**
Concrete implementation of `INotification` providing `Title` and `Content` properties.
---
**`Confirmation : Notification, IConfirmation`**
Extends `Notification` and implements `IConfirmation`. Adds:
- `bool Confirmed { get; set; }` — Gets or sets a value indicating that the confirmation is confirmed.
---
**`InteractionRequest<T> : IInteractionRequest` where `T : INotification`**
Generic class for raising interaction requests.
- `event EventHandler<InteractionRequestedEventArgs> Raised` — Fired when interaction is needed.
- `void Raise(T context)`