using System;
using System.Globalization;
using System.Windows.Data;

namespace BeWo.Scheduler.Converter
{
    public class Recurrence2GermanConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
                return null;

            var rec = value as DevExpress.Xpf.Scheduler.UI.RecurrenceTypeElement;

            String result = String.Empty;

            if (rec != null)
                result = rec.Description;
            else
                result = value.ToString();

            switch (result)
            {
                case "(none)":
                    result = "Einmalig";
                    break;

                case "Daily":
                    result = "Täglich";
                    break;

                case "Weekly":
                    result = "Wöchentlich";
                    break;

                case "Monthly":
                    result = "Monatlich";
                    break;

                case "Yearly":
                    result = "Jährlich";
                    break;
            }

            return result;
        }

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



}