TaskRowView with status chip (EqStatus converter + parameter), StrikeIfTrue, NotNullToBool converters. TasksIslandView with header, add-task TextBox (Enter=AddCommand), ItemsControl + flat Button for selection. Converters registered in App.axaml. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
981 B
C#
27 lines
981 B
C#
using System.Globalization;
|
|
using Avalonia.Data.Converters;
|
|
using ClaudeDo.Data.Models;
|
|
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
|
|
|
|
namespace ClaudeDo.Ui.Converters;
|
|
|
|
/// <summary>
|
|
/// Returns true when the bound TaskStatus equals the ConverterParameter string.
|
|
/// Usage: Classes.running="{Binding Status, Converter={StaticResource EqStatus}, ConverterParameter=Running}"
|
|
/// </summary>
|
|
public class EqStatusConverter : IValueConverter
|
|
{
|
|
public static EqStatusConverter Instance { get; } = new();
|
|
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is TaskStatus status && parameter is string name &&
|
|
Enum.TryParse<TaskStatus>(name, ignoreCase: true, out var target))
|
|
return status == target;
|
|
return false;
|
|
}
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
=> throw new NotSupportedException();
|
|
}
|