public override IEnumerable <Core.Element> GetElementsFromQuery(Query query) { var result = new List <WinElement>(); var candidates = new Queue <WinElement>(); var targetPath = query.First(x => x.Name == "Path").Value.ToString(); candidates.Enqueue(WinElement.GetRoot()); while (candidates.Count > 0) { var candidate = candidates.Dequeue(); var candidatePath = candidate.Path; if (targetPath.StartsWith(candidatePath)) { if (targetPath.Equals(candidatePath)) { if (candidate.TryQuery(query)) { result.Add(candidate); } } else { foreach (var child in candidate.Children) { candidates.Enqueue(child); } } } } return(result); }
protected override bool UpdateViewport(WinElement winElement) { this.Viewport = Rectangle.Empty; if (winElement != null && winElement.MainWindow is WinElement target && target.ProcessId == this.ProcessId) { if (target.GetElement(x => x.Class == "Internet Explorer_Server" || x.Class == "NewTabWnd") is WinElement viewport) { this.Viewport = viewport.Bounds; return(true); } } return(false); }
protected override bool UpdateViewport(WinElement winElement) { this.Viewport = Rectangle.Empty; if (winElement != null && winElement.MainWindow is WinElement target && target.ProcessId == this.ProcessId) { if (target.GetElement(x => x.Class == "Chrome_RenderWidgetHostHWND") is WinElement viewport) { this.Viewport = viewport.Bounds; return(true); } } return(false); }
protected override bool UpdateViewport(WinElement winElement) { this.Viewport = Rectangle.Empty; if (winElement != null && winElement.MainWindow is WinElement mainWindow && mainWindow.Class == "ApplicationFrameWindow" && mainWindow.Children.FirstOrDefault(x => x.Type == "window" && x.Name == "Microsoft Edge" && x.Class == "Windows.UI.Core.CoreWindow") is WinElement target && target.ProcessId == this.ProcessId) { if (target.GetElement(x => x.Class == "Internet Explorer_Server" || x.Class == "NewTabPage") is WinElement viewport) { this.Viewport = viewport.Bounds; return(true); } } return(false); }
public override Element GetElementFromPoint(int screenX, int screenY) { return(WinContext.Target = WinElement.GetFromPoint(screenX, screenY)); }
private WinContext() { this.ProcessId = WinElement.GetRoot().ProcessId; }
protected abstract bool UpdateViewport(WinElement target);