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


C# TreeScope.ToString方法代码示例

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


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

示例1: AddEventHandler

 /// -------------------------------------------------------------------
 /// <summary>
 /// Method that registers the event handler OnEvent()
 /// </summary>
 /// -------------------------------------------------------------------
 public void AddEventHandler(AutomationElement element, TreeScope treeScope, AutomationProperty[] properties)
 {
     base.AddEventHandler();
     StringBuilder sb = new StringBuilder("[");
     string divider = ", ";
     foreach (AutomationProperty prop in properties)
     {
         sb.Append(prop.ProgrammaticName);
         sb.Append(divider);
     }
     if (sb.Length > 0)
     {
         sb.Remove(sb.Length - divider.Length, divider.Length).Append("]");
     }
     Comment("Adding AddAutomationPropertyChangedEventHandler({0}, TreeScope.{1}, {2}) ControlPath = {3}", Library.GetUISpyLook(element), treeScope.ToString(), sb.ToString(), Helpers.GetXmlPathFromAutomationElement(element));
     handler = new AutomationPropertyChangedEventHandler(OnEvent);
     Automation.AddAutomationPropertyChangedEventHandler(element, treeScope, handler, properties);
 }
开发者ID:geeksree,项目名称:cSharpGeeks,代码行数:23,代码来源:EventHandlers.cs

示例2: GetAutomationElements

        protected void GetAutomationElements(TreeScope scope)
        {
            if (!this.CheckControl(this)) { return; }

            // 20120823
            foreach (AutomationElement inputObject in this.InputObject) {

            System.Collections.Generic.List<AutomationElement >  searchResults =
                new System.Collections.Generic.List<AutomationElement > ();
            AutomationElementCollection temporaryResults = null;
            AutomationElement[] outResult;

            if (scope == TreeScope.Children ||
                scope == TreeScope.Descendants) {
                WriteVerbose(this, "selected TreeScope." + scope.ToString());
                AndCondition[] conditions = getControlsConditions(this);
                if (conditions != null && conditions.Length > 0) {
                    WriteVerbose(this, "conditions number: " +
                                 conditions.Length.ToString());
                    for (int i = 0; i < conditions.Length; i++) {
                        if (conditions[i] != null) {
                            WriteVerbose(this, conditions[i].GetConditions());
                            temporaryResults =
                                // 20120823
                                //this.InputObject.FindAll(scope,
                                inputObject.FindAll(scope,
                                                         conditions[i]);
                            if (temporaryResults.Count > 0) {
                                foreach (AutomationElement element in temporaryResults) {
                                    searchResults.Add(element);
                                }
                            }
                        }
                    }
                } else {
                    WriteVerbose(this, "no conditions. Performing search with TrueCondition");
                    temporaryResults =
                        // 20120823
                        //this.InputObject.FindAll(scope,
                        inputObject.FindAll(scope,
                                                 Condition.TrueCondition);
                    if (temporaryResults.Count > 0) {
                        WriteVerbose(this,
                                     "returned " +
                                     temporaryResults.Count.ToString() +
                                     " results");
                        foreach (AutomationElement element in temporaryResults) {
                            searchResults.Add(element);
                        }
                    }
                }
                WriteVerbose(this, "results found: " + searchResults.Count.ToString());
                WriteObject(this, searchResults.ToArray());
            } // if (scope == TreeScope.Children ||
                //scope == TreeScope.Descendants)
            if (scope == TreeScope.Parent ||
                scope == TreeScope.Ancestors) {
                outResult =
                    // 20120823
                    //UIAHelper.GetParentOrAncestor(this.InputObject, scope);
                    UIAHelper.GetParentOrAncestor(inputObject, scope);
                WriteObject(this, outResult);
            }

            } // 20120823
        }
开发者ID:uiatester,项目名称:STUPS,代码行数:66,代码来源:GetControlCollectionCmdletBase.cs


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