227a749cdf
Fix 173 of 175 documentation issues across 48 files using CommentChecker, adding missing <summary>, <param>, and <inheritdoc /> tags to public APIs.
68 lines
2.7 KiB
C#
68 lines
2.7 KiB
C#
using System.Globalization;
|
|
using Avalonia.Data.Converters;
|
|
using JdeScoping.ConfigManager.Models;
|
|
|
|
namespace JdeScoping.ConfigManager.Converters;
|
|
|
|
/// <summary>
|
|
/// Converts a ConnectionProvider value to visibility (bool) based on whether it matches the target provider.
|
|
/// </summary>
|
|
public class ProviderToVisibilityConverter : IValueConverter
|
|
{
|
|
/// <summary>
|
|
/// Converter instance for SqlServer provider visibility.
|
|
/// </summary>
|
|
public static readonly ProviderToVisibilityConverter SqlServer = new(ConnectionProvider.SqlServer);
|
|
|
|
/// <summary>
|
|
/// Converter instance for Oracle provider visibility.
|
|
/// </summary>
|
|
public static readonly ProviderToVisibilityConverter Oracle = new(ConnectionProvider.Oracle);
|
|
|
|
/// <summary>
|
|
/// Converter instance for Generic provider visibility.
|
|
/// </summary>
|
|
public static readonly ProviderToVisibilityConverter Generic = new(ConnectionProvider.Generic);
|
|
|
|
private readonly ConnectionProvider _targetProvider;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="ProviderToVisibilityConverter"/> class.
|
|
/// </summary>
|
|
/// <param name="targetProvider">The provider to match for visibility.</param>
|
|
public ProviderToVisibilityConverter(ConnectionProvider targetProvider)
|
|
{
|
|
_targetProvider = targetProvider;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Converts a ConnectionProvider to a boolean indicating visibility.
|
|
/// </summary>
|
|
/// <param name="value">The ConnectionProvider value to convert.</param>
|
|
/// <param name="targetType">The target type (bool).</param>
|
|
/// <param name="parameter">Unused converter parameter.</param>
|
|
/// <param name="culture">The culture for conversion.</param>
|
|
/// <returns>True if the value matches the target provider; otherwise, false.</returns>
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is ConnectionProvider provider)
|
|
{
|
|
return provider == _targetProvider;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Not implemented - this is a one-way converter.
|
|
/// </summary>
|
|
/// <param name="value">The value to convert back.</param>
|
|
/// <param name="targetType">The target type.</param>
|
|
/// <param name="parameter">Unused converter parameter.</param>
|
|
/// <param name="culture">The culture for conversion.</param>
|
|
/// <exception cref="NotImplementedException">This converter does not support reverse conversion.</exception>
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|