public override void Execute(ActivityContext context) { var query = ElementQuery.Get(this.Element); if (query == null) { return; } var elements = WinContext.Shared.GetElementsFromQuery(query); if (elements.Count() == 0) { throw new Exception("Element not found."); } if (elements.Count() > 1) { throw new Exception("Too many elements found."); } using (var input = new InputDriver()) { var e = elements.First() as WinElement; e.Focus(); e.Click(); } }
public override void Execute(ActivityContext context) { var query = ElementQuery.Get(this.Element); if (query == null) { throw new Exception("Input 'Element' is required."); } var elements = WinContext.Shared.GetElementsFromQuery(query); if (elements.Count() == 0) { throw new Exception("Element not found."); } if (elements.Count() > 1) { throw new Exception("Too many elements found."); } var text = context.Get(this.Text); var e = elements.First() as WinElement; e.Focus(); SendKeys.SendWait(text); }
public override void Execute(ActivityContext context) { var query = ElementQuery.Get(this.Element); var elements = WinContext.Shared.GetElementsFromQuery(query); if (elements.Count() == 0) { throw new Exception("Element not found."); } if (elements.Count() > 1) { throw new Exception("Too many elements found."); } var e = elements.First() as WinElement; var name = context.Get(this.PropertyName); if (e.GetType().GetProperty(name, BindingFlags.Public | BindingFlags.Instance) is PropertyInfo pi) { context.Set(this.PropertyValue, pi.GetValue(e)?.ToString() ?? string.Empty); } else { throw new Exception(string.Format("Element property '{0}' not found.", name)); } }
public override bool Execute(ActivityContext context) { var query = ElementQuery.Get(this.Element); var elements = WinContext.Shared.GetElementsFromQuery(query); if (elements.Count() == 0) { return(false); } return(true); }
public override bool Execute(ActivityContext context) { var query = ElementQuery.Get(this.Element); if (query == null) { throw new Exception("Input 'Element' is required."); } var elements = WinContext.Shared.GetElementsFromQuery(query); if (elements.Count() == 0) { return(false); } return(true); }
public override void Execute(ActivityContext context) { var query = ElementQuery.Get(this.Element); var elements = WinContext.Shared.GetElementsFromQuery(query); if (elements.Count() == 0) { throw new Exception("Element not found."); } if (elements.Count() > 1) { throw new Exception("Too many elements found."); } var e = elements.First() as WinElement; e.Focus(); context.Set(this.Value, e.Value); }