Files
DP44/docs/ai/DataPRO/Modules/Database/DatabaseServices/Converters.md
2026-04-17 14:55:32 -04:00

2.1 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/Modules/Database/DatabaseServices/Converters/DbTypeToVisibilityConverter.cs
2026-04-17T16:44:02.991131+00:00 zai-org/GLM-5-FP8 1 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:

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: