public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { try { var dt = (DateTime)value; Lunar lunar = new Lunar(dt); var ob = lunar.GetOBOfDay(dt); switch (parameter.ToString()) { case "年": return(ob.Lyear3); case "月": return(ob.Lmonth2); case "日": return(ob.Lday2); case "时": return(ob.Ltime2); } return(ob.Lyear3); } catch (Exception) { return(""); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { try { var dt = (DateTime)value; Lunar lunar = new Lunar(dt); var a = lunar.GetOBOfDay(dt).LShX2; switch (a) { case "鼠": return("\ue800"); case "牛": return("\ue801"); case "虎": return("\ue802"); case "兔": return("\ue803"); case "龙": return("\ue804"); case "蛇": return("\ue805"); case "马": return("\ue806"); case "羊": return("\ue807"); case "猴": return("\ue808"); case "鸡": return("\ue809"); case "狗": return("\ue80a"); case "猪": return("\ue80b"); } return(""); } catch (Exception) { return(""); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { try { var dt = (DateTime)value; Lunar lunar = new Lunar(dt); return(lunar.GetOBOfDay(dt).LShX2); } catch (Exception) { return(""); } }