Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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;
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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;
            }
        }
Ejemplo n.º 9
0
 public void SplitDateTimeConstructorTest()
 {
     SplitDateTime target = new SplitDateTime();
     // Pass
 }