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


C# AutomationElement.FindChildByControlTypeAndName方法代码示例

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


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

示例1: Find

        public static GuiFileDialog Find(AutomationElement window, string caption)
        {
            AutomationElement dlg = null;
            //* Works fine on Windows 8.1, but not on Windows 7 with only .Net 4.0 installed.
            // * We need to retest this after upgrading to .Net 4.6
            int maxRetries = 120;
            while (dlg == null && maxRetries > 0) {
                try {
                    //dlg = window.FindChildByLocalizedControlTypeAndName(caption, AutomationExtensions.DialogLocalizedControlNameOptions); //different name options on different language settings
                    dlg = window.FindChildByControlTypeAndName(ControlType.Window, caption);
                } catch (Exception) {
                    if (maxRetries <= 0)
                        throw;
                }
                if (dlg == null && maxRetries % 10 == 0) {
                    Log.DebugFormat("File dialog not found: {0}   Caption: {1}", maxRetries, caption);
                }
                Thread.Sleep(500);
                maxRetries--;
            }
            //*/

            //Until this method gets reworked, let developer-machines sleep for 6 seconds instead of 60, for faster testing
            /*
            if (ApplicationLauncher.VerifyOnDeveloperMachine()) {
                Thread.Sleep(6000);
            } else {
                Thread.Sleep(60000);
            }
             */
            return new GuiFileDialog(dlg, window, caption);
        }
开发者ID:ThetaDev,项目名称:clicktest,代码行数:32,代码来源:GuiFileDialog.cs

示例2: GetButton

 public static GuiButton GetButton(AutomationElement window, string name)
 {
     AutomationElement res;
     if (name == "Close")
         res = window.FindChildByControlTypeAndAutomationIdAndName(ControlType.Button, "button", name);
     else
         res = window.FindChildByControlTypeAndName(ControlType.Button, name);
     return new GuiButton(res, name);
 }
开发者ID:gouzhiyuan,项目名称:clicktest,代码行数:9,代码来源:GuiButton.cs

示例3: GetTabByName

 public static GuiTabItem GetTabByName(AutomationElement parentWindow, string name)
 {
     if (_cachedTab == null || _cachedTab.AutomationId != name) {
         var res = parentWindow.FindChildByControlTypeAndName(ControlType.TabItem, name);
         _cachedTab = new GuiTabItem(res, name);
         _currentParentWindow = parentWindow;
     }
     return _cachedTab;
 }
开发者ID:ThetaDev,项目名称:clicktest,代码行数:9,代码来源:GuiTabItem.cs

示例4: GetMenuItem

 public static GuiMenuItem GetMenuItem(AutomationElement window, string name)
 {
     AutomationElement res;
     if (name == "Close")
         res = window.FindChildByControlTypeAndAutomationIdAndName(ControlType.MenuItem, "menuitem", name);
     else
         res = window.FindChildByControlTypeAndName(ControlType.MenuItem, name);
     return new GuiMenuItem(res);
 }
开发者ID:gouzhiyuan,项目名称:clicktest,代码行数:9,代码来源:GuiMenuItem.cs

示例5: GetExpander

 public static GuiExpander GetExpander(AutomationElement window, string name)
 {
     AutomationElement res = window.FindChildByControlTypeAndName(ControlType.Group, name);
     return new GuiExpander(res, name);
 }
开发者ID:gouzhiyuan,项目名称:clicktest,代码行数:5,代码来源:GuiExpander.cs

示例6: GetRadioButton

 public static GuiRadioButton GetRadioButton(AutomationElement window, string name)
 {
     AutomationElement res = window.FindChildByControlTypeAndName(ControlType.RadioButton, name);
     return new GuiRadioButton(res);
 }
开发者ID:ThetaDev,项目名称:clicktest,代码行数:5,代码来源:GuiRadioButton.cs

示例7: GetTextBoxByName

 public static GuiTextBox GetTextBoxByName(AutomationElement window, string name)
 {
     if (_cachedtb == null || _cachedtb.Name != name) {
         var tb = window.FindChildByControlTypeAndName(ControlType.Edit, name);
         _cachedtb = new GuiTextBox(tb);
     }
     return _cachedtb;
 }
开发者ID:ThetaDev,项目名称:clicktest,代码行数:8,代码来源:GuiTextBox.cs


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