using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Windows.Data;

namespace FLY.Thick.Base.UI.Converter
{
    public class IPEPConverter : IValueConverter
    {
        #region IValueConverter 成员

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            IPEndPoint ep = (IPEndPoint)value;
            if (ep == null)
            {
                return "";
            }
            else
                return ep.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string s = (string)value;
            
            return Misc.StringConverter.ToIPEndPoint(s);
        }

        #endregion
    }
}
