init
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/Realtime/RealtimeModule/Properties/Settings.Designer.cs
|
||||
- DataPRO/Modules/Realtime/RealtimeModule/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T04:47:59.846993+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "01c03123f29caf64"
|
||||
---
|
||||
|
||||
# Properties
|
||||
|
||||
## Documentation: `RealtimeModule.Properties.Settings`
|
||||
|
||||
### 1. Purpose
|
||||
This module provides strongly-typed, application-scoped settings access for the `RealtimeModule` assembly via the .NET `ApplicationSettingsBase` infrastructure. It exists solely to expose a centralized, auto-generated settings class (`Settings`) that enables runtime retrieval of configuration values defined in the project’s `.config` file (e.g., `app.config`). It does not implement business logic, data processing, or real-time functionality itself—the name `RealtimeModule` refers to the containing assembly, not the behavior of this specific file.
|
||||
|
||||
### 2. Public Interface
|
||||
The module exposes a single public type:
|
||||
|
||||
- **`RealtimeModule.Properties.Settings`**
|
||||
- **Type**: `internal sealed partial class` inheriting from `System.Configuration.ApplicationSettingsBase`
|
||||
- **Key Member**:
|
||||
- `public static Settings Default { get; }`
|
||||
- Returns the singleton instance of `Settings`, thread-safe via `ApplicationSettingsBase.Synchronized(...)`.
|
||||
- Used to access user/application settings defined in the project (e.g., `Settings.Default.SomeSettingName`).
|
||||
- **Note**: No custom properties are declared in this file. All settings properties (if any) are auto-generated in a corresponding `Settings.Designer.cs` *partial* class (not provided here), and their names/types depend on the project’s settings definitions.
|
||||
|
||||
### 3. Invariants
|
||||
- The `Default` property always returns a non-null, thread-safe singleton instance.
|
||||
- The class is `internal` and `sealed`, preventing external inheritance or modification.
|
||||
- The settings instance is synchronized (`Synchronized(...)`) to ensure thread-safe access—concurrent reads/writes to settings are serialized.
|
||||
- No validation or runtime logic is enforced by this class itself; validation (if any) occurs at the settings definition layer (outside this file’s scope).
|
||||
|
||||
### 4. Dependencies
|
||||
- **Depends on**:
|
||||
- `System.Configuration` (for `ApplicationSettingsBase`)
|
||||
- `System.Runtime.CompilerServices` (for `[CompilerGenerated]`)
|
||||
- `System.CodeDom.Compiler` (for `[GeneratedCode]`)
|
||||
- **Depended upon by**:
|
||||
- Other parts of `RealtimeModule` (and potentially other assemblies referencing it) that consume settings via `Settings.Default`.
|
||||
- The .NET configuration system (implicitly, via `app.config`/`web.config`).
|
||||
- **Notable**: The GUID `1c6569ca-bc4c-4612-a086-24ef24f1642c` identifies this assembly for COM interop (though `ComVisible` is `false`, so COM visibility is disabled).
|
||||
|
||||
### 5. Gotchas
|
||||
- **Auto-generated code**: This file is auto-generated by Visual Studio’s Settings Designer. Manual edits will be overwritten on rebuild.
|
||||
- **Settings not defined here**: The actual settings (e.g., `string ServerUrl`, `int TimeoutMs`) are *not* present in this file—they are defined in the project’s `.settings` designer file and auto-merged into this partial class. Their existence and types cannot be inferred from the provided source.
|
||||
- **Thread-safety nuance**: While `Synchronized(...)` ensures thread-safe *access*, settings values themselves are immutable once loaded (unless explicitly reloaded or overridden programmatically elsewhere).
|
||||
- **No runtime behavior**: This module does *not* implement real-time data handling—its sole purpose is settings access. Confusion may arise from the module name `RealtimeModule`.
|
||||
- **Versioning**: Assembly version is fixed at `1.0.0.0` (both `AssemblyVersion` and `FileVersion`), which may impact deployment or binding redirects.
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/Realtime/RealtimeModule/Resources/TranslateExtension.cs
|
||||
- DataPRO/Modules/Realtime/RealtimeModule/Resources/StringResources.Designer.cs
|
||||
generated_at: "2026-04-16T04:47:55.535596+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "036a24899acb6b7e"
|
||||
---
|
||||
|
||||
# Resources
|
||||
|
||||
## Documentation: `TranslateExtension` Class
|
||||
|
||||
### 1. Purpose
|
||||
The `TranslateExtension` class provides a XAML markup extension for localized string resolution within the RealtimeModule UI layer. It enables declarative binding of localized text in XAML (e.g., `{Translate SomeKey}`) by delegating string lookup to the `StringResources` strongly-typed resource class. This allows UI elements to support multi-language scenarios without hardcoding strings, and centralizes fallback behavior for missing translations.
|
||||
|
||||
### 2. Public Interface
|
||||
|
||||
#### `TranslateExtension` class
|
||||
- **Inherits**: `System.Windows.Markup.MarkupExtension`
|
||||
- **Namespace**: `RealtimeModule`
|
||||
- **Attributes**:
|
||||
- `[MarkupExtensionReturnType(typeof(string))]` — Indicates the extension returns a `string`.
|
||||
|
||||
##### Constructor
|
||||
- `TranslateExtension(string key)`
|
||||
- **Parameters**:
|
||||
- `key`: The resource key (e.g., `"AvailableChannels"`, `"Search"`) used to look up the localized string.
|
||||
- **Behavior**: Stores the key in a private readonly field `_key`. No validation is performed on the key itself (e.g., null/empty allowed at construction).
|
||||
|
||||
##### Override
|
||||
- `public override object ProvideValue(IServiceProvider serviceProvider)`
|
||||
- **Parameters**:
|
||||
- `serviceProvider`: XAML infrastructure service provider (unused in implementation).
|
||||
- **Returns**:
|
||||
- `string`: The localized string if found; otherwise, a fallback string.
|
||||
- **Behavior**:
|
||||
1. If `_key` is `null` or empty → returns `"#stringnotfound#"`.
|
||||
2. Otherwise, calls `StringResources.ResourceManager.GetString(_key)`.
|
||||
- If the result is non-null → returns the localized string.
|
||||
- If the result is `null` (key not found) → returns `"#stringnotfound# " + _key` (note: space appended after `#stringnotfound#`).
|
||||
|
||||
### 3. Invariants
|
||||
- **Key lookup behavior**:
|
||||
- The extension *always* returns a `string`.
|
||||
- A missing key (i.e., `ResourceManager.GetString(key) == null`) results in a deterministic fallback: `"#stringnotfound# " + _key`.
|
||||
- **Null/empty key handling**:
|
||||
- `_key == null` or `_key == ""` → returns `"#stringnotfound#"` (no key suffix).
|
||||
- **No side effects**:
|
||||
- `ProvideValue` is pure (no mutation of state, no I/O beyond resource lookup).
|
||||
- **Thread-safety assumption**:
|
||||
- Relies on `ResourceManager.GetString`, which is documented as thread-safe for read operations in .NET. No additional synchronization is implemented in `TranslateExtension`.
|
||||
|
||||
### 4. Dependencies
|
||||
- **Direct dependencies**:
|
||||
- `System.Windows.Markup` (for `MarkupExtension` and `MarkupExtensionReturnTypeAttribute`).
|
||||
- `RealtimeModule.Resources.StringResources` (strongly-typed resource class).
|
||||
- **Indirect dependencies**:
|
||||
- `System.Resources.ResourceManager` (via `StringResources.ResourceManager`).
|
||||
- `System.Globalization.CultureInfo` (used by `StringResources.Culture` property, though not directly accessed here).
|
||||
- **Consumers**:
|
||||
- XAML files in the RealtimeModule (e.g., `*.xaml` views) that use `{Translate ...}` syntax.
|
||||
- *No other C# code depends on this class* — it is exclusively for XAML usage.
|
||||
|
||||
### 5. Gotchas
|
||||
- **Fallback format is literal and unlocalized**:
|
||||
- The fallback string `"#stringnotfound# "` is hardcoded and includes a trailing space. This may cause visual artifacts (e.g., extra whitespace) in UI if keys are missing.
|
||||
- **No validation of key validity**:
|
||||
- Passing an invalid key (e.g., `"NonExistentKey"`) does not throw; it silently falls back to `"#stringnotfound# NonExistentKey"`. Developers may not immediately notice missing keys in development.
|
||||
- **Case sensitivity**:
|
||||
- Key lookup is case-sensitive (via `ResourceManager.GetString`). `"AvailableChannels"` works; `"availablechannels"` does not.
|
||||
- **Auto-generated resource class**:
|
||||
- `StringResources` is auto-generated from `.resx` files. Changes require regenerating the class (via `.resx` edits and rebuild). The extension will return `null`-equivalent fallback if keys are renamed/removed in the `.resx`.
|
||||
- **No culture override support**:
|
||||
- The extension does not expose or use `StringResources.Culture`. It relies on the current UI thread’s culture (standard WPF behavior).
|
||||
- **No caching of resolved values**:
|
||||
- Each `ProvideValue` call performs a fresh `ResourceManager.GetString` lookup. While `ResourceManager` caches internally, repeated use in dynamic UI (e.g., data templates) may have minor overhead.
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/Realtime/RealtimeModule/View/RealtimeChannelSelectView.xaml.cs
|
||||
generated_at: "2026-04-16T04:48:08.293076+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "6ca4c92ee0b7d299"
|
||||
---
|
||||
|
||||
# View
|
||||
|
||||
## Documentation: `RealtimeChannelSelectView`
|
||||
|
||||
### 1. Purpose
|
||||
`RealtimeChannelSelectView` is a WPF UI view responsible for rendering and managing user interaction with a channel selection control in the Realtime module. It implements the `IRealtimeChannelSelectView` interface and coordinates with its associated view model (`IRealtimeChannelSelectViewModel`) to handle search input and channel selection. Its role is to translate user actions (text input and selection changes in a `ComboBox`) into corresponding view model operations, enabling users to search for and select a real-time data channel.
|
||||
|
||||
### 2. Public Interface
|
||||
The class itself is not a public API in the traditional sense (it is `partial` and tied to XAML), but it implements the `IRealtimeChannelSelectView` interface (from `DTS.Common.Interface.Realtime`). Since the interface definition is not provided in the source, only the *publicly exposed behavior* (via event handlers) is documented:
|
||||
|
||||
- **`RealtimeChannelSelectView()`**
|
||||
Constructor. Initializes the component by calling `InitializeComponent()` to wire up XAML-defined elements.
|
||||
|
||||
- **`private void Search_TextChanged(object sender, TextChangedEventArgs e)`**
|
||||
Event handler for `TextBox.TextChanged` (or equivalent `ComboBox.Text` change). Updates the view model’s search text via `vm.SetSearchText(cb.Text)`, ensures the dropdown remains open (`cb.IsDropDownOpen = true`), and does not modify selection state directly.
|
||||
|
||||
- **`private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)`**
|
||||
Event handler for `ComboBox.SelectionChanged`. When an item is selected:
|
||||
- Casts the selected item to `IRealtimeChannel`.
|
||||
- Informs the view model via `vm.SetRealtimeChannel(channel)`.
|
||||
- Clears the selection (`cb.SelectedItem = null`), resets the search text (`vm.SetSearchText("")`), and closes the dropdown (`cb.IsDropDownOpen = false`).
|
||||
|
||||
> ⚠️ Note: No other public methods or properties are defined in this file. All logic resides in private event handlers.
|
||||
|
||||
### 3. Invariants
|
||||
- The `DataContext` of the `ComboBox` must always be an instance implementing `IRealtimeChannelSelectViewModel`.
|
||||
- The selected item in the `ComboBox` must be an instance of `IRealtimeChannel`.
|
||||
- After a channel is selected, the view model is guaranteed to receive:
|
||||
1. `SetRealtimeChannel(channel)`
|
||||
2. `SetSearchText("")`
|
||||
- The `ComboBox` dropdown is explicitly kept open during text input (`Search_TextChanged`) and closed after selection (`ComboBox_SelectionChanged`).
|
||||
- Selection is cleared (`SelectedItem = null`) after handling to prevent re-triggering on the same item.
|
||||
|
||||
### 4. Dependencies
|
||||
- **External Interfaces**:
|
||||
- `DTS.Common.Interface.Realtime.IRealtimeChannel` — Represents a real-time channel.
|
||||
- `DTS.Common.Interface.Realtime.IRealtimeChannelSelectView` — The interface this class implements (inferred from `inheritdoc`).
|
||||
- `DTS.Common.Interface.Realtime.IRealtimeChannelSelectViewModel` — The expected type of `DataContext`.
|
||||
- **WPF Framework**:
|
||||
- `System.Windows.Controls.ComboBox`, `System.Windows.Controls.TextChangedEventArgs`, `System.Windows.Controls.SelectionChangedEventArgs`.
|
||||
- **Inferred Usage**:
|
||||
- This view is consumed by XAML (likely `RealtimeChannelSelectView.xaml`) and bound to a view model implementing `IRealtimeChannelSelectViewModel`.
|
||||
- The view model likely depends on other parts of the Realtime module (e.g., channel discovery, data subscription logic), but those are not visible here.
|
||||
|
||||
### 5. Gotchas
|
||||
- **Selection clearing side effect**: `cb.SelectedItem = null` is set *after* calling `vm.SetRealtimeChannel(channel)`, which may be necessary to avoid re-selection loops, but could cause issues if the view model expects the selection to persist during its processing.
|
||||
- **Search text reset**: `vm.SetSearchText("")` is called *after* channel selection, not during text input. This means the search text is cleared only upon selection, not on every keystroke.
|
||||
- **Commented-out state flag**: A `volatile bool _bHandleSelection` field is commented out, suggesting a past attempt to prevent re-entrancy or double-handling of selection events. Its absence may indicate unresolved reentrancy risks or legacy tech debt.
|
||||
- **No null-safety for `cb.SelectedItem` beyond `null` check**: The handler assumes `cb.SelectedItem` is castable to `IRealtimeChannel` if non-null; no validation is performed.
|
||||
- **Assumes `cb.DataContext` is always `IRealtimeChannelSelectViewModel`**: No null-check on `vm` is performed before calling methods on it, risking `NullReferenceException` if binding is misconfigured.
|
||||
- **No explicit handling of deselection**: If `SelectedItem` becomes `null` via external means (e.g., programmatic reset), the handler does nothing — this may be intentional, but is not documented.
|
||||
|
||||
None identified beyond the above.
|
||||
@@ -0,0 +1,110 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/Realtime/RealtimeModule/ViewModel/RealtimeChannelSelectViewModel.cs
|
||||
generated_at: "2026-04-16T04:47:50.422558+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "3c94987e004e61ba"
|
||||
---
|
||||
|
||||
# ViewModel
|
||||
|
||||
## Documentation: `RealtimeChannelSelectViewModel`
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
`RealtimeChannelSelectViewModel` is a Prism-based ViewModel responsible for managing the UI state and logic of the Realtime Channel Selection view. It exposes a list of available real-time channels, supports filtering them by user-provided search text, and publishes selection events when a channel is chosen. It integrates with the application’s event system via `IEventAggregator` to coordinate with other modules (e.g., signaling busy state, displaying notifications, and publishing channel selections). It does not implement complex business logic itself but serves as a thin presentation layer adapter between the view and the underlying event-driven architecture.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
- **`IRealtimeChannelSelectView ChannelSelectView { get; set; }`**
|
||||
Reference to the associated view (`IRealtimeChannelSelectView`). Set during construction and used to bind `DataContext`.
|
||||
|
||||
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
|
||||
Prism `InteractionRequest` used to trigger notification popups (e.g., alerts, messages). Raised via `OnRaiseNotification`.
|
||||
|
||||
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
|
||||
Prism `InteractionRequest` for confirmation dialogs (currently unused in the provided code).
|
||||
|
||||
- **`event PropertyChangedEventHandler PropertyChanged`**
|
||||
Standard `INotifyPropertyChanged` implementation. Used to notify UI of property changes.
|
||||
|
||||
- **`void OnPropertyChanged(string propertyName)`**
|
||||
Helper to raise `PropertyChanged` event for a given property.
|
||||
|
||||
- **`void SetAvailableChannels(IRealtimeChannel[] channels)`**
|
||||
Sets the full, unfiltered list of channels. Triggers filtering and updates `RealtimeChannels`.
|
||||
|
||||
- **`void SetSearchText(string searchText)`**
|
||||
Updates the internal search term and re-applies filtering. Channels whose `ToString()` representation contains the search term (case-insensitive, culture-sensitive) are included.
|
||||
|
||||
- **`void SetRealtimeChannel(IRealtimeChannel channel)`**
|
||||
Publishes the selected channel via the `RealtimeChannelSelectedEvent` event.
|
||||
|
||||
- **`void Unset()`, `void Cleanup()`, `Task CleanupAsync()`, `void Initialize()`, `void Initialize(object)`, `void Initialize(object, object)`, `Task InitializeAsync()`, `Task InitializeAsync(object)`, `void Activated()`**
|
||||
Lifecycle stubs required by Prism’s `INavigationAware`, `IInitializeAsync`, etc. interfaces. All are currently empty and have no effect.
|
||||
|
||||
- **`bool IsBusy { get; set; }`**
|
||||
Bindable property indicating whether the UI should show a busy indicator. Set via subscription to `BusyIndicatorChangeNotification`.
|
||||
|
||||
- **`bool IsMenuIncluded { get; set; }`**
|
||||
Bindable property indicating whether the menu UI section should be visible.
|
||||
|
||||
- **`bool IsNavigationIncluded { get; set; }`**
|
||||
Bindable property indicating whether the navigation UI section should be visible.
|
||||
|
||||
- **`IRealtimeChannel[] RealtimeChannels { get; set; }`**
|
||||
Bindable array of filtered channels to display in the view. Initialized to an empty array.
|
||||
|
||||
- **`bool IsDirty => false`**
|
||||
Always returns `false`. Indicates no unsaved changes (not implemented).
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- `RealtimeChannels` always reflects the current filtered view of `_allChannels` after `SetAvailableChannels` or `SetSearchText` is called.
|
||||
- `_searchTerm` is used case-insensitively (via `CultureInfo.CurrentCulture.CompareInfo`) to filter channels by their `ToString()` representation.
|
||||
- `IsBusy` is updated synchronously on the publisher thread (due to `ThreadOption.PublisherThread` in subscription).
|
||||
- `_allChannels` is never `null` after `SetAvailableChannels` is called (though it may be an empty array).
|
||||
- `RealtimeChannelSelectedEvent` is published *only* when `SetRealtimeChannel` is invoked.
|
||||
- `NotificationRequest` is always raised with a `Notification` object containing a `NotificationContentEventArgs` (with empty `Footer` and `FooterCommand` fields) and the original title.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
**Imports / Dependencies (from source):**
|
||||
- `DTS.Common.Events`, `DTS.Common.Events.Realtime`, `DTS.Common.Interactivity`, `DTS.Common.Interface.Realtime`
|
||||
→ Defines core event types (`RaiseNotification`, `BusyIndicatorChangeNotification`, `RealtimeChannelSelectedEvent`) and interfaces (`IRealtimeChannel`, `IRealtimeChannelSelectView`, `IRealtimeChannelSelectViewModel`).
|
||||
- `Prism.Events`, `Prism.Regions`, `Unity`
|
||||
→ Prism framework for event aggregation, region management, and Unity DI container.
|
||||
- `System.ComponentModel`, `System.Linq`, `System.Threading.Tasks`
|
||||
→ Standard .NET types for INPC, LINQ, async.
|
||||
|
||||
**Consumers (inferred):**
|
||||
- Any module/component that needs to display notifications via `RaiseNotification` or control busy state via `BusyIndicatorChangeNotification`.
|
||||
- Any module that needs to respond to channel selection via `RealtimeChannelSelectedEvent`.
|
||||
- The view (`IRealtimeChannelSelectView`) binds to `RealtimeChannels`, `IsBusy`, `IsMenuIncluded`, `IsNavigationIncluded`, and commands (none defined here).
|
||||
|
||||
**Dependencies on this module:**
|
||||
- The view (`IRealtimeChannelSelectView`) depends on this ViewModel for data binding.
|
||||
- Other modules subscribe to `RealtimeChannelSelectedEvent` to react to user selections.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **`ToString()`-based filtering**: Filtering relies on `channel.ToString()`, which may be implementation-specific (e.g., default type name or overridden). Ensure `IRealtimeChannel` implementations provide meaningful `ToString()` output for search to work as intended.
|
||||
- **Empty lifecycle methods**: All Prism lifecycle methods (`Initialize`, `Cleanup`, etc.) are no-ops. If initialization/cleanup logic is needed, it must be added.
|
||||
- **`IsDirty` always `false`**: The `IsDirty` property is hardcoded to `false`. If dirty-state tracking is required, it is not implemented here.
|
||||
- **Culture-specific search**: Search uses `CultureInfo.CurrentCulture`. Behavior may vary across locales (e.g., Turkish i problem). Consider `CultureInfo.InvariantCulture` if consistent behavior across locales is required.
|
||||
- **Thread safety**: `_allChannels` and `_searchTerm` are not thread-safe. `Filter()` is called synchronously from `SetAvailableChannels`/`SetSearchText`, but if those are invoked from non-UI threads, race conditions may occur (though unlikely given Prism conventions).
|
||||
- **Unused `ConfirmationRequest`**: The `ConfirmationRequest` is declared but never used—potential tech debt or placeholder.
|
||||
- **No command bindings**: The `#region Commands` section is empty. UI interaction (e.g., channel selection) likely occurs via direct method calls from the view (e.g., `SetRealtimeChannel`), not Prism `ICommand` bindings.
|
||||
|
||||
None identified beyond the above.
|
||||
Reference in New Issue
Block a user