35 lines
646 B
C#
35 lines
646 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Windows.UI.Xaml.Data;
|
|
|
|
namespace AutoCatCore.Converters
|
|
{
|
|
public class SteeringWheelPositionConverter: IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, string language)
|
|
{
|
|
if(value is bool isRightWheel)
|
|
{
|
|
return isRightWheel ? "Right" : "Left";
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
|
{
|
|
if(value is string wheelPosition)
|
|
{
|
|
return wheelPosition == "Right";
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|