This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
---
source_files:
- DataPRO/Modules/Groups/GroupImport/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:47:44.902525+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "60b8a2e7063ea2af"
---
# Documentation: GroupImportModule Assembly Configuration
## 1. Purpose
This source file, `AssemblyInfo.cs`, serves as the assembly manifest configuration for the `GroupImportModule` component within the DataPRO system. Its

View File

@@ -0,0 +1,68 @@
---
source_files:
- DataPRO/Modules/Groups/GroupImport/Resources/TranslateExtension.cs
- DataPRO/Modules/Groups/GroupImport/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T15:58:05.941398+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "649541a3a7393158"
---
# Documentation: GroupImport Resources Module
## 1. Purpose
This module provides localization infrastructure for the Group Import feature in DataPRO. It consists of a WPF markup extension (`TranslateExtension`) enabling XAML-based string resource lookup, and an auto-generated strongly-typed resource class (`StringResources`) containing localized strings for TDAS group file import operations, validation messages, preview UI labels, and error/warning text. The module supports the import workflow from file selection through validation to completion.
---
## 2. Public Interface
### `TranslateExtension` (Class)
**Namespace:** `DBImportExport.Resources`
**Attribute:** `[MarkupExtensionReturnType(typeof(string))]`
A WPF markup extension for retrieving localized strings in XAML bindings.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `TranslateExtension(string key)` | Initializes the extension with the resource key to look up. |
| `ProvideValue` | `override object ProvideValue(IServiceProvider serviceProvider)` | Returns the localized string for `_key`, or a fallback indicator if not found. |
| `NotFound` | `const string = "#stringnotfound#"` | Constant returned when the key is null, empty, or the resource is missing. |
**Behavior of `ProvideValue`:**
- Returns `NotFound` if `_key` is null or empty.
- Returns `StringResources.ResourceManager.GetString(_key)` if the key exists.
- Returns `NotFound + " " + _key` if the key is not found in the resource manifest.
---
### `StringResources` (Class)
**Namespace:** `GroupImport.Resources`
**Modifiers:** `internal`, `sealed` (implied by auto-generation)
A strongly-typed resource class auto-generated by `StronglyTypedResourceBuilder`. Provides access to localized strings via static properties.
| Member | Type | Description |
|--------|------|-------------|
| `ResourceManager` | `static ResourceManager` | Returns the cached `ResourceManager` instance for this assembly. Lazy-initialized. |
| `Culture` | `static CultureInfo` | Gets/sets the current UI culture for resource lookups. |
**Resource String Properties (static, read-only):**
| Property | Default Value (from comments) | Context |
|----------|-------------------------------|---------|
| `GroupTags` | "Group Tag(s): " | Label for group tags display |
| `Import_Importing` | "Importing {0}:{1}" | Import progress message (format string) |
| `ImportFileFilter` | "TDAS group file (*.grp)\|*.grp\|All Files (*.*)\|*.*" | File dialog filter |
| `Importing_Done` | "Done" | Import completion status |
| `None` | "(None)" | Null/empty placeholder |
| `Options_Browse` | "Browse" | Browse button label |
| `Options_Files` | "File(s)" | Files label |
| `Options_Format` | "Format" | Format label |
| `Preview_CompleteGroupChannels` | "Channels that will be imported" | Preview section header |
| `Preview_EmptyFile` | "Empty file" | Empty file warning |
| `Preview_Groups` | "Groups" | Groups label |
| `Preview_IncompleteGroupChannels` | "Channels that will not be imported" | Preview section header |
| `Preview_InvalidFullScaleCapacity` | "Invalid full scale capacity" | Validation error |
| `Preview_InvalidFullScaleInput` | "Invalid desired range for {0}::{1}, the sensor capacity will be used instead." | Validation warning (format string)

View File

@@ -0,0 +1,54 @@
---
source_files:
- DataPRO/Modules/Groups/GroupImport/View/GroupImportImportView.xaml.cs
- DataPRO/Modules/Groups/GroupImport/View/GroupImportOptionsView.xaml.cs
- DataPRO/Modules/Groups/GroupImport/View/GroupImportPreviewView.xaml.cs
generated_at: "2026-04-17T15:55:09.583371+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "6791e57197b8d508"
---
# Documentation: GroupImport Views
## 1. Purpose
This module provides the WPF view components for a Group Import wizard workflow. It contains three views—`GroupImportImportView`, `GroupImportOptionsView`, and `GroupImportPreviewView`—that implement interfaces from `DTS.Common.Interface.Groups` and handle user interaction for importing groups from files. The views serve as the UI layer, delegating business logic to `GroupImportViewModel` and validating user input before allowing progression through the wizard steps.
---
## 2. Public Interface
### GroupImportImportView
**Signature:** `public partial class GroupImportImportView : IGroupImportImportView`
| Member | Description |
|--------|-------------|
| `GroupImportImportView()` | Constructor. Calls `InitializeComponent()` to load the XAML-defined UI. |
---
### GroupImportOptionsView
**Signature:** `public partial class GroupImportOptionsView : IGroupImportOptionsView`
| Member | Description |
|--------|-------------|
| `GroupImportOptionsView()` | Constructor. Calls `InitializeComponent()` to load the XAML-defined UI. |
| `bool Validate(out List<string> errors, out List<string> warnings)` | Validates whether the user can proceed to the preview step. Returns `true` if at least one file is selected (`vm.SourceFiles.Length >= 1`); otherwise, adds `StringResources.Preview_NoFilesSelected` to errors and returns `false`. |
---
### GroupImportPreviewView
**Signature:** `public partial class GroupImportPreviewView : IGroupImportPreviewView`
| Member | Description |
|--------|-------------|
| `GroupImportPreviewView()` | Constructor. Calls `InitializeComponent()` to load the XAML-defined UI. |
| `void GroupName_Changed(object sender, TextChangedEventArgs e)` | Private event handler. Updates `group.GroupName` from the TextBox, calls `ch.GroupNameInvalidate()` on all channels, and invokes `vm.CheckGroupName()`. |
| `void GroupTags_Changed(object sender, TextChangedEventArgs e)` | Private event handler. Updates `group.GroupTags` from the TextBox. |
| `void IncludedChecked(object sender, RoutedEventArgs e)` | Private event handler. Calls `vm.InvalidateChannels()` when a group's included checkbox is checked. |
| `void IncludedUnchecked(object sender, RoutedEventArgs e)` | Private event handler. Calls `vm.InvalidateChannels()` when a group's included checkbox is unchecked. |
| `bool Validate(bool userIsAdmin, out List<string> errors, out List<string> warnings)` | Public validation method. Checks group and channel validity for import. Returns `true` if valid to proceed. See detailed behavior below

View File

@@ -0,0 +1,98 @@
---
source_files:
- DataPRO/Modules/Groups/GroupImport/ViewModel/GroupImportViewModel.cs
generated_at: "2026-04-17T16:01:00.422137+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ea98f9d39127a201"
---
# GroupImportViewModel Documentation
## 1. Purpose
`GroupImportViewModel` is the ViewModel responsible for importing Groups and TestObjects from `.grp` files in a WPF/Prism-based application. It orchestrates the complete import workflow: file browsing, parsing source files into group/channel structures, validating data, previewing import contents, and executing the import on a background thread. The class implements `IGroupImportViewModel` and serves as the data context for three views (`IGroupImportOptionsView`, `IGroupImportPreviewView`, `IGroupImportImportView`).
---
## 2. Public Interface
### Constructor
```csharp
public GroupImportViewModel(
IGroupImportOptionsView optionsView,
IGroupImportPreviewView previewView,
IGroupImportImportView importView,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
Initializes the ViewModel, wires up view DataContexts, creates interaction requests, and subscribes to `RaiseNotification` and `BusyIndicatorChangeNotification` events.
### Public Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `ParseSourceFiles` | `void ParseSourceFiles(string userTags)` | Reads `.grp` files from `SourceFiles`, parsing groups and channels. Populates `Groups` and `Channels` arrays. |
| `Import` | `void Import()` | Queues the import operation on a background thread via `ThreadPool.QueueUserWorkItem`. |
| `SetStatus` | `void SetStatus(string message, Color color)` | Updates `ImportProgressColor`, hides progress bar, sets `ImportProgressText`, and invokes `EnableUI`. |
| `Reset` | `void Reset()` | Re-initializes the ViewModel to default state (clears `SourceFiles`, `Channels`, `Groups`, resets progress UI). |
| `CheckGroupName` | `void CheckGroupName()` | Validates group names for duplicates within the import and against existing groups (if `Overwrite` is false). Sets `GroupNameHasError` on each group. |
| `OnPropertyChanged` | `void OnPropertyChanged(string propertyName)` | Raises the `PropertyChanged` event. |
| `InvalidateChannels` | `void InvalidateChannels()` | Raises PropertyChanged for `IncompleteChannels` and `CompleteChannels`. |
| `Cleanup` | `void Cleanup()` | Empty implementation. |
| `CleanupAsync` | `Task CleanupAsync()` | Returns `Task.CompletedTask`. |
| `Initialize` | `void Initialize()` / `void Initialize(object parameter)` / `void Initialize(object parameter, object model)` | Empty implementations. |
| `InitializeAsync` | `Task InitializeAsync()` / `Task InitializeAsync(object parameter)` | Return `Task.CompletedTask`. |
| `Activated` | `void Activated()` | Empty implementation. |
### Commands
| Property | Type | Description |
|----------|------|-------------|
| `ImportBrowseCommand` | `DelegateCommand` | Opens an `OpenFileDialog` for selecting `.grp` files. Sets `SourceFiles` and `BrowseOk`, then invokes `SwitchNavSteps` with `Preview` step. |
### Public Properties
| Property | Type | Description |
|----------|------|-------------|
| `ImportOptionsView` | `IGroupImportOptionsView` | The options view instance. |
| `ImportPreviewView` | `IGroupImportPreviewView` | The preview view instance. |
| `ImportView` | `IGroupImportImportView` | The import view instance. |
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for notifications. |
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for confirmations. |
| `IsDirty` | `bool` | Always returns `false` (private setter never called). |
| `IsBusy` | `bool` | Bound to `BusyIndicatorChangeNotification` event. |
| `IsMenuIncluded` | `bool` | Menu inclusion flag. |
| `IsNavigationIncluded` | `bool` | Navigation inclusion flag. |
| `HeaderInfo` | `string` | Returns `"MainRegion"`. |
| `ImportProgressText` | `string` | Status text for import progress bar. |
| `ImportProgressColor` | `Color` | Color of the import progress bar. |
| `ImportProgressBarVisibility` | `Visibility` | Controls progress bar visibility. |
| `ImportProgressValue` | `double` | Percentage complete of import process. |
| `SourceFiles` | `string[]` | Array of `.grp` file paths to parse. Initialized to empty array. |
| `BrowseOk` | `bool` | Indicates if file browse completed successfully. Default `false`. |
| `Groups` | `GroupGRPImportGroup[]` | All parsed groups. Initialized to empty array. |
| `Channels` | `GroupGRPImportChannel[]` | All channels from all groups. Setter calls `InvalidateChannels()`. |
| `IncompleteChannels` | `GroupGRPImportChannel[]` | Computed: channels that will NOT be imported (errors other than `InvalidFullScaleInput` or `InvalidInvertInput`). |
| `CompleteChannels` | `GroupGRPImportChannel[]` | Computed: channels that WILL be imported (no error, or only `InvalidFullScaleInput`/`InvalidInvertInput`). |
| `Logger` | `FileUtils.LogDelegate` | Logging facility. If `null`, no logging occurs. |
| `SwitchNavSteps` | `SwitchNavStepsDelegate` | Command for switching navigation steps. |
| `CheckGroupExists` | `CheckGroupExistsDelegate` | Command to check if a group exists in the application. |
| `CheckSensorExists` | `CheckSensorExistsDelegate` | Command to check if a sensor exists. |
| `CreateGroup` | `CreateGroupDelegate` | Command to create a group. |
| `AddChannel` | `AddChannelToGroupDelegate` | Command to add a channel to a group. |
| `CommitGroups` | `CommitGroupsDelegate` | Command to commit groups to the database. |
| `DisableUI` | `Disable_UIDelegate` | Command to disable the UI during import. |
| `EnableUI` | `Enable_UIDelegate` | Command to enable the UI after import. |
### Events
```csharp
public event PropertyChangedEventHandler PropertyChanged;
```
---
## 3. Invariants
- **File Format**: `.grp` files