本文整理汇总了C#中System.Windows.Automation.Peers.AutomationPeer.GetPattern方法的典型用法代码示例。如果您正苦于以下问题:C# AutomationPeer.GetPattern方法的具体用法?C# AutomationPeer.GetPattern怎么用?C# AutomationPeer.GetPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Automation.Peers.AutomationPeer
的用法示例。
在下文中一共展示了AutomationPeer.GetPattern方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GridTable
public GridTable (Adapter adapter, AutomationPeer peer) : base (adapter, peer)
{
this.peer = peer;
this.tableProvider = (ITableProvider) peer.GetPattern (
PatternInterface.Table);
}
示例2: Selection
public Selection (Adapter adapter, AutomationPeer peer) : base (adapter, peer)
{
this.selectionProvider = (ISelectionProvider) peer.GetPattern (
PatternInterface.Selection);
adapter.AutomationPropertyChanged += (o, args) => {
if (args.Property == SelectionPatternIdentifiers.SelectionProperty)
adapter.EmitSignal ("selection_changed");
};
}
示例3: RangeValue
public RangeValue (Adapter adapter, AutomationPeer peer)
: base (adapter, peer)
{
this.rangeValueProvider = (IRangeValueProvider) peer.GetPattern (
PatternInterface.RangeValue);
adapter.AutomationPropertyChanged
+= new EventHandler<AutomationPropertyChangedEventArgs> (
OnAutomationPropertyChanged);
}
示例4: GetSupportedPropertyValueInternal
internal static new object GetSupportedPropertyValueInternal(AutomationPeer itemPeer, int propertyId)
{
if (SelectionItemPatternIdentifiers.IsSelectedProperty.Id == propertyId)
{
ISelectionItemProvider selectionItem = itemPeer.GetPattern(PatternInterface.SelectionItem) as ISelectionItemProvider;
if (selectionItem != null)
return selectionItem.IsSelected;
else
return null;
}
return ItemsControlAutomationPeer.GetSupportedPropertyValueInternal(itemPeer, propertyId);
}
示例5: TryInvokePatternAutomation
private static bool TryInvokePatternAutomation(AutomationPeer peer)
{
var pattern = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
if (pattern == null)
return false;
try
{
pattern.Invoke();
}
catch (Exception exception)
{
throw new TestAutomationException("Exception while invoking pattern", exception);
}
return true;
}
示例6: TryTogglePatternAutomation
/// <summary>
/// Tries the toggle pattern automation.
/// </summary>
/// <param name="peer">The peer.</param>
/// <param name="element">The element.</param>
/// <returns>
/// True if the pattern was available and succeeded, else false.
/// </returns>
/// <exception cref="TestAutomationException">Exception while invoking pattern</exception>
private static bool TryTogglePatternAutomation(AutomationPeer peer, UIElement element)
{
var pattern = peer.GetPattern(PatternInterface.Toggle) as IToggleProvider;
if (pattern == null)
{
return false;
}
try
{
pattern.Toggle();
// Toggle won't fire the command, so do that manually!
var te = element as ToggleButton;
if (te != null && te.Command != null)
{
te.Command.Execute(te.CommandParameter);
}
}
catch (Exception exception)
{
throw new TestAutomationException("Exception while invoking pattern", exception);
}
return true;
}