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,39 @@
---
source_files:
- DataPRO/Modules/SystemSettings/DBImportExport/Properties/AssemblyInfo.cs
generated_at: "2026-04-16T04:40:44.467977+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "54976f3797d51132"
---
# Properties
## 1. Purpose
This module, named `DBImportExportModule`, is an assembly intended to support database import and export functionality within the `DataPRO` system. Based solely on the assembly metadata, it serves as a dedicated component for handling data migration, backup, or synchronization operations involving database content. Its placement under `DataPRO/Modules/SystemSettings/DBImportExport` suggests it is part of a modular architecture where system configuration capabilities—including database operations—are encapsulated separately. However, the provided source file contains only assembly-level metadata (e.g., version, GUID, visibility settings) and no implementation logic; thus, the actual import/export behavior resides in other modules or files not included here.
## 2. Public Interface
**No public types, functions, classes, or methods are defined in this file.**
The file `AssemblyInfo.cs` contains only assembly-level attributes (e.g., `AssemblyTitle`, `AssemblyVersion`) and does not declare any executable code, interfaces, or types. Therefore, there is no public API surface exposed *by this file*.
## 3. Invariants
- The assembly identity is fixed:
- `AssemblyTitle` = `"DBImportExportModule"`
- `AssemblyVersion` = `"1.0.0.0"`
- `AssemblyFileVersion` = `"1.0.0.0"`
- `Guid` = `"bc9afa01-e327-4133-8818-141281f9b3a0"`
- `ComVisible` is set to `false`, meaning types in this assembly are not exposed to COM by default.
- No runtime invariants or behavioral constraints can be inferred, as no logic is present.
## 4. Dependencies
- **Dependencies of this module**:
- `System.Reflection`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices` (standard .NET namespaces used for assembly metadata).
- **Dependents**:
- Not determinable from this file alone. The assembly is likely referenced by other modules in the `DataPRO` system (e.g., a UI or orchestration layer that triggers import/export workflows), but no direct references are visible here.
## 5. Gotchas
- **Misleading module name**: The assembly name (`DBImportExportModule`) suggests functionality, but this file contains *no implementation*—only metadata. Developers may incorrectly assume this file contains core logic.
- **Versioning**: Both `AssemblyVersion` and `AssemblyFileVersion` are hardcoded to `1.0.0.0`. This may indicate incomplete versioning strategy or that versioning is managed externally (e.g., via CI/CD).
- **COM visibility**: `ComVisible(false)` is appropriate for modern .NET code but could cause issues if legacy COM interop is required (though no evidence of such a requirement exists here).
- **No documentation comments**: The file lacks XML documentation, which is standard for `AssemblyInfo.cs` but worth noting for consistency with other modules.
- **None identified from source alone.**

View File

@@ -0,0 +1,76 @@
---
source_files:
- DataPRO/Modules/SystemSettings/DBImportExport/Resources/TranslateExtension.cs
- DataPRO/Modules/SystemSettings/DBImportExport/Resources/StringResources.Designer.cs
generated_at: "2026-04-16T04:40:36.604143+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "4daa568e9b05fe61"
---
# Resources
## Documentation: `TranslateExtension` Markup Extension
---
### 1. Purpose
This module provides a WPF `MarkupExtension` (`TranslateExtension`) to support localization of UI strings in XAML. It enables declarative binding of localized text resources (from `StringResources`) directly in XAML markup, using a string key. The extension acts as a bridge between the strongly-typed `StringResources` class and XAML, returning localized strings at runtime or a fallback marker when a key is missing or invalid.
---
### 2. Public Interface
#### `TranslateExtension` class
**Namespace:** `DBImportExport.Resources`
**Inherits:** `MarkupExtension`
- **Constructor**
```csharp
public TranslateExtension(string key)
```
Initializes a new instance with the specified resource key. The key is stored in the private readonly field `_key`.
- **`ProvideValue` method**
```csharp
public override object ProvideValue(IServiceProvider serviceProvider)
```
Returns the localized string corresponding to `_key`, or a fallback value if the key is null/empty or the string is not found.
- If `_key` is `null` or empty → returns `"#stringnotfound#"`.
- If `StringResources.ResourceManager.GetString(_key)` returns `null` → returns `"#stringnotfound# " + _key`.
- Otherwise → returns the localized string.
---
### 3. Invariants
- `_key` is immutable after construction (declared `readonly`).
- The extension **always** returns a `string` (per `[MarkupExtensionReturnType(typeof(string))]`).
- If a resource key is missing or invalid, the return value is guaranteed to begin with `"#stringnotfound#"` — no exceptions are thrown.
- The `StringResources.ResourceManager.GetString(...)` call is assumed to be thread-safe (standard for `ResourceManager`), but no explicit synchronization is present in `TranslateExtension`.
---
### 4. Dependencies
#### **Dependencies *of* this module:**
- `System.Windows.Markup` — for `MarkupExtension` base class and `MarkupExtensionReturnTypeAttribute`.
- `DBImportExport.Resources.StringResources` — specifically its `ResourceManager` property and generated strongly-typed accessors (e.g., `ExportFileBrowse_Filter`, `ImportView_Browse`, etc.).
#### **Dependencies *on* this module:**
- XAML files in the `DBImportExport` module (e.g., views for Import/Export) likely use `{local:Translate KeyName}` syntax to bind localized strings to UI elements (e.g., `TextBlock.Text`, `Button.Content`).
*(Inferred from the presence of `StringResources.Designer.cs` and usage of `TranslateExtension` in a `Resources` folder.)*
---
### 5. Gotchas
- **No null-safety for `serviceProvider`**: The `ProvideValue` method does not validate `serviceProvider` — though WPF typically provides it, misuse outside WPF may cause issues.
- **Hardcoded fallback**: The `"#stringnotfound#"` prefix is hardcoded and not configurable. This may cause visual artifacts if not handled in UI design.
- **No caching of lookups**: Each call to `ProvideValue` performs a fresh `ResourceManager.GetString(...)` lookup. While `ResourceManager` caches internally, repeated use in dynamic UIs (e.g., data templates) may incur minor overhead.
- **No culture switching support**: The extension uses the current UI culture implicitly via `StringResources.Culture`, but does not expose a way to override it per extension instance.
- **Auto-generated resource class**: `StringResources.Designer.cs` is auto-generated — manual edits will be lost. Resource keys must match exactly (case-sensitive) with entries in the `.resx` file.
- **No compile-time key validation**: Passing an incorrect key (e.g., `"ExportView_Browsse"`) will silently fall back to `"#stringnotfound# ExportView_Browsse"` at runtime.
> **None identified from source alone.** *(Note: The above are inferred based on common WPF localization patterns and the provided code structure.)*

View File

@@ -0,0 +1,55 @@
---
source_files:
- DataPRO/Modules/SystemSettings/DBImportExport/View/DBExportView.xaml.cs
- DataPRO/Modules/SystemSettings/DBImportExport/View/DBImportView.xaml.cs
generated_at: "2026-04-16T04:40:54.625854+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "0b4a108878d82619"
---
# View
## Documentation: DBImportExport View Layer
### 1. Purpose
This module provides the WPF view layer for database import and export functionality within the SystemSettings module. It exposes two XAML-backed UI components—`DBExportView` and `DBImportView`—that implement the `IDBExportView` and `IDBImportView` interfaces respectively, serving as the presentation layer for database export and import operations. These views are intended to be hosted in the main application UI and delegate behavior to corresponding view models (not included in the provided source), following a standard MVVM pattern.
### 2. Public Interface
#### `DBExportView`
- **Signature**: `public partial class DBExportView : IDBExportView`
- **Constructor**: `public DBExportView()`
- Initializes the component by calling `InitializeComponent()`, which wires up the XAML-defined UI elements.
- Implements the `IDBExportView` interface (defined in `DTS.Common.Interface`).
#### `DBImportView`
- **Signature**: `public partial class DBImportView : IDBImportView`
- **Constructor**: `public DBImportView()`
- Initializes the component by calling `InitializeComponent()`, which wires up the XAML-defined UI elements.
- Implements the `IDBImportView` interface (defined in `DTS.Common.Interface`).
> **Note**: No additional public methods, properties, or events are declared in the provided source. The actual behavior and data binding are expected to be defined in the corresponding XAML files and view models.
### 3. Invariants
- Both classes are `partial`, implying their full definition spans across `.xaml.cs` and `.xaml` files (not provided).
- `InitializeComponent()` must be called exactly once during construction; calling it again may cause runtime exceptions.
- The views assume their corresponding XAML files (`DBExportView.xaml` and `DBImportView.xaml`) exist in the same directory and define compatible UI elements.
- No validation, state mutation, or business logic is present in the provided code—behavior is delegated to view models or other layers.
### 4. Dependencies
- **External Dependency**:
- `DTS.Common.Interface` assembly (contains `IDBExportView` and `IDBImportView` interface definitions).
- **Internal Dependencies (inferred)**:
- `DBImportExport` namespace likely contains supporting types (e.g., view models, services), but none are referenced in the provided source.
- XAML files (`DBExportView.xaml`, `DBImportView.xaml`) must be present and compiled as `Page` resources.
- **Depended upon by**:
- Likely consumed by a view model or navigation service (e.g., `DBExportViewModel`, `SystemSettingsViewModel`) to instantiate and display the UI.
- May be registered via DI container or manually instantiated in a shell/window.
### 5. Gotchas
- **Misleading XML comment**: Both classes reference `PowerAndBatteryView.xaml` in their summary comments, which is inconsistent with their actual names and purpose. This may indicate copy-paste error or outdated documentation.
- **No logic in constructors**: The views are purely declarative in the provided code. Any runtime behavior (e.g., data loading, export/import triggers) must reside in the XAML or view model—developers should verify binding paths and command wiring.
- **Interface contract unknown**: Without access to `IDBExportView` and `IDBImportView`, the expected behavior (e.g., methods like `Export()`, `Import()`, or properties like `IsBusy`) cannot be determined.
- **No error handling visible**: No exception handling or validation logic is present in the provided code; failures in `InitializeComponent()` (e.g., missing XAML) will propagate unhandled.
- **None identified from source alone** for additional non-obvious behaviors beyond the above.

View File

@@ -0,0 +1,179 @@
---
source_files:
- DataPRO/Modules/SystemSettings/DBImportExport/ViewModel/DBViewModel.cs
generated_at: "2026-04-16T04:40:45.205601+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "197f884be4481037"
---
# ViewModel
## Documentation: `DBViewModel` (`DBImportExport` Module)
---
### 1. **Purpose**
The `DBViewModel` class serves as the view model for database import and export functionality within the DataPRO application. It acts as a bridge between the UI (via `IDBImportView` and `IDBExportView`) and the underlying data layer, handling user interactions for selecting import/export files, validating data, and performing file I/O operations using XML strings. Due to architectural constraints (legacy DataPRO objects reside in a separate project), its functionality is currently limited to managing XML string data flow—*not* direct database manipulation.
---
### 2. **Public Interface**
#### **Constructor**
```csharp
public DBViewModel(
IDBImportView importView,
IDBExportView exportView,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
- Initializes the view model with views, region/event management, and dependency injection containers.
- Sets `DataContext` of both views to `this`.
- Subscribes to `RaiseNotification` and `BusyIndicatorChangeNotification` events.
#### **Lifecycle Methods (No-op)**
All lifecycle methods currently have empty implementations:
- `void Cleanup()`
- `Task CleanupAsync()`
- `void Initialize()`
- `void Initialize(object parameter)`
- `void Initialize(object parameter, object model)`
- `Task InitializeAsync()`
- `Task InitializeAsync(object parameter)`
- `void Activated()`
#### **Event Handlers (Internal)**
- `private void OnBusyIndicatorNotification(bool eventArg)`
Sets `IsBusy` to `eventArg`.
- `private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)`
Converts `NotificationContentEventArgs` to `Notification` and raises `NotificationRequest`.
#### **Public Methods**
- `public void Export()`
Writes `ExportData` (XML string) to `ExportFileName` using `Encoding.Unicode`.
**Validation checks**:
- Fails early if `ExportFileName` or `ExportData` is null/whitespace, publishing a `ShowStatus` event with failure message.
- If `ExportFileName` already exists, deletes/moves it via `FileUtils.DeleteFileOrMove`.
- Writes file using `File.WriteAllText`.
#### **Interaction Requests (Public)**
- `public InteractionRequest<Notification> NotificationRequest { get; }`
Used to trigger notification popups (e.g., success/error messages).
- `public InteractionRequest<Confirmation> ConfirmationRequest { get; }`
Reserved for confirmation dialogs (not used in current implementation).
#### **Commands (Public)**
- `public DelegateCommand ImportBrowseCommand { get; }`
Opens an `OpenFileDialog` to select an import file. Sets `ImportFileName` and updates `ImportStatusText`.
- `public DelegateCommand ExportBrowseCommand { get; }`
Opens a `SaveFileDialog` to set `ExportFileName`.
#### **Properties (Public)**
- `IDBImportView ImportView { get; set; }`
Reference to the import view instance.
- `IDBExportView ExportView { get; set; }`
Reference to the export view instance.
- `bool IsDirty { get; private set; }`
Always `false` (never set).
- `bool IsBusy { get; set; }`
Bound to busy indicator; updated via `OnBusyIndicatorNotification`.
- `bool IsMenuIncluded { get; set; }`
Property exposed for UI binding (value never read/written beyond property setter).
- `bool IsNavigationIncluded { get; set; }`
Same as above.
- `string HeaderInfo { get; }`
Hardcoded to `"MainRegion"`.
- `string ImportData { get; set; }`
XML string for imported data (no import logic implemented—only storage).
- `string ExportData { get; set; }`
XML string for exported data (no export logic implemented—only storage).
- `string ExportFileName { get; set; }`
Full path to export file.
- `string ImportFileName { get; set; }`
Full path to import file.
- `string ImportStatusText { get; set; }`
Status message for import UI (e.g., warning about database overwrite).
- `event PropertyChangedEventHandler PropertyChanged`
Implements `INotifyPropertyChanged`.
- `void OnPropertyChanged(string propertyName)`
Raises `PropertyChanged` event.
#### **Nested Type**
- `public enum PropertyNames`
Lists property names used in `OnPropertyChanged`:
`ExportFileName`, `ImportFileName`, `ImportStatusText`.
---
### 3. **Invariants**
- `Export()` **requires**:
- `ExportFileName` must be non-null/non-whitespace.
- `ExportData` must be non-null/non-whitespace.
- `Export()` **guarantees**:
- If file exists at `ExportFileName`, it is deleted/moved before writing.
- File is written using `Encoding.Unicode`.
- `ImportBrowseMethod()`:
- Uses `OpenFileDialog` with `CheckFileExists = true` and `CheckPathExists = true`.
- Sets `ImportFileName` only if dialog succeeds.
- `ExportBrowseMethod()`:
- Uses `SaveFileDialog` with `OverwritePrompt = false`.
- Sets `ExportFileName` only if dialog succeeds.
- `IsBusy` is updated synchronously via event subscription (on publisher thread).
- `ImportStatusText` is updated *only* in `ImportBrowseMethod()` (no import operation is triggered by this view model).
---
### 4. **Dependencies**
#### **Imports/Usings**
- `System.ComponentModel`, `System.ComponentModel.Composition`, `System.Threading.Tasks`
- `DTS.Common.Events` (e.g., `RaiseNotification`, `BusyIndicatorChangeNotification`, `ShowStatus`, `StatusInfo`)
- `Prism.Events`, `Prism.Regions`, `Prism.Commands`
- `Unity` (for `IUnityContainer`)
- `DTS.Common.Interface` (e.g., `IDBImportView`, `IDBExportView`, `IDBViewModel`)
- `DTS.Common.Utils` (e.g., `FileUtils`)
- `DTS.Common.Interactivity` (e.g., `InteractionRequest<T>`)
- `System.Text` (for `Encoding`)
- `System.Windows.Forms` (for `OpenFileDialog`, `SaveFileDialog`)
#### **Consumed Types**
- `IDBImportView`, `IDBExportView`, `IDBViewModel` (from `DBImportExport` namespace)
- `NotificationContentEventArgs`, `StatusInfo`, `StatusInfo.StatusState`
- `FileUtils.DeleteFileOrMove`
- `Resources.StringResources` (for UI strings: `ImportFileBrowse_Filter`, `ExportFileBrowse_Filter`, `ExportFileName_Empty`, `ExportFileData_Empty`)
#### **Depended Upon By**
- Prism-based shell/shell regions (via `IRegionManager`).
- Event publishers (e.g., `RaiseNotification`, `BusyIndicatorChangeNotification`).
- Views (`IDBImportView`, `IDBExportView`) bound to this view model.
---
### 5. **Gotchas**
- **No actual import/export logic**:
`ImportData` and `ExportData` are *only* storage properties. No code parses, validates, or processes the XML strings. Import/export is purely file I/O—*no database interaction* occurs in this class.
- **`Cleanup()`/`Initialize()` are no-ops**:
Lifecycle methods exist for interface compliance but perform no work.
- **`IsDirty` is never set**:
Always `false`; likely unused or incomplete.
- **`IsMenuIncluded`/`IsNavigationIncluded` unused**:
Properties exist but have no observed consumers in this file.
- **Hardcoded `HeaderInfo`**:
Always `"MainRegion"`—no dynamic behavior.
- **`LogDummyFunc` does nothing**:
Passed to `FileUtils.DeleteFileOrMove` but never logs (silently ignores errors).
- **No import operation triggered**:
`ImportFileName` is set via browse dialog, but no `Import()` method exists to process the file.
- **`Export()` writes directly without user confirmation**:
Overwrites existing files silently (only uses `FileUtils.DeleteFileOrMove`).
- **`NotificationRequest` conversion quirk**:
`OnRaiseNotification` constructs a new `NotificationContentEventArgs` with empty strings for `Image` and `CommandParameter`—may lose data if callers rely on them.
- **Thread safety**:
`IsBusy` updates occur on `PublisherThread` (via `ThreadOption.PublisherThread`), but other properties lack thread-safety guarantees.
> **None identified from source alone** for critical bugs or anti-patterns beyond the above architectural limitations.