using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Data; namespace FLY.Thick.Base.UI.Converter { public class HrsConverter : IValueConverter { #region IValueConverter 成员 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { string str_Permanent = "forever"; int hrs = (int)value; if (hrs >= 50000) { try { str_Permanent = (string)Application.Current.FindResource("strPermanentUse"); } catch { } return str_Permanent; } else { return hrs.ToString() + "h"; } } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } #endregion } }