public void TimeFormatTest() { var target = new SplitDateTime(); target.TimeFormat = "hh:MM"; Assert.AreEqual("hh:MM", (target.Widgets[1] as TimeInput).Format); (target.Widgets[1] as TimeInput).Format = "MM:hh:ss"; Assert.AreEqual("MM:hh:ss", target.TimeFormat); }
public void DateFormatTest() { var target = new SplitDateTime(); target.DateFormat = "yy-mm-dd"; Assert.AreEqual("yy-mm-dd", (target.Widgets[0] as DateInput).Format); (target.Widgets[0] as DateInput).Format = "mmm-dd-yyyy"; Assert.AreEqual("mmm-dd-yyyy", target.DateFormat); }
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) { object[] resultDates = new object[2]; SplitDateTime splitDateTime = new SplitDateTime(value.ToString()); if (splitDateTime.HasError == false) { resultDates[0] = splitDateTime.Date; resultDates[1] = splitDateTime.Time; } else { resultDates[0] = DependencyProperty.UnsetValue; resultDates[1] = DependencyProperty.UnsetValue; } return resultDates; }
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) { object[] resultDates = new object[2]; SplitDateTime splitDateTime = new SplitDateTime(value.ToString()); if (splitDateTime.HasError == false) { resultDates[0] = splitDateTime.Date; resultDates[1] = splitDateTime.Time; } else { resultDates[0] = DependencyProperty.UnsetValue; resultDates[1] = DependencyProperty.UnsetValue; } return(resultDates); }
private void TextBoxCollectionDate_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Up || e.Key == Key.Down) { SplitDateTime splitDateTime = new SplitDateTime(this.TextBoxCollectionDate.Text); if (e.Key == Key.Up) { splitDateTime.AddDay(); } else if (e.Key == Key.Down) { splitDateTime.SubtractDay(); } this.m_FlowUI.AccessionOrder.CollectionDate = splitDateTime.Date; this.m_FlowUI.AccessionOrder.CollectionTime = splitDateTime.Time; } }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (values.Length != 2) throw new InvalidOperationException("The input to this converter must have 2 dates."); Nullable<DateTime> date = null; Nullable<DateTime> dateTime = null; string result = string.Empty; if (values[0] != null && values[0].GetType() == typeof(DateTime)) { date = (DateTime)values[0]; } if (values[1] != null && values[1].GetType() == typeof(DateTime)) { dateTime = (DateTime)values[1]; } SplitDateTime splitDateTime = new SplitDateTime(date, dateTime); return splitDateTime.MergedDateString; }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (values.Length != 2) { throw new InvalidOperationException("The input to this converter must have 2 dates."); } Nullable <DateTime> date = null; Nullable <DateTime> dateTime = null; string result = string.Empty; if (values[0] != null && values[0].GetType() == typeof(DateTime)) { date = (DateTime)values[0]; } if (values[1] != null && values[1].GetType() == typeof(DateTime)) { dateTime = (DateTime)values[1]; } SplitDateTime splitDateTime = new SplitDateTime(date, dateTime); return(splitDateTime.MergedDateString); }
public void SplitDateTimeConstructorTest() { SplitDateTime target = new SplitDateTime(); // Pass }