Container size scan, improvements

This commit is contained in:
2023-08-03 00:00:45 +02:00
parent 1713973c3a
commit f4d361f767
57 changed files with 814 additions and 532 deletions

View File

@@ -0,0 +1,19 @@
using System.Globalization;
using Avalonia.Data.Converters;
using FileTime.App.ContainerSizeScanner;
namespace FileTime.GuiApp.Converters;
public class ItemSizeToSizeConverter : IMultiValueConverter
{
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
{
if (values is [ISizePreviewItem previewItem, ContainerPreview sizeContainerViewModel, double width and > 0])
{
var cumulativeSize = sizeContainerViewModel.TopItems.Select(i => i.Size.Value).Sum();
return width * previewItem.Size.Value / cumulativeSize;
}
return null;
}
}