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,45 @@
---
source_files:
- DataPRO/Modules/Database/DatabaseServices/Converters/DbTypeToVisibilityConverter.cs
generated_at: "2026-04-17T16:44:02.991131+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f33cb579dbf56959"
---
# Documentation: DbTypeToVisibilityConverter
## 1. Purpose
`DbTypeToVisibilityConverter` is a WPF `IMultiValueConverter` that determines the visibility of UI elements based on database connection type state. It bridges the view layer (`DatabaseStatusBarView`) and view model layer (`DatabaseStatusBarViewModel`) to conditionally show or hide elements depending on the current `DbType` configuration and connection status. This converter is specifically designed for the database status bar component in the application.
## 2. Public Interface
### `DbTypeToVisibilityConverter` (class)
Implements: `IMultiValueConverter`
#### `Convert(object[] values, Type targetType, object parameter, CultureInfo culture)`
**Signature:**
```csharp
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
```
**Behavior:** Converts database type information to a `Visibility` value.
- **`values[0]`**: Expected to be an integer value castable to `DbType` enum (the target database type being evaluated for visibility).
- **`values[1]`**: Expected to be a `DatabaseStatusBarView` instance.
- **Returns:** `Visibility.Visible` or `Visibility.Collapsed` based on the following logic:
- If `view.DataContext` is `null`, returns `Visibility.Collapsed`.
- If `vm.DatabaseType` is `DbType.RemoteOnly`: Visible only when `dbType == DbType.RemoteOnly`.
- If `vm.DatabaseType` is `DbType.LocalOnly`: Visible only when `dbType == DbType.LocalOnly`.
- If `vm.DatabaseType` is `DbType.RemoteLocalHybrid`:
- When `vm.RemoteConnected` is `true`: Visible only when `dbType == DbType.RemoteOnly`.
- When `vm.RemoteConnected` is `false`: Visible only when `dbType == DbType.RemoteLocalHybrid`.
- All other cases: Returns `Visibility.Collapsed`.
#### `ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)`
**Signature:**
```csharp