本文整理汇总了C#中System.Windows.Automation.AutomationEvent类的典型用法代码示例。如果您正苦于以下问题:C# AutomationEvent类的具体用法?C# AutomationEvent怎么用?C# AutomationEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AutomationEvent类属于System.Windows.Automation命名空间,在下文中一共展示了AutomationEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdviseEventAdded
//------------------------------------------------------
//
// Patterns Implementation
//
//------------------------------------------------------
#region ProxyHwnd Methods
// ------------------------------------------------------
//
// Internal Methods
//
// ------------------------------------------------------
// Advises proxy that an event has been added.
// Maps the Automation Events into WinEvents and add those to the list of WinEvents notification hooks
internal virtual void AdviseEventAdded (AutomationEvent eventId, AutomationProperty [] aidProps)
{
// No RawElementBase creation callback, exit from here
if (_createOnEvent == null)
{
return;
}
int cEvents = 0;
WinEventTracker.EvtIdProperty [] aEvents;
// Gets an Array of WinEvents to trap on a per window handle basis
if (eventId == AutomationElement.AutomationPropertyChangedEvent)
{
aEvents = PropertyToWinEvent (aidProps, out cEvents);
}
else
{
aEvents = EventToWinEvent (eventId, out cEvents);
}
// If we have WinEvents to trap, add those to the list of WinEvent
// notification list
if (cEvents > 0)
{
WinEventTracker.AddToNotificationList (_hwnd, _createOnEvent, aEvents, cEvents);
}
}
示例2: RaiseAutomationEvent
public void RaiseAutomationEvent (AutomationEvent eventId, object provider, AutomationEventArgs e)
{
var providerSimple = provider as IRawElementProviderSimple;
if (providerSimple == null)
return;
ClientEventManager.RaiseAutomationEvent (eventId, providerSimple, e);
}
示例3: WindowPatternIdentifiers
static WindowPatternIdentifiers ()
{
Pattern =
new AutomationPattern (PatternId,
"WindowPatternIdentifiers.Pattern");
CanMaximizeProperty =
new AutomationProperty (CanMaximizePropertyId,
"WindowPatternIdentifiers.CanMaximizeProperty");
CanMinimizeProperty =
new AutomationProperty (CanMinimizePropertyId,
"WindowPatternIdentifiers.CanMinimizeProperty");
IsModalProperty =
new AutomationProperty (IsModalPropertyId,
"WindowPatternIdentifiers.IsModalProperty");
IsTopmostProperty =
new AutomationProperty (IsTopmostPropertyId,
"WindowPatternIdentifiers.IsTopmostProperty");
WindowInteractionStateProperty =
new AutomationProperty (WindowInteractionStatePropertyId,
"WindowPatternIdentifiers.WindowInteractionStateProperty");
WindowVisualStateProperty =
new AutomationProperty (WindowVisualStatePropertyId,
"WindowPatternIdentifiers.WindowVisualStateProperty");
WindowClosedEvent =
new AutomationEvent (WindowClosedEventId,
"WindowPatternIdentifiers.WindowClosedProperty");
WindowOpenedEvent =
new AutomationEvent (WindowOpenedEventId,
"WindowPatternIdentifiers.WindowOpenedProperty");
}
示例4: RemoveAutomationEventHandler
public static void RemoveAutomationEventHandler (AutomationEvent eventId, IRawElementProviderSimple provider, AutomationEventHandler eventHandler)
{
lock (automationEventEntries)
automationEventEntries.RemoveAll (e =>
e.EventId == eventId &&
e.Provider == provider &&
e.Handler == eventHandler);
}
示例5: AddAutomationEventHandler
public static void AddAutomationEventHandler (AutomationEvent eventId,
IRawElementProviderSimple provider, TreeScope scope,
AutomationEventHandler eventHandler)
{
var entry = new AutomationEventEntry (eventId, provider, scope, eventHandler);
lock (automationEventEntries)
automationEventEntries.Add (entry);
}
示例6: RaiseAutomationEvent
public override void RaiseAutomationEvent (AutomationEvent eventId, AutomationEventArgs e)
{
if (eventId == GridPatternIdentifiers.ColumnReorderedEvent)
EmitSignal ("column_reordered");
else
base.RaiseAutomationEvent (eventId, e);
// TODO
}
示例7: RaiseAutomationEvent
public override void RaiseAutomationEvent (AutomationEvent eventId, AutomationEventArgs e)
{
if (eventId != AutomationElementIdentifiers.MenuClosedEvent)
base.RaiseAutomationEvent (eventId, e);
TopLevelRootItem.Instance.RemoveChild (Parent);
((ParentAdapter)Parent).RemoveChild (this);
AutomationBridge.HandleTotalElementRemoval (this.Provider);
}
示例8: InvokePatternIdentifiers
static InvokePatternIdentifiers ()
{
InvokedEvent =
new AutomationEvent (InvokedEventId,
"InvokePatternIdentifiers.InvokedEvent");
Pattern =
new AutomationPattern (PatternId,
"InvokePatternIdentifiers.Pattern");
}
示例9: RaiseAutomationEvent
public override void RaiseAutomationEvent (AutomationEvent eventId, AutomationEventArgs e)
{
if (eventId == AutomationElementIdentifiers.AsyncContentLoadedEvent) {
// TODO: Handle AsyncContentLoadedEvent
} else if (eventId == AutomationElementIdentifiers.StructureChangedEvent) {
// TODO: Handle StructureChangedEvent
}
else
base.RaiseAutomationEvent (eventId, e);
}
示例10: Event
internal static async Task<AutomationEventArgs> Event(
AutomationEvent eventId,
AutomationElement element = null,
TreeScope scope = TreeScope.Descendants)
{
using (var waitr = new Waiter(eventId, element, scope))
{
await waitr.Completion.Task;
return waitr.EvtArgs;
}
}
示例11: AddAutomationEventHandler
public void AddAutomationEventHandler (AutomationEvent eventId, IElement element, TreeScope scope, AutomationEventHandler eventHandler)
{
if (element == null)
// elements from local providers are not descendants of the RootElement.
return;
ClientElement clientElement = element as ClientElement;
if (clientElement == null) {
Log.Error ("[ClientAutomationSource.AddAutomationEventHandler] Not ClientElement");
return;
}
ClientEventManager.AddAutomationEventHandler (eventId,
clientElement.Provider, scope, eventHandler);
}
示例12: EventListener
//------------------------------------------------------
//
// Constructors
//
//------------------------------------------------------
#region Constructors
// full ctor
internal EventListener(
AutomationEvent eventId,
TreeScope scope,
AutomationProperty [] properties,
UiaCoreApi.UiaCacheRequest cacheRequest
)
{
_eventId = eventId;
_scope = scope;
if (properties != null)
_properties = (AutomationProperty[])properties.Clone();
else
_properties = null;
_cacheRequest = cacheRequest;
}
示例13: AddEventHandler
private void AddEventHandler(
AutomationEvent automationEvent,
AutomationEventHandler eventHandler)
{
_currentElement = AutomationElement.FocusedElement;
if (_currentElement != null)
{
Automation.AddAutomationEventHandler(
automationEvent,
_currentElement,
TreeScope.Element,
eventHandler);
}
else
this.UiFeedback("(no element)");
}
示例14: GridPatternIdentifiers
static GridPatternIdentifiers ()
{
Pattern =
new AutomationPattern (PatternId,
"GridPatternIdentifiers.Pattern");
RowCountProperty =
new AutomationProperty (RowCountPropertyId,
"GridPatternIdentifiers.RowCountProperty");
ColumnCountProperty =
new AutomationProperty (ColumnCountPropertyId,
"GridPatternIdentifiers.ColumnCountProperty");
ColumnReorderedEvent =
new AutomationEvent (ColumnReorderedEventId,
"GridPatternIdentifiers.ColumnReorderedEvent");
}
示例15: Remove
public static EventListener Remove(AutomationEvent eventId, AutomationElement element, Delegate handler)
{
// Create a prototype to seek
int[] runtimeId = (element == null) ? null : element.GetRuntimeId();
EventListener prototype = new EventListener(eventId.Id, runtimeId, handler);
lock (_events)
{
LinkedListNode<EventListener> node = _events.Find(prototype);
if (node == null)
{
throw new ArgumentException("event handler not found");
}
EventListener result = node.Value;
_events.Remove(node);
return result;
}
}