2024-06-26 22:04:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using Avalonia.Data.Converters;
|
|
|
|
|
using CRD.Downloader;
|
2024-07-21 09:30:20 +00:00
|
|
|
|
using CRD.Downloader.Crunchyroll;
|
2024-06-26 22:04:50 +00:00
|
|
|
|
using FluentAvalonia.UI.Controls;
|
|
|
|
|
|
|
|
|
|
namespace CRD.Utils.UI;
|
|
|
|
|
|
|
|
|
|
public class UiSonarrIdToVisibilityConverter : IValueConverter{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture){
|
|
|
|
|
if (value is string stringValue){
|
2024-07-21 09:30:20 +00:00
|
|
|
|
return CrunchyrollManager.Instance.CrunOptions.SonarrProperties != null && (stringValue.Length > 0 && CrunchyrollManager.Instance.CrunOptions.SonarrProperties.SonarrEnabled);
|
2024-06-26 22:04:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture){
|
|
|
|
|
throw new NotImplementedException("This converter only works for one-way binding");
|
|
|
|
|
}
|
|
|
|
|
}
|