using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; using System.Windows.Media.Imaging; namespace Install.Converters { public class IconConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { string processName = values[0] as string; Dictionary icons = values[1] as Dictionary; if (string.IsNullOrEmpty(processName)) { return new BitmapImage(new Uri("Images/cross.png", UriKind.Relative)); } if (icons == null) { return new BitmapImage(new Uri("Images/cross.png", UriKind.Relative)); } if (!icons.ContainsKey(processName)) { return new BitmapImage(new Uri("Images/cross.png", UriKind.Relative)); } return icons[processName]; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }