| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- 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<RobotInfo>)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;
- }
- }
- }
|