using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; using TeamAAS_VP.Core; using TeamAAS_VP.Models; namespace TeamAAS_VP.ValueConverter { public class RobotConverter : IMultiValueConverter { public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture) { try { if (value != null && value.Length==2) { var lst = (ObservableCollection)value[1]; var robotinfo = lst.FirstOrDefault(r => r.Id == (Guid)value[0]); if (robotinfo != null) { return robotinfo.RobotName; } else { return null; } } else { return null; } } catch (Exception) { return null; } } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return null; } } }