Exemplo n.º 1
0
 public virtual void SetDate(DateTime dateTime, DateFormat dateFormat)
 {
     keyboard.Send(dateFormat.DisplayValue(dateTime, 0).ToString(), actionListener);
     keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT, actionListener);
     keyboard.Send(dateFormat.DisplayValue(dateTime, 1).ToString(), actionListener);
     keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT, actionListener);
     keyboard.Send(dateFormat.DisplayValue(dateTime, 2).ToString(), actionListener);
     keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT, actionListener);
 }
Exemplo n.º 2
0
 public static DateFormat Parse(string @string)
 {
     string[] parts = @string.Split(',');
     var newDateFormat = new DateFormat();
     foreach (string part in parts)
     {
         var dateUnit = (DateUnit) Enum.Parse(typeof (DateUnit), part);
         newDateFormat.dateUnits.Add(dateUnit);
     }
     return newDateFormat;
 }
Exemplo n.º 3
0
 public static DateFormat Create(string dateSeparator, string pattern)
 {
     string[] parts = pattern.Split(dateSeparator.ToCharArray());
     var dateFormat = new DateFormat();
     foreach (string part in parts)
     {
         if (part.ToLower().Contains("d")) dateFormat.dateUnits.Add(DateUnit.Day);
         else if (part.ToLower().Contains("m")) dateFormat.dateUnits.Add(DateUnit.Month);
         else if (part.ToLower().Contains("yy")) dateFormat.dateUnits.Add(DateUnit.Year);
     }
     return dateFormat;
 }
Exemplo n.º 4
0
        public virtual void SetDate(DateTime? dateTime, DateFormat dateFormat)
        {
            if (dateTime == null)
            {
                ClearDate();
                return;
            }

            keyboard.Send(dateFormat.DisplayValue(dateTime.Value, 0).ToString(), actionListener);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT, actionListener);
            keyboard.Send(dateFormat.DisplayValue(dateTime.Value, 1).ToString(), actionListener);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT, actionListener);
            keyboard.Send(dateFormat.DisplayValue(dateTime.Value, 2).ToString(), actionListener);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT, actionListener);
        }
Exemplo n.º 5
0
 public override void SetDate(DateTime? dateTime, DateFormat dateFormat)
 {
     var valuePattern = (ValuePattern)AutomationElement.GetCurrentPattern(ValuePattern.Pattern);
     valuePattern.SetValue(dateTime != null ? dateTime.Value.ToShortDateString() : null);
 }
Exemplo n.º 6
0
        public override void SetDate(DateTime?dateTime, DateFormat dateFormat)
        {
            var valuePattern = (ValuePattern)AutomationElement.GetCurrentPattern(ValuePattern.Pattern);

            valuePattern.SetValue(dateTime != null ? dateTime.Value.ToShortDateString() : null);
        }
Exemplo n.º 7
0
 public void DifferentDateFormats()
 {
     Assert.AreEqual(DateFormat.DayMonthYear, DateFormat.Create("-", "dd-MM-yyyy"));
     Assert.AreEqual(DateFormat.DayMonthYear, DateFormat.Create("-", "d-M-yyyy"));
 }