当前位置: 首页>>代码示例>>C#>>正文


C# IUiElement.GetSourceElement方法代码示例

本文整理汇总了C#中IUiElement.GetSourceElement方法的典型用法代码示例。如果您正苦于以下问题:C# IUiElement.GetSourceElement方法的具体用法?C# IUiElement.GetSourceElement怎么用?C# IUiElement.GetSourceElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IUiElement的用法示例。


在下文中一共展示了IUiElement.GetSourceElement方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveAutomationEventHandler

 public void RemoveAutomationEventHandler(classic.AutomationEvent eventId, IUiElement element, classic.AutomationEventHandler eventHandler)
 {
     classic.Automation.RemoveAutomationEventHandler(
         eventId,
         element.GetSourceElement() as classic.AutomationElement,
         eventHandler);
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:7,代码来源:UiaAutomation.cs

示例2: AddAutomationPropertyChangedEventHandler

 public void AddAutomationPropertyChangedEventHandler(IUiElement element, classic.TreeScope scope, classic.AutomationPropertyChangedEventHandler eventHandler, params classic.AutomationProperty[] properties)
 {
     classic.Automation.AddAutomationPropertyChangedEventHandler(
         element.GetSourceElement() as classic.AutomationElement,
         scope,
         eventHandler,
         properties);
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:8,代码来源:UiaAutomation.cs

示例3: AddAutomationEventHandler

 public void AddAutomationEventHandler(classic.AutomationEvent eventId, IUiElement element, classic.TreeScope scope, classic.AutomationEventHandler eventHandler)
 {
     classic.Automation.AddAutomationEventHandler(
         eventId,
         element.GetSourceElement() as classic.AutomationElement,
         scope,
         eventHandler);
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:8,代码来源:UiaAutomation.cs

示例4: RangeFromChild

        public virtual classic.Text.TextPatternRange RangeFromChild(IUiElement childElement)
        {
//            if (childElement == null) {
//                throw new ArgumentNullException("childElement");
//            }
//            SafeTextRangeHandle hTextRange = UiaCoreApi.TextPattern_RangeFromChild(this._hPattern, childElement.RawNode);
//            return TextPatternRange.Wrap(hTextRange, this);
            // 20140102
            // return this._textPattern.RangeFromChild(childElement.GetSourceElement());
            return _textPattern.RangeFromChild(childElement.GetSourceElement() as classic.AutomationElement);
        }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:11,代码来源:UiaTextPattern.cs

示例5: GetAutomationElementsChildren

 protected void GetAutomationElementsChildren(IUiElement inputObject, bool firstChild)
 {
     if (!CheckAndPrepareInput(this)) { return; }
     
     var walker = 
         new classic.TreeWalker(
             classic.Condition.TrueCondition);
     
     IUiElement sibling =
         firstChild ?
             AutomationFactory.GetUiElement(walker.GetFirstChild(inputObject.GetSourceElement() as classic.AutomationElement)) :
                 AutomationFactory.GetUiElement(walker.GetLastChild(inputObject.GetSourceElement() as classic.AutomationElement));
     
     WriteObject(this, sibling);
 }
开发者ID:universsky,项目名称:STUPS,代码行数:15,代码来源:GetControlCollectionCmdletBase.cs

示例6: GetAutomationElementsWithWalker

        private List<IUiElement> GetAutomationElementsWithWalker(
            IUiElement element,
            string name,
            string automationId,
            string className,
            string[] controlType,
            bool caseSensitive,
            bool onlyOneResult,
            bool onlyTopLevel)
        {
            var resultCollection = new List<IUiElement>();
            
            var walker = 
                new classic.TreeWalker(
                    classic.Condition.TrueCondition);
            
            try {
                
                IUiElement oneMoreElement = AutomationFactory.GetUiElement(walker.GetFirstChild(element.GetSourceElement() as classic.AutomationElement));
                
                resultCollection = ProcessAutomationElement(
                        oneMoreElement,
                        name,
                        automationId,
                        className,
                        controlType,
                        caseSensitive,
                        onlyOneResult,
                        onlyTopLevel);

                if ((onlyTopLevel || onlyOneResult) && (null != resultCollection) && resultCollection.Count > 0) {

                    return resultCollection;

                } else if (null != resultCollection) {

                    WriteObject(this, resultCollection);
                }
                
                while (oneMoreElement != null) {
                    
                    oneMoreElement = AutomationFactory.GetUiElement(walker.GetNextSibling(oneMoreElement.GetSourceElement() as classic.AutomationElement));
                    
                    resultCollection = ProcessAutomationElement(
                        oneMoreElement,
                        name,
                        automationId,
                        className,
                        controlType,
                        caseSensitive,
                        onlyOneResult,
                        onlyTopLevel);

                    if ((onlyTopLevel || onlyOneResult) && (null != resultCollection) && resultCollection.Count > 0) {

                        return resultCollection;

                    } else if (null != resultCollection) {

                        WriteObject(this, resultCollection);
                    }
                }
            }
            catch {}
            
            walker = null;
            
            return resultCollection;
        }
开发者ID:universsky,项目名称:STUPS,代码行数:69,代码来源:GetControlCollectionCmdletBase.cs

示例7: getCodeFromAutomationElement

        private string getCodeFromAutomationElement(
            // 20131109
            //IUiElement element,
            IUiElement element,
            TreeWalker walker)
        {
            string result = string.Empty;
            
            // 20140312
//            string elementControlType =
//                element.Current.ControlType.ProgrammaticName.Substring(
//                    element.Current.ControlType.ProgrammaticName.IndexOf('.') + 1);
            string elementControlType =
                element.GetCurrent().ControlType.ProgrammaticName.Substring(
                    element.GetCurrent().ControlType.ProgrammaticName.IndexOf('.') + 1);
            
            // in case this element is an upper-level Pane
            // residing directrly under the RootElement
            // change type to window
            // i.e. Get-UiaPane - >  Get-UiaWindow
            // since Get-UiaPane is unable to get something more than
            // a window's child pane control
            if (elementControlType == "Pane" || elementControlType == "Menu") {
                // 20131109
                //if (walker.GetParent(element) == AutomationElement.RootElement) {
                // 20131118
                // property to method
                //if ((new UiElement(walker.GetParent(element.SourceElement))) == UiElement.RootElement) {
                // 20140102
                // if (Equals(new UiElement(walker.GetParent(element.GetSourceElement())), UiElement.RootElement)) {
                if (Equals(new UiElement(walker.GetParent(element.GetSourceElement() as AutomationElement)), UiElement.RootElement)) {
                    elementControlType = "Window";
                }
                /*
                if ((new UiElement(walker.GetParent(element.GetSourceElement()))) == UiElement.RootElement) {
                    elementControlType = "Window";
                }
                 */
            }
            
            string elementVerbosity =
                @"Get-Uia" + elementControlType;
            // 20140312
//            try {
//                if (element.Current.AutomationId.Length > 0) {
//                    elementVerbosity += (" -AutomationId '" + element.Current.AutomationId + "'");
//                }
//            }
//            catch {
//            }
//            try {
//                if (element.Current.ClassName.Length > 0) {
//                    elementVerbosity += (" -Class '" + element.Current.ClassName + "'");
//                }
//            }
//            catch {
//            }
//            try {
//                if (element.Current.Name.Length > 0) {
//                    elementVerbosity += (" -Name '" + element.Current.Name + "'");
//                }
//            }
//            catch {
//            }
            try {
                if (element.GetCurrent().AutomationId.Length > 0) {
                    elementVerbosity += (" -AutomationId '" + element.GetCurrent().AutomationId + "'");
                }
            }
            catch {
            }
            try {
                if (element.GetCurrent().ClassName.Length > 0) {
                    elementVerbosity += (" -Class '" + element.GetCurrent().ClassName + "'");
                }
            }
            catch {
            }
            try {
                if (element.GetCurrent().Name.Length > 0) {
                    elementVerbosity += (" -Name '" + element.GetCurrent().Name + "'");
                }
            }
            catch {
            }
            
            result = elementVerbosity;
            return result;
        }
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:89,代码来源:SpyForm.cs

示例8: RemoveStructureChangedEventHandler

 public void RemoveStructureChangedEventHandler(IUiElement element, classic.StructureChangedEventHandler eventHandler)
 {
     classic.Automation.RemoveStructureChangedEventHandler(
         element.GetSourceElement() as classic.AutomationElement,
         eventHandler);
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:6,代码来源:UiaAutomation.cs

示例9: AddStructureChangedEventHandler

 public void AddStructureChangedEventHandler(IUiElement element, classic.TreeScope scope, classic.StructureChangedEventHandler eventHandler)
 {
     classic.Automation.AddStructureChangedEventHandler(
         element.GetSourceElement() as classic.AutomationElement,
         scope,
         eventHandler);
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:7,代码来源:UiaAutomation.cs

示例10: RemoveAutomationPropertyChangedEventHandler

 public void RemoveAutomationPropertyChangedEventHandler(IUiElement element, classic.AutomationPropertyChangedEventHandler eventHandler)
 {
     classic.Automation.RemoveAutomationPropertyChangedEventHandler(
         element.GetSourceElement() as classic.AutomationElement,
         eventHandler);
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:6,代码来源:UiaAutomation.cs

示例11: Compare

 public bool Compare(IUiElement el1, IUiElement el2)
 {
     return classic.Automation.Compare(el1.GetSourceElement() as classic.AutomationElement, el2.GetSourceElement() as classic.AutomationElement);
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:4,代码来源:UiaAutomation.cs


注:本文中的IUiElement.GetSourceElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。