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); }
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; }
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; }
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); }
public override void SetDate(DateTime? dateTime, DateFormat dateFormat) { var valuePattern = (ValuePattern)AutomationElement.GetCurrentPattern(ValuePattern.Pattern); valuePattern.SetValue(dateTime != null ? dateTime.Value.ToShortDateString() : null); }
public override void SetDate(DateTime?dateTime, DateFormat dateFormat) { var valuePattern = (ValuePattern)AutomationElement.GetCurrentPattern(ValuePattern.Pattern); valuePattern.SetValue(dateTime != null ? dateTime.Value.ToShortDateString() : null); }
public void DifferentDateFormats() { Assert.AreEqual(DateFormat.DayMonthYear, DateFormat.Create("-", "dd-MM-yyyy")); Assert.AreEqual(DateFormat.DayMonthYear, DateFormat.Create("-", "d-M-yyyy")); }