You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kev/Drawer/AI/Converters/WorkflowStatusToIconConvert...

40 lines
1.3 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Avalonia.Data.Converters;
using AI.Models;
using System;
using System.Globalization;
namespace AI.Converters
{
/// <summary>
/// 将工作流步骤状态转换为图标
/// </summary>
public class WorkflowStatusToIconConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
// 注意这个转换器现在主要用于其他场景UI 中的图标已经改为使用 Grid 叠加显示
// 保持兼容性,返回基本图标
if (value is WorkflowStepStatus status)
{
return status switch
{
WorkflowStepStatus.Completed => "○", // UI 中会叠加显示勾
WorkflowStepStatus.Running => "○", // 保持圆圈,只变颜色
WorkflowStepStatus.Failed => "✗",
WorkflowStepStatus.Skipped => "⊘",
WorkflowStepStatus.Pending => "○",
_ => "○"
};
}
return "○";
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}