private static void UpdateNewValue_custom(UIDateTime UIDateTimeCtrl) { if (UIDateTimeCtrl != null) { DateTime dValue = (DateTime)UIDateTimeCtrl.GetValue(DateValue_customProperty); string hValue_begin = (string)UIDateTimeCtrl.GetValue(BeginHourValue_customProperty); string mValue_begin = (string)UIDateTimeCtrl.GetValue(BeginMinitValue_customProperty); string hValue_stop = (string)UIDateTimeCtrl.GetValue(StopHourValue_customProperty); string mValue_stop = (string)UIDateTimeCtrl.GetValue(StopMinitValue_customProperty); hValue_begin = hValue_begin == null ? "00" : hValue_begin; mValue_begin = mValue_begin == null ? "00" : mValue_begin; hValue_stop = hValue_stop == null ? "00" : hValue_stop; mValue_stop = mValue_stop == null ? "00" : mValue_stop; DateTime BeginTime = DateTime.Now; DateTime StopTime = DateTime.Now; if (DateTime.TryParse(dValue.ToString("yyyy-MM-dd") + " " + hValue_begin + ":" + mValue_begin, out BeginTime)) { } if (DateTime.TryParse(dValue.ToString("yyyy-MM-dd") + " " + hValue_stop + ":" + mValue_stop, out StopTime)) { } UIDateTimeCtrl.SetValue(StartDateTimeValueProperty, BeginTime); UIDateTimeCtrl.SetValue(StopDateTimeValueProperty, StopTime); if (UIDateTimeCtrl.BeginDateTimeChanged != null) { UIDateTimeCtrl.BeginDateTimeChanged(BeginTime); } if (UIDateTimeCtrl.StopDateTimeChanged != null) { UIDateTimeCtrl.StopDateTimeChanged(StopTime); } } }
private static void UpdateNewValue_all(UIDateTime UIDateTimeCtrl) { if (UIDateTimeCtrl != null) { DateTime dValue_begin = (DateTime)UIDateTimeCtrl.GetValue(BeginDateValue_allProperty); DateTime dValue_stop = (DateTime)UIDateTimeCtrl.GetValue(StopDateValue_allProperty); string hValue = (string)UIDateTimeCtrl.GetValue(HourValue_allProperty); string mValue = (string)UIDateTimeCtrl.GetValue(MinitValue_allProperty); hValue = hValue == null ? "00" : hValue; mValue = mValue == null ? "00" : mValue; if (DateTime.TryParse(dValue_begin.ToString("yyyy-MM-dd") + " " + hValue + ":" + mValue, out dValue_begin)) { } if (DateTime.TryParse(dValue_stop.ToString("yyyy-MM-dd") + " " + hValue + ":" + mValue, out dValue_stop)) { } UIDateTimeCtrl.SetValue(StartDateTimeValueProperty, dValue_begin); UIDateTimeCtrl.SetValue(StopDateTimeValueProperty, dValue_stop); if (UIDateTimeCtrl.BeginDateTimeChanged != null) { UIDateTimeCtrl.BeginDateTimeChanged(dValue_begin); } if (UIDateTimeCtrl.StopDateTimeChanged != null) { UIDateTimeCtrl.StopDateTimeChanged(dValue_stop); } } }