Пример #1
0
        public override Window.WindowItemBase FindWindow(Window.SearchCriteria criteria)
        {
            Window.WindowItemBase found = null;

            if (criteria.IsEmpty)
            {
                return(found);
            }

            if (!string.IsNullOrEmpty(criteria.ClassName) && !criteria.HasExcludes && !criteria.HasID && string.IsNullOrEmpty(criteria.Text))
            {
                found = new WindowItem(WindowsAPI.FindWindow(criteria.ClassName, criteria.Title));
            }
            else
            {
                foreach (var window in AllWindows)
                {
                    if (window.Equals(criteria))
                    {
                        found = window;
                        break;
                    }
                }
            }

            if (found != null && found.IsSpecified)
            {
                LastFound = found;
            }

            return(found);
        }
Пример #2
0
 /// <summary>
 /// Searches for a child window/control at <paramref name="location"/>
 /// </summary>
 /// <param name="location"></param>
 /// <returns></returns>
 public override Window.WindowItemBase RealChildWindowFromPoint(Point location)
 {
     Window.WindowItemBase child = null;
     if (this.IsSpecified)
     {
         child = new WindowItem(WindowsAPI.RealChildWindowFromPoint(this.Handle, location));
     }
     return(child);
 }