• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Automation.ControlType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ControlType类属于System.Windows.Automation命名空间,在下文中一共展示了ControlType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FindChildByControlType

        public static AutomationElement FindChildByControlType(this AutomationElement element, ControlType controlType)
        {
            AutomationElement result =
                element.FindChildByCondition(new PropertyCondition(AutomationElement.ControlTypeProperty, controlType));

            return result;
        }
开发者ID:GraemeF,项目名称:Fluid,代码行数:7,代码来源:AutomationExtensions.cs


示例2: FindElementByNameFilteredByControlTypeAndMouseClick

 /// <summary>
 /// Get automationelement by name, filtered by classname - mouse click if found
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="automationName">case-insensitive automation name</param>
 /// <param name="controlType"></param>
 /// <param name="controlType2"></param>
 /// <exception cref="ApplicationException">if matching element not found</exception>
 /// <exception cref="ApplicationException">if specified element is not enabled</exception>
 public static void FindElementByNameFilteredByControlTypeAndMouseClick(AutomationElement parent, string automationName, ControlType controlType, ControlType controlType2, TimeSpan mouseClickDelay, TreeScope treeScope)
 {
     FindElementByNameFilteredByControlTypeWithTimeoutAndMouseClick(parent, automationName, controlType, controlType2,
             AddinTestUtility.FindRibbonButtonsTimeout, //findDelay
             mouseClickDelay,
             treeScope);
 }
开发者ID:brogersyh,项目名称:.NET-WindowsUI-AutomationElementsTest,代码行数:16,代码来源:UIAUtility.cs


示例3: TestParametersAgainstCollection

        private void TestParametersAgainstCollection(
            ControlType controlType,
            string searchString,
            IEnumerable<IUiElement> collection,
            int expectedNumberOfElements)
        {
            // Arrange
            string controlTypeString = string.Empty;
            if (null != controlType) {
                controlTypeString = controlType.ProgrammaticName.Substring(12);
            }
            
            GetControlCmdletBase cmdlet =
                FakeFactory.Get_GetControlCmdletBase(controlType, searchString);
            Condition condition =
                ControlSearcher.GetTextSearchCondition(searchString, new string[]{ controlTypeString }, false);
            IUiElement element =
                FakeFactory.GetElement_ForFindAll(
                    collection,
                    condition);
            
            // Act
            var resultList = RealCodeCaller.GetResultList_TextSearch(element, condition);
            
            // Assert
            MbUnit.Framework.Assert.Count(expectedNumberOfElements, resultList);
            Xunit.Assert.Equal(expectedNumberOfElements, resultList.Count);
            if (!string.IsNullOrEmpty(searchString)) {
                MbUnit.Framework.Assert.ForAll(
                    resultList.Cast<IUiElement>().ToList<IUiElement>(),
                    // 20140312
//                    x => x.Current.Name == searchString || x.Current.AutomationId == searchString || x.Current.ClassName == searchString ||
                    x => x.GetCurrent().Name == searchString || x.GetCurrent().AutomationId == searchString || x.GetCurrent().ClassName == searchString ||
                    (null != (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern) && (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern).Current.Value == searchString));
                /*
                (null != (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern) ? 
                     // (x.GetCurrentPattern<IValuePattern, ValuePattern>(ValuePattern.Pattern) as IValuePattern).Current.Value == searchString : 
                     (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern).Current.Value == searchString : 
                     false));
                */
            }
//            if (null != controlType) {
//                MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => x.Current.ControlType == controlType);
//            }
            
            Xunit.Assert.Equal(expectedNumberOfElements, resultList.Count);
            if (!string.IsNullOrEmpty(searchString)) {
                resultList.All(
                    // 20140312
                    // x => x.Current.Name == searchString || x.Current.AutomationId == searchString || x.Current.ClassName == searchString ||
                    x => x.GetCurrent().Name == searchString || x.GetCurrent().AutomationId == searchString || x.GetCurrent().ClassName == searchString ||
                    (null != (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern) && (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern).Current.Value == searchString));
                /*
                (null != (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern) ?
                     (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern).Current.Value == searchString :
                     false));
                */
            }
            
        }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:60,代码来源:SearchByContainsTextViaUiaTextFixture.cs


示例4: ThrowInvalidOperationExceptionIfNotOf

 public static AutomationElement ThrowInvalidOperationExceptionIfNotOf(this AutomationElement automationElement, ControlType controlType)
 {
     if (!automationElement.Current.ControlType.Equals(controlType))
         throw new InvalidOperationException(string.Format("The AutomationElement provided has the ControlType '{0}', which is not a '{1}'.", 
                                                           automationElement.Current.ControlType, controlType));
     return automationElement;
 }
开发者ID:NeilRobbins,项目名称:Silverlight.Driver,代码行数:7,代码来源:AutomationElementExtensions.cs


示例5: getAutomationElement

        public static AutomationElement getAutomationElement(AutomationElement parent, TreeScope scope, ControlType type, string name)
        {
            var element = parent.FindFirst(scope, new AndCondition(
                new PropertyCondition(AutomationElement.ControlTypeProperty, type),
                new PropertyCondition(AutomationElement.NameProperty, name),
                Automation.ControlViewCondition));

            return element;
        }
开发者ID:xia-sava,项目名称:PVCtrl,代码行数:9,代码来源:PvCtrlUtil.cs


示例6: FindFirstAncestorByControlType

 public static AutomationElement FindFirstAncestorByControlType(this AutomationElement ae, ControlType className)
 {
     var ancestor = TreeWalker.ControlViewWalker.GetParent(ae);
      for (; ancestor != null && className != ancestor.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty);
     ancestor = TreeWalker.ControlViewWalker.GetParent(ancestor))
      {
      }
      return ancestor;
 }
开发者ID:softek,项目名称:WinUIScraper,代码行数:9,代码来源:AutomationExtensions.cs


示例7: FindWindowByName

        public static AutomationElement FindWindowByName(AutomationElement rootElement, string name, ControlType type)
        {
            PropertyCondition nameCondition = new PropertyCondition(AutomationElement.NameProperty, name);

            PropertyCondition typeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, type);

            AndCondition andCondition = new AndCondition(nameCondition, typeCondition);

            return rootElement.FindFirst(TreeScope.Element | TreeScope.Descendants, andCondition);
        }
开发者ID:tankxiao,项目名称:tankproject,代码行数:10,代码来源:AutomationBuild.cs


示例8: FindElementById

        public static AutomationElement FindElementById(AutomationElement parentElement, string automationID, ControlType type)
        {
            PropertyCondition typeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, type);

            PropertyCondition IDCondition = new PropertyCondition(AutomationElement.AutomationIdProperty, automationID);

            AndCondition andCondition = new AndCondition(typeCondition, IDCondition);

            return parentElement.FindFirst(TreeScope.Element | TreeScope.Descendants, andCondition);
        }
开发者ID:tankxiao,项目名称:tankproject,代码行数:10,代码来源:AutomationBuild.cs


示例9: ByTypeAndName

        public static Condition ByTypeAndName(ControlType type, String name)
        {
            Condition[] locators =
            {
                new PropertyCondition(AutomationElement.NameProperty, name),
                new PropertyCondition(AutomationElement.ControlTypeProperty, type)
            };

            return new AndCondition(locators);
        }
开发者ID:mkolisnyk,项目名称:Sirius,代码行数:10,代码来源:CustomConditions.cs


示例10: FindElementByClassName

        public static AutomationElementCollection FindElementByClassName(AutomationElement parentElement, string className, ControlType type)
        {
            PropertyCondition typeCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, type);

            PropertyCondition IDCondition = new PropertyCondition(AutomationElement.ClassNameProperty, className);

            AndCondition andCondition = new AndCondition(typeCondition, IDCondition);

            return parentElement.FindAll(TreeScope.Element | TreeScope.Descendants, andCondition);
        }
开发者ID:tankxiao,项目名称:tankproject,代码行数:10,代码来源:AutomationBuild.cs


示例11: FindInDepth

 public static AutomationElement FindInDepth(this AutomationElement root, ControlType type, int levels)
 {
     AutomationElement result = root;
     for (int i = 0; i < levels; i++)
     {
         Thread.Sleep(100);
         result = result.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, type));
     }
     return result;
 }
开发者ID:modulexcite,项目名称:Tx,代码行数:10,代码来源:AutomationElementExtensions.cs


示例12: ControlDictionaryItem

 public ControlDictionaryItem(Type testControlType, ControlType controlType, string className, bool identifiedByClassName, bool isPrimary,
                              bool isExcluded, string frameworkId, bool hasPrimaryChildren)
 {
     this.testControlType = testControlType;
     this.controlType = controlType;
     this.className = className;
     this.identifiedByClassName = identifiedByClassName;
     this.isPrimary = isPrimary;
     this.isExcluded = isExcluded;
     this.frameworkId = frameworkId;
     this.hasPrimaryChildren = hasPrimaryChildren;
 }
开发者ID:tmandersson,项目名称:FastGTD,代码行数:12,代码来源:ControlDictionaryItem.cs


示例13: SetTextValue

 public int SetTextValue(String windowName, String objName, String value)
 {
     AutomationElement childHandle = GetObjectHandle(windowName,
         objName);
     if (!utils.IsEnabled(childHandle))
     {
         childHandle = null;
         throw new XmlRpcFaultException(123,
             "Object state is disabled");
     }
     object valuePattern = null;
     try
     {
         if (childHandle.Current.ControlType == ControlType.ComboBox)
         {
             AutomationElement o = null;
             ArrayList objectList = new ArrayList();
             ControlType[] type = new ControlType[1] { ControlType.Edit };
             // NOTE: Using "*" for object name, which returns the first
             // matching Edit control type
             o = utils.InternalGetObjectHandle(childHandle,
                 "*", type, ref objectList);
             if (o != null)
                 childHandle = o;
             objectList = null;
         }
         // Reference: http://msdn.microsoft.com/en-us/library/ms750582.aspx
         if (!childHandle.TryGetCurrentPattern(ValuePattern.Pattern,
             out valuePattern))
         {
             childHandle.SetFocus();
             SendKeys.SendWait(value);
         }
         else
             ((ValuePattern)valuePattern).SetValue(value);
     }
     catch (Exception ex)
     {
         LogMessage(ex);
         if (ex is XmlRpcFaultException)
             throw;
         else
             throw new XmlRpcFaultException(123,
                 "Unhandled exception: " + ex.Message);
     }
     finally
     {
         childHandle = null;
         valuePattern = null;
     }
     return 1;
 }
开发者ID:boomuuh,项目名称:cobra-winldtp,代码行数:52,代码来源:Text.cs


示例14: GetChildElement

 /// <summary>
 /// This method gets the list of ChildElements of the control type in the Window.
 /// </summary>
 /// <param name="type">Control type</param>       
 public static bool GetChildElement(ControlType type)
 {
     try
     {
         CommonHelperMethods.GetElement(AutomationElement.RootElement, type);
         return true;
     }
     catch (ElementNotAvailableException ex)
     {
         Console.WriteLine(ex);
         return false;
     }
 }
开发者ID:hxhlb,项目名称:wwt-tile-sdk,代码行数:17,代码来源:SharingServiceTestCases.cs


示例15: GetObjectHandle

 private AutomationElement GetObjectHandle(string windowName,
     string objName)
 {
     ControlType[] type = new ControlType[1] { ControlType.ScrollBar };
     try
     {
         return utils.GetObjectHandle(windowName, objName, type);
     }
     finally
     {
         type = null;
     }
 }
开发者ID:boomuuh,项目名称:cobra-winldtp,代码行数:13,代码来源:Scrollbar.cs


示例16: GetObjectHandle

 private AutomationElement GetObjectHandle(string windowName,
     string objName)
 {
     ControlType[] type = new ControlType[3] { ControlType.ComboBox,
         ControlType.ListItem, ControlType.List/*, ControlType.Text */ };
     try
     {
         return utils.GetObjectHandle(windowName, objName, type);
     }
     finally
     {
         type = null;
     }
 }
开发者ID:boomuuh,项目名称:cobra-winldtp,代码行数:14,代码来源:Combobox.cs


示例17: GetElement

 /// <summary>
 /// This method returns an element searched by its control type from the tree.
 /// </summary>
 /// <param name="root">Root Element of the control</param>
 /// <param name="controlType">Control Type of the element</param>
 /// <returns>Automation Element of teh control</returns>
 public static AutomationElement GetElement(AutomationElement root, ControlType controlType)
 {
     if (root == null)
     {
         throw new ArgumentNullException("root");
     }
     if (controlType == null)
     {
         throw new ArgumentNullException("controlType");
     }
     else
     {
         PropertyCondition condType = new PropertyCondition(AutomationElement.ControlTypeProperty, controlType);
         return root.FindFirst(TreeScope.Descendants, condType);
     }
 }
开发者ID:hxhlb,项目名称:wwt-tile-sdk,代码行数:22,代码来源:CommonHelperMethods.cs


示例18: GetObjectHandle

 private AutomationElement GetObjectHandle(string windowName,
     string objName)
 {
     // Pane added for a bug in QT
     // Ref: https://cobra.codeplex.com/discussions/450296
     ControlType[] type = new ControlType[4] { ControlType.Edit,
         ControlType.Document, ControlType.ComboBox, ControlType.Pane };
     try
     {
         return utils.GetObjectHandle(windowName, objName, type);
     }
     finally
     {
         type = null;
     }
 }
开发者ID:boomuuh,项目名称:cobra-winldtp,代码行数:16,代码来源:Text.cs


示例19: DoesRowExist

 public int DoesRowExist(String windowName, String objName,
     String text, bool partialMatch = false)
 {
     if (String.IsNullOrEmpty(text))
     {
         LogMessage("Argument cannot be empty.");
         return 0;
     }
     ControlType[] type;
     AutomationElement childHandle;
     AutomationElement elementItem;
     try
     {
         childHandle = GetObjectHandle(windowName,
             objName, null, false);
         if (!utils.IsEnabled(childHandle))
         {
             childHandle = null;
             LogMessage("Object state is disabled");
             return 0;
         }
         childHandle.SetFocus();
         type = new ControlType[4] { ControlType.TreeItem,
             ControlType.ListItem, ControlType.DataItem,
             ControlType.Custom };
         if (partialMatch)
             text += "*";
         elementItem = utils.GetObjectHandle(childHandle,
             text, type, false);
         if (elementItem != null)
         {
             return 1;
         }
     }
     catch (Exception ex)
     {
         LogMessage(ex);
     }
     finally
     {
         type = null;
         childHandle = elementItem = null;
     }
     return 0;
 }
开发者ID:Chingliu,项目名称:cobra,代码行数:45,代码来源:Tree.cs


示例20: GetObjectHandle

 private AutomationElement GetObjectHandle(string windowName,
     string objName, ControlType[] type = null, bool waitForObj = true)
 {
     if (type == null)
         type = new ControlType[6] { ControlType.Tree,
             ControlType.List, ControlType.Table,
             ControlType.DataItem, ControlType.ListItem,
             ControlType.TreeItem };
     try
     {
         return utils.GetObjectHandle(windowName,
             objName, type, waitForObj);
     }
     finally
     {
         type = null;
     }
 }
开发者ID:boomuuh,项目名称:cobra-winldtp,代码行数:18,代码来源:Tree.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Automation.PropertyCondition类代码示例发布时间:2022-05-26
下一篇:
C# Automation.CacheRequest类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap