using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;
using System.Windows.Media;

namespace Aitex.UI.RecipeEditor
{
    class ErrColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            try
            {
                if (value == null) return Brushes.White;
                var errors = value as List<Tuple<int/*row no*/, int/*col no*/, string/*var name*/, string/*reason*/>>;
                if (errors.Count > 0)
                    return Brushes.Red;
                return Brushes.White;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            return Brushes.White;
        }

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