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


C# IRawElementProviderSimple.GetPatternProvider方法代码示例

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


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

示例1: MenuItem

		public MenuItem (IRawElementProviderSimple provider) : base (provider)
		{
			if (provider == null)
				throw new ArgumentNullException ("provider");

			if ((provider as IRawElementProviderFragment) == null)
				throw new ArgumentException ("Provider for ParentMenu should be IRawElementProviderFragment");

			textExpert = TextImplementorFactory.GetImplementor (this, provider);

			Role = Atk.Role.MenuItem;

			string name = (string) provider.GetPropertyValue (AutomationElementIdentifiers.NameProperty.Id);
			if (!String.IsNullOrEmpty (name))
				Name = name;

			invokeProvider = (IInvokeProvider)
				provider.GetPatternProvider (InvokePatternIdentifiers.Pattern.Id);
			toggleProvider = (IToggleProvider)
				provider.GetPatternProvider (TogglePatternIdentifiers.Pattern.Id);
			selectionItemProvider = (ISelectionItemProvider)
				provider.GetPatternProvider (SelectionItemPatternIdentifiers.Pattern.Id);
			expandCollapseProvider = (IExpandCollapseProvider)
				provider.GetPatternProvider (ExpandCollapsePatternIdentifiers.Pattern.Id);

			actionExpert.Add ("click", "click", null, DoClick);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:27,代码来源:MenuItem.cs

示例2: TreeItem

		public TreeItem (IRawElementProviderSimple provider) : base (provider)
		{
			invokeProvider = (IInvokeProvider)provider.GetPatternProvider(InvokePatternIdentifiers.Pattern.Id);
			selectionItemProvider = (ISelectionItemProvider)provider.GetPatternProvider(SelectionItemPatternIdentifiers.Pattern.Id);

			expandCollapseProvider = provider.GetPatternProvider (
				ExpandCollapsePatternIdentifiers.Pattern.Id) as IExpandCollapseProvider;

			textExpert = TextImplementorFactory.GetImplementor (this, provider);
			actionExpert = new ActionImplementorHelper ();

			// TODO: Localize the name?s
			actionExpert.Add ("click", "click", null, DoClick);
			if (ToggleProvider != null)
				actionExpert.Add ("toggle", "toggle", null, DoToggle);
			if (invokeProvider != null)
				actionExpert.Add ("invoke", "invoke", null, DoInvoke);

			IRawElementProviderFragment fragment = Provider as IRawElementProviderFragment;
			if (fragment != null && fragment.Navigate (NavigateDirection.FirstChild) != null)
				AddExpandContractAction ();

			Role = (ToggleProvider != null? Atk.Role.CheckBox: Atk.Role.TableCell);

			imageExpert = new ImageImplementorHelper (this);
			editableTextExpert = new EditableTextImplementorHelper (this, this, textExpert);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:27,代码来源:TreeItem.cs

示例3: Spinner

		public Spinner (IRawElementProviderSimple provider) : base (provider)
		{
			Role = Atk.Role.SpinButton;
			rangeValueProvider = (IRangeValueProvider)provider.GetPatternProvider (RangeValuePatternIdentifiers.Pattern.Id);
			
			editableRange
				= provider.GetPatternProvider (EditableRangePatternIdentifiers.Pattern.Id) as IEditableRangeProvider;

			valueProvider = (IValueProvider)provider.GetPatternProvider (ValuePatternIdentifiers.Pattern.Id);
			textExpert = TextImplementorFactory.GetImplementor (this, provider);
			oldText = textExpert.Text;
		}
开发者ID:mono,项目名称:uia2atk,代码行数:12,代码来源:Spinner.cs

示例4: ExpandCollapseButton

		public ExpandCollapseButton (IRawElementProviderSimple provider) : base (provider)
		{
			ec_prov = (IExpandCollapseProvider)provider.GetPatternProvider (
				ExpandCollapsePatternIdentifiers.Pattern.Id);

			Role = Atk.Role.ToggleButton;
		}
开发者ID:mono,项目名称:uia2atk,代码行数:7,代码来源:ExpandCollapseButton.cs

示例5: Slider

		public Slider (IRawElementProviderSimple provider) : base (provider)
		{
			Role = Atk.Role.Slider;
			rangeValueProvider = (IRangeValueProvider)provider.GetPatternProvider (RangeValuePatternIdentifiers.Pattern.Id);
			textExpert = TextImplementorFactory.GetImplementor (this, provider);
			oldText = textExpert.Text;
		}
开发者ID:mono,项目名称:uia2atk,代码行数:7,代码来源:Slider.cs

示例6: Window

		public Window (IRawElementProviderSimple provider) : base (provider)
		{
			if (provider != null)
				Role = Atk.Role.Frame;
			
			balloonWindow = (bool)(provider.GetPropertyValue (AutomationElementIdentifiers.IsNotifyIconProperty.Id) != null);
			rootProvider = (IRawElementProviderFragmentRoot) provider;
			
			if (rootProvider != null && balloonWindow) {
				Role = Atk.Role.Alert;
				Name = (string) provider.GetPropertyValue (AutomationElementIdentifiers.HelpTextProperty.Id);
			}

			transformProvider = (ITransformProvider) provider.GetPatternProvider (TransformPatternIdentifiers.Pattern.Id);
			windowProvider = (IWindowProvider) provider.GetPatternProvider (WindowPatternIdentifiers.Pattern.Id);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:16,代码来源:Window.cs

示例7: TextBoxEntryView

		public TextBoxEntryView (IRawElementProviderSimple provider) : base (provider)
		{
			if (IsTableCell)
				Role = Atk.Role.TableCell;
			else
				Role = Atk.Role.Text;

			if (provider.GetPatternProvider (TextPatternIdentifiers.Pattern.Id) == null
			    && provider.GetPatternProvider (ValuePatternIdentifiers.Pattern.Id) == null)
				throw new ArgumentException ("Provider for TextBox should either implement IValue or IText");
			
			textExpert = TextImplementorFactory.GetImplementor (this, provider);
			if ((int) provider.GetPropertyValue (AutomationElementIdentifiers.ControlTypeProperty.Id) 
			    == ControlType.Document.Id)
				multiLine = true;

			editableTextExpert = new EditableTextImplementorHelper (this, this, textExpert);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:18,代码来源:TextBoxEntryView.cs

示例8: Hyperlink

		public Hyperlink (IRawElementProviderSimple provider) : base (provider)
		{
			invokeProvider = (IInvokeProvider)provider.GetPatternProvider (InvokePatternIdentifiers.Pattern.Id);
			hypertext = (IHypertext)invokeProvider;
			links = new List<HyperlinkObject> ();
			Role = Atk.Role.Label;
			
			textExpert = TextImplementorFactory.GetImplementor (this, provider);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:9,代码来源:Hyperlink.cs

示例9: CheckBoxButton

		public CheckBoxButton (IRawElementProviderSimple provider) : base (provider)
		{
			toggleProvider = (IToggleProvider) provider.GetPatternProvider (TogglePatternIdentifiers.Pattern.Id);
			imageImplementor = new ImageImplementorHelper (this);
			if (toggleProvider == null)
				throw new ArgumentException ("The provider for CheckBox should implement the Toggle pattern");

			Role = Atk.Role.CheckBox;
		}
开发者ID:mono,项目名称:uia2atk,代码行数:9,代码来源:CheckBoxButton.cs

示例10: TabPage

		public TabPage (IRawElementProviderSimple provider): base (provider)
		{
			Role = Atk.Role.PageTab;
			selectionItemProvider = (ISelectionItemProvider)provider.GetPatternProvider (
			  SelectionItemPatternIdentifiers.Pattern.Id);
			if (selectionItemProvider == null)
				throw new ArgumentException (
				  "Provider for TabPage should implement ISelectionItemProvider");
		}
开发者ID:mono,项目名称:uia2atk,代码行数:9,代码来源:TabPage.cs

示例11: SplitContainer

		public SplitContainer (IRawElementProviderSimple provider) : base (provider)
		{
			Role = Atk.Role.SplitPane;
			rangeValueProvider = (IRangeValueProvider)provider.GetPatternProvider (RangeValuePatternIdentifiers.Pattern.Id);
			object o = provider.GetPropertyValue (AutomationElementIdentifiers.OrientationProperty.Id);
			if (o is OrientationType)
				orientation = (OrientationType)o;
			else {
				IDockProvider dockProvider = (IDockProvider)provider.GetPatternProvider (DockPatternIdentifiers.Pattern.Id);
				if (dockProvider != null) {
					orientation = (dockProvider.DockPosition == DockPosition.Top || dockProvider.DockPosition == DockPosition.Bottom)?
						OrientationType.Horizontal:
						OrientationType.Vertical;
				} else {
					Log.Warn ("SplitContainer: Couldn't get orientation for splitter.  Does not support DockProvider.");
					orientation = OrientationType.Horizontal;
				}
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:19,代码来源:SplitContainer.cs

示例12: HeaderItem

		public HeaderItem (IRawElementProviderSimple provider) : base (provider)
		{
			Role = Atk.Role.TableColumnHeader;

			invokeProvider = (IInvokeProvider) provider.GetPatternProvider (InvokePatternIdentifiers.Pattern.Id);		
			imageExpert = new ImageImplementorHelper (this); 

			actionExpert = new ActionImplementorHelper ();
			if (invokeProvider != null)
				actionExpert.Add ("click", "click", null, DoClick);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:11,代码来源:HeaderItem.cs

示例13: ListItem

		public ListItem (IRawElementProviderSimple provider) : base (provider)
		{
			invokeProvider = (IInvokeProvider)provider.GetPatternProvider(InvokePatternIdentifiers.Pattern.Id);
			selectionItemProvider = (ISelectionItemProvider)provider.GetPatternProvider(SelectionItemPatternIdentifiers.Pattern.Id);
			if (selectionItemProvider == null)
				throw new ArgumentException ("ListItem should always implement ISelectionItemProvider");
			toggleProvider = (IToggleProvider) provider.GetPatternProvider (TogglePatternIdentifiers.Pattern.Id);

			textExpert = TextImplementorFactory.GetImplementor (this, provider);
			imageExpert = new ImageImplementorHelper (this);
			actionExpert = new ActionImplementorHelper ();
			editableTextExpert = new EditableTextImplementorHelper (this, this, textExpert);

			// TODO: Localize the name?s
			actionExpert.Add ("click", "click", null, DoClick);
			if (toggleProvider != null)
				actionExpert.Add ("toggle", "toggle", null, DoToggle);
			if (invokeProvider != null)
				actionExpert.Add ("invoke", "invoke", null, DoInvoke);
			Role = (toggleProvider != null? Atk.Role.CheckBox: Atk.Role.ListItem);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:21,代码来源:ListItem.cs

示例14: Button

		// UI Automation Properties supported
		// AutomationElementIdentifiers.AcceleratorKeyProperty.Id
		// AutomationIdProperty() ?
		// AutomationElementIdentifiers.BoundingRectangleProperty.Id
		// AutomationElementIdentifiers.ClickablePointProperty.Id
		// AutomationElementIdentifiers.ControlTypeProperty.Id
		// AutomationElementIdentifiers.HelpTextProperty.Id
		// AutomationElementIdentifiers.IsContentElementProperty.Id
		// AutomationElementIdentifiers.IsControlElementProperty.Id
		// AutomationElementIdentifiers.IsKeyboardFocusableProperty.Id
		// AutomationElementIdentifiers.LabeledByProperty.Id
		// AutomationElementIdentifiers.LocalizedControlTypeProperty.Id
		// AutomationElementIdentifiers.NameProperty.Id
		public Button (IRawElementProviderSimple provider) : base (provider)
		{
			invokeProvider = (IInvokeProvider)provider.GetPatternProvider(InvokePatternIdentifiers.Pattern.Id);
			imageImplementor = new ImageImplementorHelper (this);
			InitializeAdditionalProviders ();
			if (invokeProvider != null) {
				//it seems the default description should be null
				actionName = default_invoke_name;
				Role = Atk.Role.PushButton;
			}

			textExpert = TextImplementorFactory.GetImplementor (this, provider);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:26,代码来源:Button.cs

示例15: GetImplementor

		public static ITextImplementor GetImplementor (Adapter adapter,
		                                               IRawElementProviderSimple prov)
		{
			ITextProvider textProvider
				= prov.GetPatternProvider (TextPatternIdentifiers.Pattern.Id)
					as ITextProvider;
			if (textProvider != null)
				return new TextProviderTextImplementor (adapter, textProvider);

			IValueProvider valueProvider
				= prov.GetPatternProvider (ValuePatternIdentifiers.Pattern.Id)
					as IValueProvider;
			if (valueProvider != null)
				return new ValueProviderTextImplementor (adapter, valueProvider);
			
			IRangeValueProvider rangeValueProvider
				= prov.GetPatternProvider (RangeValuePatternIdentifiers.Pattern.Id)
					as IRangeValueProvider;
			if (rangeValueProvider != null)
				return new RangeValueProviderTextImplementor (adapter, rangeValueProvider);
			
			return new NamePropertyTextImplementor (adapter, prov);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:23,代码来源:TextImplementorFactory.cs


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