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

using System.Windows;
using DataAnalysisControl.Core;

namespace Aitex.UI.Charting.Converter
{
    public class Bools2BoolConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            try
            {
                bool isHid1 = (bool)values[0];
                bool isHid2 = (bool)values[1];
                return !(isHid1 && isHid2);
            }
            catch (Exception ex)
            {
                CONTEXT.WriteLog(ex);
            }
            return false;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            try
            {
                var b = (bool)value;
                if (b)
                    return new object[] { false, false };
                return new object[] { true,true };
            }
            catch (Exception ex)
            {
                CONTEXT.WriteLog(ex);
            }
            return new object[] { true, true };
        }
    }
}