using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;

namespace DateTimeSettings.Common
{
    public class HoursConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            // adjust hour hand between hour marks
            TimeSpan ts = (TimeSpan)value;
            if(ts.Hours > 11)
                return ts.Hours - 12 + ts.Minutes / 60.0;
            else
                return ts.Hours + ts.Minutes / 60.0;
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            return new NotImplementedException();
        }
    }
}
