35 lines
983 B
C#
35 lines
983 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Data;
|
|
using WpfApp1TRC20.Data;
|
|
|
|
namespace WpfApp1TRC20.Utils
|
|
{
|
|
public class StatusToColorConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is TransactionStatus status)
|
|
{
|
|
return status switch
|
|
{
|
|
TransactionStatus.Confirmed => "Green",
|
|
TransactionStatus.Pending => "Orange",
|
|
TransactionStatus.Failed => "Red",
|
|
_ => "Gray"
|
|
};
|
|
}
|
|
return "Gray";
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|