示例#1
0
        public bool TryGetCurrentPattern(AutomationPattern pattern, out object patternObject)
        {
            Validate.ArgumentNotNull(parameter: pattern, parameterName: nameof(pattern));
            var currentPattern = IUIAutomationElement.GetCurrentPattern(patternId: pattern.Id);

            if (currentPattern == null)
            {
                patternObject = null;
                return(false);
            }

            patternObject = pattern.Wrap(element: this, pattern: currentPattern);
            return(true);
        }
示例#2
0
 public object GetCurrentPattern(AutomationPattern pattern)
 {
     Validate.ArgumentNotNull(parameter: pattern, parameterName: nameof(pattern));
     return(pattern.Wrap(element: this, pattern: IUIAutomationElement.GetCurrentPattern(patternId: pattern.Id)));
 }