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


C# IRawElementProviderSimple.GetType方法代码示例

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


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

示例1: TestTablePattern_GetRowHeaderItems

		protected virtual void TestTablePattern_GetRowHeaderItems (IRawElementProviderSimple provider)
		{
			ITableProvider tableProvider
				= provider.GetPatternProvider (TablePatternIdentifiers.Pattern.Id) as ITableProvider;
			if (tableProvider == null)
				Assert.Fail ("Provider {0} is not implementing ITableProvider", provider.GetType ());

			// Provider must never return null
			Assert.IsNotNull (tableProvider.GetRowHeaders (), 
			                  "GetRowHeaderItems must return an empty array instead of returning null");

			// Testing children TableItemProvider: "The children of this control must implement ITableItemProvider."
			// http://msdn.microsoft.com/en-us/library/system.windows.automation.provider.itableprovider.aspx

			IRawElementProviderFragment fragment = provider as IRawElementProviderFragment;
			if (fragment == null)
				return;

			IRawElementProviderFragment child = fragment.Navigate (NavigateDirection.FirstChild);
			while (child != null) {
				TestTablePatternChild (child);
				child = child.Navigate (NavigateDirection.NextSibling);
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:24,代码来源:BaseProviderTest.cs

示例2: TestTableItemPattern_GetRowHeaderItems

		protected virtual void TestTableItemPattern_GetRowHeaderItems (IRawElementProviderSimple provider)
		{
			ITableItemProvider tableItemProvider
				= provider.GetPatternProvider (TableItemPatternIdentifiers.Pattern.Id) as ITableItemProvider;
			if (tableItemProvider == null)
				Assert.Fail ("Provider {0} is not implementing ITableItemProvider", provider.GetType ());

			IRawElementProviderFragment child = provider as IRawElementProviderFragment;
			if (child == null)
				Assert.Fail ("Unable to test a non-navigable ITableItemProvider");

			Assert.IsNotNull (tableItemProvider.ContainingGrid, 
			                  "ContainingGrid should not be null");

			// http://msdn.microsoft.com/en-us/library/system.windows.automation.provider.igriditemprovider.containinggrid.aspx
			Assert.IsNotNull (tableItemProvider.ContainingGrid.GetPatternProvider (GridPatternIdentifiers.Pattern.Id),
			                  "ContainingGrid must implement GridPatternProvider");

			// Provider must never return null
			Assert.IsNotNull (tableItemProvider.GetRowHeaderItems (), 
			                  "GetRowHeaderItems must return an empty array instead of returning null");
		}
开发者ID:mono,项目名称:uia2atk,代码行数:22,代码来源:BaseProviderTest.cs

示例3: TestSelectionPatternChild

		protected override void TestSelectionPatternChild (IRawElementProviderSimple provider)
		{
			if (provider.GetType () == typeof (ListProvider.ListScrollBarProvider)
			    || provider.GetType () == typeof (ListViewProvider.ListViewGroupProvider)
			    || provider.GetType () == typeof (ListViewProvider.ListViewHeaderProvider)) {
				// LAMESPEC:
				//     "The children of this control must implement ISelectionItemProvider."
				//     ScrollBars and Groups don't implementing ISelectionItemProvider.
				return;
			}
			
			base.TestSelectionPatternChild (provider);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:13,代码来源:ListViewProviderTest.cs

示例4: TestSelectionItemPattern_IsSelectedPropertyEvent

		protected virtual void TestSelectionItemPattern_IsSelectedPropertyEvent (IRawElementProviderSimple provider)
		{
			ISelectionItemProvider selectionItemProvider
				= provider.GetPatternProvider (SelectionItemPatternIdentifiers.Pattern.Id) as ISelectionItemProvider;
			if (selectionItemProvider == null)
				Assert.Fail ("Provider {0} is not implementing ISelectionItemProvider", provider.GetType ());

			IRawElementProviderFragment child = provider as IRawElementProviderFragment;
			if (child == null)
				Assert.Fail ("Unable to test a non-navigable ISelectionItemProvider");

			// Parent must implement Selection
			IRawElementProviderFragment parent = child.Navigate (NavigateDirection.Parent);
			if (parent == null)
				Assert.Fail ("We need parent to test ISelectionItemProvider.");

			ISelectionProvider selectionProvider
				= parent.GetPatternProvider (SelectionPatternIdentifiers.Pattern.Id) as ISelectionProvider;
			if (selectionProvider == null)
				Assert.Fail ("ISelectionItemProvider.Parent {0} is not implementing ISelectionProvider", parent.GetType ());

			// Item is selected, we try to unselect it
			if (selectionItemProvider.IsSelected)
				TestSelectionItemPattern_RemoveFromSelection (parent, child);

			if (selectionItemProvider.IsSelected && selectionProvider.IsSelectionRequired)
				return;

			int selectedItems = selectionProvider.GetSelection ().Length;

			bridge.ResetEventLists ();
			selectionItemProvider.Select ();
			
			// IsSelectedProperty
			AutomationPropertyChangedEventTuple tuple
				= bridge.GetAutomationPropertyEventFrom (provider,
				                                         SelectionItemPatternIdentifiers.IsSelectedProperty.Id);
			Assert.IsNotNull (tuple,
			                  string.Format ("{0} IsSelectedProperty event.", provider.GetType ()));
			Assert.IsFalse ((bool) tuple.e.OldValue, "Old value must be false");
			Assert.IsTrue ((bool) tuple.e.NewValue, "New value must be false");

			Assert.IsTrue (selectionItemProvider.IsSelected, "Must be selected");

			Assert.Greater (selectionProvider.GetSelection ().Length,
			                selectedItems,
			                "Selection must be greater that old selectedItems");
		}
开发者ID:mono,项目名称:uia2atk,代码行数:48,代码来源:BaseProviderTest.cs

示例5: TestSelectionPatternChild

		protected override void TestSelectionPatternChild (IRawElementProviderSimple provider)
		{
			if (provider.GetType () == typeof (DataGridViewProvider.DataGridViewDataItemComboBoxListBoxProvider)
			    || provider.GetType () == typeof (DataGridViewProvider.DataGridViewDataItemComboBoxButtonProvider)
			    || provider.GetType () == typeof (DataGridViewProvider.DataGridViewHeaderProvider)) {
				
				// LAMESPEC:
				//     "The children of this control must implement ISelectionItemProvider."
				//     Internal ListBox and Internal Button in ComboBox implementation
				//     don't implement ISelectionItemProvider.
				//
				//     HeaderProvider is a special case, however is not implementing
				//     ISelectionItemProvider either.
				return;
			}
			
			base.TestSelectionPatternChild (provider);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:18,代码来源:DataGridViewProviderTest.cs

示例6: TestGridItemPattern_RemoveRowAfter

		protected override void TestGridItemPattern_RemoveRowAfter (IRawElementProviderSimple provider)
		{
			if (provider.GetType () != typeof (DataGridViewProvider.DataGridDataItemProvider))
			    Assert.Fail (string.Format ("I can't recognize {0}!", provider.GetType ()));

			if (provider.GetType () == typeof (DataGridViewProvider.DataGridDataItemProvider)) {
				DataGridViewProvider.DataGridDataItemProvider itemProvider
					= (DataGridViewProvider.DataGridDataItemProvider) provider;

				itemProvider.DataGridView.Rows.RemoveAt (itemProvider.Row.Index + 1);
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:12,代码来源:DataGridViewProviderTest.cs

示例7: TestValuePattern_ValuePropertyEvent

		protected virtual void TestValuePattern_ValuePropertyEvent (IRawElementProviderSimple provider)
		{
			IValueProvider valueProvider 
				= provider.GetPatternProvider (ValuePatternIdentifiers.Pattern.Id) as IValueProvider;
			if (valueProvider == null)
				Assert.Fail ("Provider {0} is not implementing IValueProvider", provider.GetType ());

			bool enabled 
				= (bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsEnabledProperty.Id);
			Assert.AreEqual (!enabled,
			                 valueProvider.IsReadOnly, 
			                 "!Enabled and IValueProvider.IsReadOnly should be equal");
			try {
				string newValue = "I'm your new value!";
				bridge.ResetEventLists ();
				valueProvider.SetValue (newValue);
				Assert.IsNotNull (bridge.GetAutomationPropertyEventFrom (provider, ValuePatternIdentifiers.ValueProperty.Id),
				                  "IValueProvider.Value didn't raise any event.");
				Assert.AreEqual (newValue,
				                 valueProvider.Value, 
				                 "Different value even when Value event was raised");
			} catch (ElementNotEnabledException) {
				// According to http://msdn.microsoft.com/en-us/library/system.windows.automation.provider.ivalueprovider.setvalue.aspx
				if (!enabled)
					Assert.Fail ("Your provider is disabled but didn't throw ElementNotEnabledException.");
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:27,代码来源:BaseProviderTest.cs

示例8: TestSelectionPatternChild

		protected override void TestSelectionPatternChild (IRawElementProviderSimple provider)
		{
			if (provider.GetType () == typeof (ComboBoxProvider.ComboBoxListBoxProvider)
			    || provider.GetType () == typeof (ComboBoxProvider.ComboBoxButtonProvider)
			    || provider.GetType () == typeof (ComboBoxProvider.ComboBoxTextBoxProvider)) {
				
				// LAMESPEC:
				//     "The children of this control must implement ISelectionItemProvider."
				//     Internal ListBox, Internal Button and Internal TextBox in
				//     ComboBox implementation don't implement ISelectionItemProvider.
				return;
			}
			
			base.TestSelectionPatternChild (provider);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:15,代码来源:ComboBoxProviderTest.cs

示例9: TestInvokePattern_InvokedEvent

		protected virtual void TestInvokePattern_InvokedEvent (IRawElementProviderSimple provider)
		{
			IInvokeProvider invokeProvider 
				= provider.GetPatternProvider (InvokePatternIdentifiers.Pattern.Id) as IInvokeProvider;
			if (invokeProvider == null)
				Assert.Fail ("Provider {0} is not implementing IInvokeProvider", provider.GetType ());

			bridge.ResetEventLists ();

			bool enabled 
				= (bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsEnabledProperty.Id);
			try {
				invokeProvider.Invoke ();
				Assert.IsNotNull (bridge.GetAutomationEventFrom (provider, InvokePatternIdentifiers.InvokedEvent.Id),
				                  "IInvokeProvider.Invoke didn't raise any event.");
			} catch (ElementNotEnabledException) {
				// According to http://msdn.microsoft.com/en-us/library/system.windows.automation.provider.iinvokeprovider.invoke.aspx
				if (!enabled)
					Assert.Fail ("Your provider is disabled but didn't throw ElementNotEnabledException.");
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:21,代码来源:BaseProviderTest.cs

示例10: TestTogglePattern_ToggleStatePropertyEvent

		protected virtual void TestTogglePattern_ToggleStatePropertyEvent (IRawElementProviderSimple provider)
		{
			IToggleProvider toggleProvider
				= provider.GetPatternProvider (TogglePatternIdentifiers.Pattern.Id) as IToggleProvider;
			if (toggleProvider == null)
				Assert.Fail ("Provider {0} is not implementing IToggleProvider", provider.GetType ());


			// A control must cycle through its toggle states in this order:
			// On, Off, Indeterminate
			bool enabled 
				= (bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsEnabledProperty.Id);
			ToggleState toggleState = toggleProvider.ToggleState;
			ToggleState firstState = toggleState;

			try {
				bridge.ResetEventLists ();				
				do {
					bridge.ResetEventLists ();
					toggleProvider.Toggle ();
					Assert.IsNotNull (bridge.GetAutomationPropertyEventFrom (provider, TogglePatternIdentifiers.ToggleStateProperty.Id),
					                  string.Format ("toggleProvider.Toggle didn't raise any event. Old {0} Current: {1}", 
					                                 toggleState,
					                                 toggleProvider.ToggleState));
					ValidateToggleState  (toggleState, toggleProvider.ToggleState);
					toggleState = toggleProvider.ToggleState;
				} while (firstState != toggleState);
			} catch (ElementNotEnabledException) {
				if (!enabled)
					Assert.Fail ("Your provider is disabled but didn't throw ElementNotEnabledException.");
			}			
		}
开发者ID:mono,项目名称:uia2atk,代码行数:32,代码来源:BaseProviderTest.cs

示例11: TestButtonPatterns

		protected virtual void TestButtonPatterns (IRawElementProviderSimple provider)
		{
			// http://msdn.microsoft.com/en-us/library/ms742153.aspx
			Assert.IsTrue ((bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsInvokePatternAvailableProperty.Id)
			               || (bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsTogglePatternAvailableProperty.Id),
			               string.Format ("Button ControlType must support IInvokeProvider or IToggleProvider. Provider: {0}",
			                              provider.GetType ()));
			
			Assert.AreEqual (Catalog.GetString ("button"),
			                 provider.GetPropertyValue (AutomationElementIdentifiers.LocalizedControlTypeProperty.Id),
			                 "LocalizedControlTypeProperty");
			
			TestInvokePattern_InvokedEvent (provider);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:14,代码来源:BaseProviderTest.cs

示例12: TestGridItemPattern_RemoveRowBefore

		protected override void TestGridItemPattern_RemoveRowBefore (IRawElementProviderSimple provider)
		{
			if (provider.GetType () != typeof (ListViewProvider.ListViewListItemProvider))
			    Assert.Fail (string.Format ("I can't recognize {0}!", provider.GetType ()));

			if (provider.GetType () == typeof (ListViewProvider.ListViewListItemProvider)) {
				ListViewProvider.ListViewListItemProvider itemProvider
					= (ListViewProvider.ListViewListItemProvider) provider;

				itemProvider.ListView.Items.RemoveAt (itemProvider.Index - 1);
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:12,代码来源:ListViewProviderTest.cs

示例13: TestGridItemPattern_AddRowAfter

		protected override void TestGridItemPattern_AddRowAfter (IRawElementProviderSimple provider)
		{
			if (provider.GetType () != typeof (ListViewProvider.ListViewListItemProvider))
			    Assert.Fail (string.Format ("I can't recognize {0}!", provider.GetType ()));

			if (provider.GetType () == typeof (ListViewProvider.ListViewListItemProvider)) {
				ListViewProvider.ListViewListItemProvider itemProvider
					= (ListViewProvider.ListViewListItemProvider) provider;

				itemProvider.ListView.Items.Insert (itemProvider.Index + 1,
				                                    new ListViewItem ());
			}
		}
开发者ID:mono,项目名称:uia2atk,代码行数:13,代码来源:ListViewProviderTest.cs

示例14: TestGridItemPattern_ColumnPropertyEvent

		protected virtual void TestGridItemPattern_ColumnPropertyEvent (IRawElementProviderSimple provider)
		{
			IGridItemProvider gridItemProvider
				= provider.GetPatternProvider (GridItemPatternIdentifiers.Pattern.Id) as IGridItemProvider;
			if (gridItemProvider == null)
				Assert.Fail ("Provider {0} is not implementing IGridItemProvider", provider.GetType ());

			IRawElementProviderFragment child = provider as IRawElementProviderFragment;
			if (child == null)
				Assert.Fail ("Unable to test a non-navigable IGridItemProvider");

			Assert.IsNotNull (gridItemProvider.ContainingGrid, 
			                  "ContainingGrid must not be null");
			IGridProvider gridProvider 
				= gridItemProvider.ContainingGrid.GetPatternProvider (GridPatternIdentifiers.Pattern.Id) as IGridProvider;
			if (gridProvider == null)
				Assert.Fail ("Provider {0} is ContainingGrid of {1} and should implement IGridProvider",
				             gridItemProvider.ContainingGrid,
				             provider.GetType ());

			// FIXME: Implement
		}
开发者ID:mono,项目名称:uia2atk,代码行数:22,代码来源:BaseProviderTest.cs

示例15: TestValuePattern_IsReadOnlyPropertyEvent

		protected virtual void TestValuePattern_IsReadOnlyPropertyEvent (IRawElementProviderSimple provider)
		{
			IValueProvider valueProvider 
				= provider.GetPatternProvider (ValuePatternIdentifiers.Pattern.Id) as IValueProvider;
			if (valueProvider == null)
				Assert.Fail ("Provider {0} is not implementing IValueProvider", provider.GetType ());

			bool enabled 
				= (bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsEnabledProperty.Id);
			Assert.AreEqual (!enabled,
			                 valueProvider.IsReadOnly, 
			                 "!Enabled and IValueProvider.IsReadOnly should be equal");
			
			bool newValue = enabled;

			bridge.ResetEventLists ();
			TestValuePattern_ChangeReadOnly (provider, newValue);
			AutomationPropertyChangedEventTuple tuple
				= bridge.GetAutomationPropertyEventFrom (provider, ValuePatternIdentifiers.IsReadOnlyProperty.Id);
			Assert.IsNotNull (tuple,
			                  "IValueProvider.IsReadOnly didn't raise any event.");
			Assert.AreEqual (newValue, tuple.e.NewValue, "Value is invalid in event.");
			Assert.AreEqual (!newValue, tuple.e.OldValue, "Value is invalid in event.");

			Assert.AreEqual (newValue,
			                 valueProvider.IsReadOnly, 
			                 "IsReadOnly value not changed.");
			Assert.AreEqual (!newValue,
			                 (bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsEnabledProperty.Id), 
			                 "Enabled value not changed.");

			// Changing again
			newValue = !newValue;
			
			bridge.ResetEventLists ();
			TestValuePattern_ChangeReadOnly (provider, newValue);
			tuple = bridge.GetAutomationPropertyEventFrom (provider, ValuePatternIdentifiers.IsReadOnlyProperty.Id);
			Assert.IsNotNull (tuple,
			                  "IValueProvider.IsReadOnly didn't raise any event.");
			Assert.AreEqual (newValue, tuple.e.NewValue, "Value is invalid in event.");
			Assert.AreEqual (!newValue, tuple.e.OldValue, "Value is invalid in event.");

			Assert.AreEqual (newValue,
			                 valueProvider.IsReadOnly, 
			                 "IsReadOnly value not changed.");
			Assert.AreEqual (!newValue,
			                 (bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsEnabledProperty.Id), 
			                 "Enabled value not changed.");
		}
开发者ID:mono,项目名称:uia2atk,代码行数:49,代码来源:BaseProviderTest.cs


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