Forge
csharpdeeb25a2
1using System.Globalization;
2using Avalonia.Data.Converters;
3using CascadeIDE.Models;
4
5namespace CascadeIDE.Views;
6
7/// <summary>
8/// True, если строка — заголовок секции (Dev Tools / переменные окружения).
9/// Параметр <c>Invert</c> инвертирует результат (для скрытия обычной карточки на секции).
10/// </summary>
11public sealed class EnvironmentReadinessIsSectionRowConverter : IValueConverter
12{
13 public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
14 {
15 var isSection = value is string s
16 && (s == EnvironmentReadinessCellIds.DevToolsSection || s == EnvironmentReadinessCellIds.EnvSection);
17 if (string.Equals(parameter as string, "Invert", StringComparison.Ordinal))
18 isSection = !isSection;
19 return isSection;
20 }
21
22 public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) =>
23 throw new NotSupportedException();
24}
25
26/// <summary>True для непустой строки (подпись детали у секции).</summary>
27public sealed class StringNotEmptyToBoolConverter : IValueConverter
28{
29 public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
30 value is string s && s.Length > 0;
31
32 public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) =>
33 throw new NotSupportedException();
34}
35
View only · write via MCP/CIDE