GetUpdatedCache() 공개 메소드

public GetUpdatedCache ( CacheRequest request ) : AutomationElement
request CacheRequest
리턴 AutomationElement
예제 #1
0
 public AutomationElement GetUpdatedAEWhenStructureChanged(AutomationElement mainWidow, AutomationPattern patternToCache = null, AutomationProperty propertyToCache = null)
 {
     CacheRequest cacheRequest = new CacheRequest();
     cacheRequest.TreeScope = TreeScope.Element | TreeScope.Descendants | TreeScope.Children;
     cacheRequest.AutomationElementMode = AutomationElementMode.Full;
     cacheRequest.TreeFilter = System.Windows.Automation.Automation.RawViewCondition;
     if (patternToCache != null)
     {
         cacheRequest.Add(patternToCache);
     }
     else
     {
         cacheRequest.Add(SelectionPattern.Pattern);
         cacheRequest.Add(WindowPattern.Pattern);
         cacheRequest.Add(InvokePattern.Pattern);
         cacheRequest.Add(TogglePattern.Pattern);
         cacheRequest.Add(ExpandCollapsePattern.Pattern);
         cacheRequest.Add(ValuePattern.Pattern);
         cacheRequest.Add(SelectionItemPattern.Pattern);
     }
     if (propertyToCache != null)
     {
         cacheRequest.Add(propertyToCache);
     }
     else
     {
         cacheRequest.Add(AutomationElement.NameProperty);
         cacheRequest.Add(AutomationElement.AutomationIdProperty);
         cacheRequest.Add(AutomationElement.ClassNameProperty);
         cacheRequest.Add(AutomationElement.ControlTypeProperty);
     }
     AutomationElement updatedElement;
     using (cacheRequest.Activate())
     {
         updatedElement = mainWidow.GetUpdatedCache(cacheRequest);
     }
     return updatedElement;
 }
예제 #2
0
 private static void DumpValuesRecursive(AutomationElement element, int indent)
 {
     DumpElement(element.GetUpdatedCache(new CacheRequest()), indent);
       foreach (AutomationElement child in element.CachedChildren)
      DumpValuesRecursive(child, indent + 2);
 }