BDU/ATS/Converters/GuidToParameterNameConverter.cs

30 lines
827 B
C#

using BDU.Windows;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace BDU.Converters
{
public class GuidToParameterNameConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value is Guid id)
{
var para = MainWindow.Instance.Program.Parameters.FirstOrDefault(x => x.ID == id);
if(para != null) return para.Name;
}
return "";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}