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


C# AutomationElement.GetSupportedPatterns方法代码示例

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


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

示例1: EmptyTextFromChild

 private void EmptyTextFromChild(AutomationElement element)
 {
     if (element.GetSupportedPatterns().Contains(ValuePattern.Pattern))
     {
         ((ValuePattern)element.GetCurrentPattern(ValuePattern.Pattern)).SetValue(string.Empty);
     }
     else if (element.GetSupportedPatterns().Contains(TextPattern.Pattern))
     {
         TextPatternRange document =
             ((TextPattern)Element.GetCurrentPattern(TextPattern.Pattern)).DocumentRange;
         AutomationElement[] children = document.GetChildren();
         foreach (var child in children)
         {
             EmptyTextFromChild(child);
         }
     }
 }
开发者ID:pako4u2k,项目名称:wipflash,代码行数:17,代码来源:RichTextBox.cs

示例2: CreateDebugHint

        /// <summary>
        /// Creates a debug hint
        /// </summary>
        /// <param name="owningWindow">The window that owns the hint</param>
        /// <param name="hintBounds">The hint bounds</param>
        /// <param name="automationElement">The automation element</param>
        /// <returns>A debug hint</returns>
        private DebugHint CreateDebugHint(IntPtr owningWindow, Rect hintBounds, AutomationElement automationElement)
        {
            var supportedPatterns = automationElement.GetSupportedPatterns();
            var programmaticNames = supportedPatterns.Select(x => x.ProgrammaticName);

            if (supportedPatterns.Any())
            {
                return new DebugHint(owningWindow, hintBounds, programmaticNames.ToList());
            }

            return null;
        }
开发者ID:arizzubair,项目名称:hunt-and-peck,代码行数:19,代码来源:UiAutomationHintProviderService.cs

示例3: PatternChcek

		//Check the patterns that a control must support according to MSDN.
		public void PatternChcek (Element e, AutomationElement ae, AutomationPattern[] addStates, AutomationPattern[] invalidState)
		{
			procedureLogger.Action (string.Format ("Check {0}'s supported patterns.", e));
			
			//Remove the extra patterns from supported patterns list
			for (int i = 0; i < invalidState.Length; i++)
				if(((System.Collections.IList)e.SupportedPatterns).Contains(invalidState [i]))
					e.SupportedPatterns.Remove(invalidState[i]);
					
			//Add necessary patterns to the supported patterns list		
			for (int j = 0; j < addStates.Length; j++)
				e.SupportedPatterns.Add(addStates [j]);

			//Get list of actual patterns of this control
			AutomationPattern[] actualPatterns = ae.GetSupportedPatterns ();
			procedureLogger.ExpectedResult (string.Format ("supported patterns :"));
			for (int k = 0; k < actualPatterns.Length; k++)
				procedureLogger.ExpectedResult (string.Format ("{0} ", actualPatterns [k]));
			
			//get a list of actual patterns that are missing or extraneous
			List<AutomationPattern> missPattern = new List<AutomationPattern>();
			List<AutomationPattern> extraPattern = new List<AutomationPattern>();
			for (int p = 0; p < e.SupportedPatterns.Count; p++)
				if(!(actualPatterns.Contains (e.SupportedPatterns[p])))
					missPattern.Add(e.SupportedPatterns[p]);

			for (int q = 0; q < actualPatterns.Length; q++)
				if(!(e.SupportedPatterns.Contains (actualPatterns[q])))
					extraPattern.Add(actualPatterns[q]);

			//If missingPatterns and extraPatterns are empty, the test case passes
			//otherwise, throw an exception
			if(0 != missPattern.Count)
					Console.WriteLine("Missing miss actions: ");
					for (int n = 0; n < missPattern.Count; n++)
						Console.WriteLine(" {0}", missPattern[n]);	
			Assert.AreEqual(0, missPattern.Count);
				
			if(0 != actualPatterns.Length)
					Console.WriteLine("Missing actual actions: ");
					for (int m = 0; m < actualPatterns.Length; m++)
						Console.WriteLine(" {0}", actualPatterns[m]);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:44,代码来源:Helper.cs

示例4: FindFirstChildWithValuePatternSupported

 private AutomationElement FindFirstChildWithValuePatternSupported(AutomationElement element)
 {
     if (element.GetSupportedPatterns().Contains(ValuePattern.Pattern))
     {
         return element;
     }
     if (element.GetSupportedPatterns().Contains(TextPattern.Pattern))
     {
         TextPatternRange document =
             ((TextPattern)Element.GetCurrentPattern(TextPattern.Pattern)).DocumentRange;
         AutomationElement[] children = document.GetChildren();
         foreach (var child in children)
         {
             var firstValidChild = FindFirstChildWithValuePatternSupported(child);
             if (firstValidChild != null) { return firstValidChild; }
         }
     }
     return null;
 }
开发者ID:pako4u2k,项目名称:wipflash,代码行数:19,代码来源:RichTextBox.cs

示例5: SetPatterns

 /// -------------------------------------------------------------------
 /// <summary></summary>
 /// -------------------------------------------------------------------
 internal void SetPatterns(AutomationElement element)
 {
     if (element == null)
         return;
     foreach (AutomationPattern ap in element.GetSupportedPatterns())
     {
         Comment("Element supports pattern: " + Automation.PatternName(ap).ToString());
         m_cachedPatternList.Add(element.GetCurrentPattern(ap));
     }
 }
开发者ID:geeksree,项目名称:cSharpGeeks,代码行数:13,代码来源:PatternObject.cs

示例6: AutomationElementGetSupportedPatterns

 public static void AutomationElementGetSupportedPatterns(AutomationElement element)
 {
     Dump("GetSupportedPatterns()", true, element);
     try
     {
         AutomationPattern[] obj = element.GetSupportedPatterns();
     }
     catch (Exception exception)
     {
         VerifyException(element, exception, typeof(ElementNotAvailableException));
     }
 }
开发者ID:geeksree,项目名称:cSharpGeeks,代码行数:12,代码来源:stress.cs

示例7: writingAvailablePatterns

        private void writingAvailablePatterns(AutomationElement element)
        {
            try {
                this.richPatterns.Text = "available patterns";
                this.richPatterns.Text += "\r\n";

                // 20120618 UIACOMWrapper
                AutomationPattern[] supportedPatterns =
                    element.GetSupportedPatterns();
                //UIACOM::System.Windows.Automation.AutomationPattern[] supportedPatterns =
                //    element.GetSupportedPatterns();

                if (supportedPatterns != null &&
                    supportedPatterns.Length > 0) {
                    for (int i = 0; i < supportedPatterns.Length; i++) {
                        if (i > 0) {
                            this.richPatterns.Text += "\r\n";
                        }
                        this.richPatterns.Text +=
                            supportedPatterns[i].ProgrammaticName.Replace("Identifiers.Pattern", "");
                    }
                }
            }
            catch {}
        }
开发者ID:uiatester,项目名称:STUPS,代码行数:25,代码来源:SpyForm.cs

示例8: DisplayPattern

 private static void DisplayPattern(AutomationElement automationElement, StringBuilder stringBuilder, string displayPadding)
 {
     AutomationPattern[] supportedPatterns = automationElement.GetSupportedPatterns();
     foreach (AutomationPattern automationPattern in supportedPatterns)
     {
         var pattern = (BasePattern) automationElement.GetCurrentPattern(automationPattern);
         stringBuilder.Append(displayPadding).AppendLine(pattern.ToString());
     }
     stringBuilder.AppendLine();
 }
开发者ID:ritro,项目名称:White,代码行数:10,代码来源:Debug.cs

示例9: getBestPattern

 /// <summary>
 /// Gets the most useful pattern from the element to use in the test path.
 /// </summary>
 /// <param name="rootElement"></param>
 /// <returns></returns>
 private string getBestPattern(AutomationElement rootElement)
 {
     string pathImage = "";
     AutomationPattern[] aps = rootElement.GetSupportedPatterns();
     if (aps.Length == 0) pathImage += "none";
     else if (aps.Length == 1) pathImage += aps[0].ProgrammaticName;
     else
     {
         string best = "";
         int bestWeight = 9999;
         foreach (AutomationPattern ap in aps)
         {
             int ind = ap.Id - 10000;
             int w = bestPattern[ind];
             if (w < bestWeight)
             {
                 bestWeight = w;
                 best = ap.ProgrammaticName;
             }
         }
         pathImage = best;
     }
     return pathImage.Replace("Pattern", null).Replace("Identifiers.", null) + ":";
 }
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:29,代码来源:UiAutoPath.xaml.cs

示例10: SupportsValuePattern

        private ValuePattern SupportsValuePattern(AutomationElement ae)
        {
            try
            {
                ValuePattern valpat = (ValuePattern)ae.GetCurrentPattern(ValuePattern.Pattern);
                AutomationPattern[] p1 = ae.GetSupportedPatterns();
                logTofile(_eLogPtah, "patterns lenght for ae =" + p1.Length);
                //for (int jj = 0; jj < p1.Length; jj++)
                //{
                // }

                return valpat;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
                //  return null;
            }
        }
开发者ID:prasannarhegde2015,项目名称:EJcehck2,代码行数:19,代码来源:UIAutomation.cs

示例11: RetrieveTextFrom

 private string RetrieveTextFrom(AutomationElement element)
 {
     string text = string.Empty;
     if (element.GetSupportedPatterns().Contains(ValuePattern.Pattern))
     {
         text = text + new ValuePatternWrapper(element).Value;
     }
     else if (element.GetSupportedPatterns().Contains(TextPattern.Pattern))
     {
         TextPatternRange document =
             ((TextPattern)Element.GetCurrentPattern(TextPattern.Pattern)).DocumentRange;
         AutomationElement[] children = document.GetChildren();
         foreach (var child in children)
         {
             text = text + RetrieveTextFrom(child);
         }
     }
     return text;
 }
开发者ID:pako4u2k,项目名称:wipflash,代码行数:19,代码来源:RichTextBox.cs

示例12: GetSpecifiedPattern

    private static AutomationPattern GetSpecifiedPattern(AutomationElement element, string patternName)
    {
        AutomationPattern[] supportedPattern = element.GetSupportedPatterns();
        foreach (AutomationPattern pattern in supportedPattern)
        {
            if (pattern.ProgrammaticName == patternName)
                return pattern;
        }

        return null;
    }
开发者ID:nilmarpublio,项目名称:jawiweb,代码行数:11,代码来源:Flexisign.cs

示例13: SupportedPropertiesTestInternal

		private void SupportedPropertiesTestInternal (AutomationElement element)
		{
			var supportedProperties = element.GetSupportedProperties ();
			foreach (AutomationPattern pattern in element.GetSupportedPatterns ()) {
				foreach (var prop in GetPatternProperties (pattern)) {
					Assert.IsTrue (supportedProperties.Contains (prop),
						string.Format ("[{0}] {1} shall be supported since {2} pattern is supported",
							element.Current.Name,
							prop.ProgrammaticName,
							At.PatternName (pattern)));
				}
			}
			foreach (var prop in supportedProperties) {
				Assert.AreNotEqual (AutomationElement.NotSupported,
					element.GetCurrentPropertyValue (prop, true),
					string.Format ("[{0}] {1} shall be supported since it's in SupportedProperties",
						element.Current.Name,
						prop.ProgrammaticName));
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:20,代码来源:AutomationElementTest.cs


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