using System;
using System.Globalization;
using System.Linq;
using System.Windows.Data;

namespace Khd.Core.Wpf.myConverter
{
    public class EquipConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string? val = System.Convert.ToString(value);
            var baseEquip = SystemData.BaseEquip.FirstOrDefault(t => t.equipNo == val);
            if (baseEquip == null)
            {
                return val;
            }
            else
            {
                return baseEquip.equipName;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value;
        }
    }
}
