using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace VideoDownloader.App;
/// 컬렉션 카운트 → 빈 상태 표시용 (0일 때 Visible)
public class InverseCountToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> (value is int i && i > 0) ? Visibility.Collapsed : Visibility.Visible;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
}
/// 다운로드 상태 문자열 → 표시 여부. parameter="done" 이면 완료일 때만 Visible(UC-A11 완료 아이콘).
public class StatusToVisibilityConverter : IValueConverter
{
public static readonly StatusToVisibilityConverter Done = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> value is string s && s == "완료" ? Visibility.Visible : Visibility.Collapsed;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
}
/// UC-D10 세그먼트 진행도(0~1) → 블록 배경색(진행 중 강조/대기 트랙).
public class SegmentFillConverter : IValueConverter
{
public static readonly SegmentFillConverter Instance = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> value is double d && d >= 1.0
? System.Windows.Media.Brushes.DodgerBlue
: value is double p && p > 0
? (System.Windows.Media.Brush)System.Windows.Application.Current.FindResource("AccentBrush")
: (System.Windows.Media.Brush)System.Windows.Application.Current.FindResource("TrackBrush");
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
}