You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Txgy.EWS.Client/Txgy.EWS.Client.Common/Converters/Absolute2RelativeConverter.cs

38 lines
1.0 KiB
C#

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;
}
}
}