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.Effects;

namespace Txgy.EWS.Client.Common.Converters
{
    public class Absolute2RelativeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string EN=parameter.ToString();
            double coord=double.Parse(value.ToString());
            double relative = 0;
            if (EN=="E")
            {
                relative = coord - GlobalConfig.BaseX;
            }
            else
            {
                relative = coord - GlobalConfig.BaseY;
            }
            
            return relative;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            //throw new NotImplementedException();
            return null;
        }
    }
}
