コード例 #1
0
ファイル: WinContext.cs プロジェクト: Corne66/Roro
        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);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
ファイル: EdgeContext.cs プロジェクト: Corne66/Roro
 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);
 }
コード例 #5
0
ファイル: WinContext.cs プロジェクト: Corne66/Roro
 public override Element GetElementFromPoint(int screenX, int screenY)
 {
     return(WinContext.Target = WinElement.GetFromPoint(screenX, screenY));
 }
コード例 #6
0
ファイル: WinContext.cs プロジェクト: Corne66/Roro
 private WinContext()
 {
     this.ProcessId = WinElement.GetRoot().ProcessId;
 }
コード例 #7
0
ファイル: WebContext.cs プロジェクト: Corne66/Roro
 protected abstract bool UpdateViewport(WinElement target);