feat(04-08,04-09): create Transfer/BulkMembers/BulkSites/FolderStructure ViewModels and Views

- TransferViewModel: source/dest site selection, Copy/Move mode, conflict policy, export failed
- TransferView: SitePickerDialog and FolderBrowserDialog wiring, confirm dialog
- BulkMembersViewModel, BulkSitesViewModel: CSV import, validate, preview, execute, retry, export
- FolderStructureViewModel: CSV import, site URL + library inputs, folder creation
- All 3 bulk Views: ConfirmBulkOperationDialog wiring, DataGrid preview with validation status
- Added EnumBoolConverter, StringToVisibilityConverter, ListToStringConverter to converters file
This commit is contained in:
Dev
2026-04-03 10:23:54 +02:00
parent 93218b0953
commit 87dd4bb3ef

View File

@@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Windows; using System.Windows;
using System.Windows.Data; using System.Windows.Data;
@@ -46,3 +47,52 @@ public class InverseBoolConverter : IValueConverter
=> value is bool b && !b; => value is bool b && !b;
} }
/// <summary>
/// Converts a string to Visibility: Visible when non-empty, Collapsed when null or empty.
/// </summary>
[ValueConversion(typeof(string), typeof(Visibility))]
public class StringToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> value is string s && !string.IsNullOrEmpty(s) ? Visibility.Visible : Visibility.Collapsed;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
}
/// <summary>
/// Converts an enum value to bool by comparing it with the ConverterParameter.
/// Used for RadioButton IsChecked bindings to enum properties.
/// </summary>
public class EnumBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || parameter == null) return false;
return value.ToString() == parameter.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool b && b && parameter != null)
return Enum.Parse(targetType, parameter.ToString()!);
return System.Windows.DependencyProperty.UnsetValue;
}
}
/// <summary>
/// Converts a List&lt;string&gt; to a single semicolon-separated string for display in DataGrid cells.
/// </summary>
public class ListToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is IEnumerable<string> list)
return string.Join("; ", list);
return string.Empty;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
}