本文整理汇总了C#中System.Windows.Automation.Provider.IRawElementProviderSimple.GetPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# IRawElementProviderSimple.GetPropertyValue方法的具体用法?C# IRawElementProviderSimple.GetPropertyValue怎么用?C# IRawElementProviderSimple.GetPropertyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Automation.Provider.IRawElementProviderSimple
的用法示例。
在下文中一共展示了IRawElementProviderSimple.GetPropertyValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: ComboBoxItem
public ComboBoxItem (IRawElementProviderSimple provider) : base (provider)
{
int controlType = (int) provider.GetPropertyValue (AutomationElementIdentifiers.ControlTypeProperty.Id);
selectionItemProvider = (ISelectionItemProvider)provider.GetPatternProvider (
SelectionItemPatternIdentifiers.Pattern.Id);
if (selectionItemProvider == null)
throw new ArgumentException (
String.Format ("Provider for ComboBoxItem (control type {0}) should implement ISelectionItemProvider", controlType));
textExpert = TextImplementorFactory.GetImplementor (this, provider);
//FIXME: take in account ComboBox style changes at runtime
if (ParentIsSimple ())
Role = Atk.Role.TableCell;
else
Role = Atk.Role.MenuItem;
}
示例4: 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);
}
示例5: 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;
}
}
}
示例6: TestExpandCollapsePattern_ExpandCollapseStatePropertyEvent
protected virtual void TestExpandCollapsePattern_ExpandCollapseStatePropertyEvent (IRawElementProviderSimple provider)
{
IExpandCollapseProvider expandCollapseProvider
= provider.GetPatternProvider (ExpandCollapsePatternIdentifiers.Pattern.Id) as IExpandCollapseProvider;
if (expandCollapseProvider == null)
Assert.Fail ("Provider {0} is not implementing IExpandCollapseProvider", provider.GetType ());
bool enabled
= (bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsEnabledProperty.Id);
ExpandCollapseState currentState = expandCollapseProvider.ExpandCollapseState;
try {
bridge.ResetEventLists ();
if (currentState == ExpandCollapseState.Collapsed)
expandCollapseProvider.Expand ();
else if (currentState == ExpandCollapseState.Expanded
|| currentState == ExpandCollapseState.PartiallyExpanded)
expandCollapseProvider.Collapse ();
Assert.IsNotNull (bridge.GetAutomationPropertyEventFrom (provider, ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty.Id),
"IExpandCollapseProvider.ExpandCollapseStateProperty didn't raise any event.");
// Is hard to test NewValue or OldValue because the spec doesn't
// say anything about those values when calling Collapse/Expand.
} catch (ElementNotEnabledException) {
if (!enabled)
Assert.Fail ("Your provider is disabled but didn't throw ElementNotEnabledException.");
} catch (InvalidOperationException) {
// Expand is called when the ExpandCollapseState = LeafNode.
if (currentState != ExpandCollapseState.LeafNode)
Assert.Fail (string.Format ("InvalidOperationException is only thrown when state is LeafNode, current state: ", currentState));
}
}
示例7: TestEmbeddedImagePattern_All
protected virtual void TestEmbeddedImagePattern_All (IRawElementProviderSimple provider, bool imageExpected)
{
IEmbeddedImageProvider embeddedImage
= provider.GetPatternProvider (EmbeddedImagePatternIdentifiers.Pattern.Id) as IEmbeddedImageProvider;
Assert.IsNotNull (embeddedImage, "Provider {0} is not implementing IEmbeddedImageProvider");
Assert.AreEqual (!imageExpected,
embeddedImage.Bounds.IsEmpty,
string.Format ("Image was {0}expected, but was {1}found",
imageExpected ? "" : "not ",
embeddedImage.Bounds.IsEmpty ? "not " : ""));
if (imageExpected) {
Rect providerRect
= (Rect) provider.GetPropertyValue (AutomationElementIdentifiers.BoundingRectangleProperty.Id);
Rect imageRect = embeddedImage.Bounds;
Assert.IsTrue (imageRect.X >= providerRect.X,
string.Format ("Image X: {0} must be >= than container X: {1}", imageRect.X, providerRect.X));
Assert.IsTrue (imageRect.Y >= providerRect.Y,
string.Format ("Image Y: {0} must be >= than container Y: {1}", imageRect.Y, providerRect.Y));
Assert.IsTrue (imageRect.Width <= providerRect.Width,
string.Format ("Image Width: {0} must be <= than container Width: {1}", imageRect.Width, providerRect.Width));
Assert.IsTrue (imageRect.Height <= providerRect.Height,
string.Format ("Image Height: {0} must be <= than container Height: {1}", imageRect.Height, providerRect.Height));
}
}
示例8: DistanceFrom
private double DistanceFrom (IRawElementProviderSimple otherProvider)
{
Rect bounds = (Rect) GetPropertyValue (AutomationElementIdentifiers.BoundingRectangleProperty.Id);
Rect otherBounds = (Rect) otherProvider.GetPropertyValue (AutomationElementIdentifiers.BoundingRectangleProperty.Id);
if (control != null && control.RightToLeft == SWF.RightToLeft.Yes)
return Distance (bounds.TopRight, otherBounds.TopRight);
else
return Distance (bounds.TopLeft, otherBounds.TopLeft);
}
示例9: TestThumbPatterns
protected virtual void TestThumbPatterns (IRawElementProviderSimple provider)
{
// http://msdn.microsoft.com/en-us/library/ms742539.aspx
// DEPENDS: IRangeValueProvider
// DEPENDS: ITransformProvider
Assert.AreEqual (Catalog.GetString ("thumb"),
provider.GetPropertyValue (AutomationElementIdentifiers.LocalizedControlTypeProperty.Id),
"LocalizedControlTypeProperty");
}
示例10: TestEditPatterns
protected override void TestEditPatterns (IRawElementProviderSimple provider)
{
// LAMESPEC: Edit must always support ITextProvider, but this *is not true* in Edit Cells
Assert.IsTrue ((bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsValuePatternAvailableProperty.Id),
"Edit ControlType in DataGrid must support IValueProvider");
Assert.IsFalse ((bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsRangeValuePatternAvailableProperty.Id),
"Edit ControlType in DataGrid MUST NOT support IRangeValueProvider");
Assert.AreEqual (Catalog.GetString ("edit"),
provider.GetPropertyValue (AutomationElementIdentifiers.LocalizedControlTypeProperty.Id),
"LocalizedControlTypeProperty");
TestValuePattern_All (provider);
}
示例11: ScrollBar
public ScrollBar (IRawElementProviderSimple provider) : base (provider)
{
Role = Atk.Role.ScrollBar;
rangeValueProvider = (IRangeValueProvider)provider.GetPatternProvider (RangeValuePatternIdentifiers.Pattern.Id);
orientation = (OrientationType)provider.GetPropertyValue (AutomationElementIdentifiers.OrientationProperty.Id);
}
示例12: TestWindowPatterns
protected virtual void TestWindowPatterns (IRawElementProviderSimple provider)
{
// http://msdn.microsoft.com/en-us/library/ms746673.aspx
Assert.IsTrue ((bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsTransformPatternAvailableProperty.Id),
"Window ControlType must support ITransformProvider");
Assert.IsTrue ((bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsWindowPatternAvailableProperty.Id),
"Window ControlType must support IWindowProvider");
// DEPENDS: IDockProvider
Assert.AreEqual (Catalog.GetString ("window"),
provider.GetPropertyValue (AutomationElementIdentifiers.LocalizedControlTypeProperty.Id),
"LocalizedControlTypeProperty");
}
示例13: HeaderValue
public string HeaderValue(IRawElementProviderSimple element)
{
return element.GetPropertyValue(AutomationElementIdentifiers.NameProperty.Id).ToString();
}
示例14: TestTreePatterns
protected virtual void TestTreePatterns (IRawElementProviderSimple provider)
{
// http://msdn.microsoft.com/en-us/library/ms743706.aspx
// DEPENDS: ISelectionProvider
// DEPENDS: IScrollProvider
Assert.AreEqual (Catalog.GetString ("tree"),
provider.GetPropertyValue (AutomationElementIdentifiers.LocalizedControlTypeProperty.Id),
"LocalizedControlTypeProperty");
}
示例15: TestTreeItemPatterns
protected virtual void TestTreeItemPatterns (IRawElementProviderSimple provider)
{
// http://msdn.microsoft.com/en-us/library/ms743384.aspx
Assert.IsTrue ((bool) provider.GetPropertyValue (AutomationElementIdentifiers.IsExpandCollapsePatternAvailableProperty.Id),
"TreeItem ControlType must support IExpandCollapseProvider");
// DEPENDS: IInvokeProvider
// DEPENDS: IScrollItemProvider
// DEPENDS: ISelectionItemProvider
// DEPENDS: IToggleProvider
Assert.AreEqual (Catalog.GetString ("tree item"),
provider.GetPropertyValue (AutomationElementIdentifiers.LocalizedControlTypeProperty.Id),
"LocalizedControlTypeProperty");
TestExpandCollapsePattern_ExpandCollapseStatePropertyEvent (provider);
}