// Selection Events needs to be raised on DataItem Peers now when they exist.
 internal void RaiseAutomationSelectionEvent(AutomationEvents eventId)
 {
     if (EventsSource != null)
     {
         EventsSource.RaiseAutomationEvent(eventId);
     }
 }
Beispiel #2
0
		public void RaiseAutomationEvent (AutomationPeer peer, AutomationEvents eventId)
		{
			if (!AccessibilityEnabled || peer == null)
				return;

			if (AutomationEventRaised != null)
				AutomationEventRaised (this, new AutomationEventEventArgs (peer, eventId));
		}
 // Selection Events needs to be raised on DataItem Peers now when they exist.
 internal void RaiseAutomationSelectionEvent(AutomationEvents eventId)
 {
     if (EventsSource != null)
     {
         EventsSource.RaiseAutomationEvent(eventId);
     }
     else
     {
         this.RaiseAutomationEvent(eventId);
     }
 }
Beispiel #4
0
 //  Unlike GetRegisteredEvent below,
 //  HasRegisteredEvent does NOT cause automation DLLs loading
 internal static bool HasRegisteredEvent(AutomationEvents eventId)
 {
     lock (_lock)
     {
         if (_eventsTable != null && _eventsTable.Count != 0)
         {
             return(GetRegisteredEventObjectHelper(eventId) != null);
         }
     }
     return(false);
 }
Beispiel #5
0
        private void fireAutomationEvents()
        {
            //no reentrancy. It may happen if one of handlers calls UpdateLayout synchronously
            if (_inFireAutomationEvents)
            {
                return;
            }

            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordLayout, EventTrace.Level.Verbose, EventTrace.Event.WClientLayoutFireAutomationEventsBegin);
            try
            {
                _inFireAutomationEvents = true;
                _firePostLayoutEvents   = false;

                LayoutEventList.ListItem [] copy = AutomationEvents.CopyToArray();

                for (int i = 0; i < copy.Length; i++)
                {
                    LayoutEventList.ListItem item = copy[i];
                    //store peer here in case if thread gets pre-empted between check for IsAlive and invocation
                    //and GC can run making something that was alive not callable.
                    AutomationPeer peer = null;
                    try
                    {
                        // this will return null if element is already GC'ed
                        peer = (AutomationPeer)(item.Target);
                    }
                    catch (InvalidOperationException) //this will happen if element is being resurrected after finalization
                    {
                        peer = null;
                    }

                    if (peer != null)
                    {
                        peer.FireAutomationEvents();
                        // if handler dirtied the tree, go clean it again before calling other handlers
                        if (hasDirtiness)
                        {
                            break;
                        }
                    }
                    else
                    {
                        AutomationEvents.Remove(item);
                    }
                }
            }
            finally
            {
                _inFireAutomationEvents = false;
                EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordLayout, EventTrace.Level.Verbose, EventTrace.Event.WClientLayoutFireAutomationEventsEnd);
            }
        }
Beispiel #6
0
        public void RaiseAutomationEvent(AutomationPeer peer, AutomationEvents eventId)
        {
            if (!AccessibilityEnabled || peer == null)
            {
                return;
            }

            if (AutomationEventRaised != null)
            {
                AutomationEventRaised(this, new AutomationEventEventArgs(peer, eventId));
            }
        }
Beispiel #7
0
        private static AutomationEvent GetRegisteredEventObjectHelper(AutomationEvents eventId)
        {
            AutomationEvent eventObject = null;

            switch (eventId)
            {
            case AutomationEvents.ToolTipOpened:                                        eventObject = AutomationElementIdentifiers.ToolTipOpenedEvent; break;

            case AutomationEvents.ToolTipClosed:                                        eventObject = AutomationElementIdentifiers.ToolTipClosedEvent; break;

            case AutomationEvents.MenuOpened:                                           eventObject = AutomationElementIdentifiers.MenuOpenedEvent; break;

            case AutomationEvents.MenuClosed:                                           eventObject = AutomationElementIdentifiers.MenuClosedEvent; break;

            case AutomationEvents.AutomationFocusChanged:                               eventObject = AutomationElementIdentifiers.AutomationFocusChangedEvent; break;

            case AutomationEvents.InvokePatternOnInvoked:                               eventObject = InvokePatternIdentifiers.InvokedEvent; break;

            case AutomationEvents.SelectionItemPatternOnElementAddedToSelection:        eventObject = SelectionItemPatternIdentifiers.ElementAddedToSelectionEvent; break;

            case AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection:    eventObject = SelectionItemPatternIdentifiers.ElementRemovedFromSelectionEvent; break;

            case AutomationEvents.SelectionItemPatternOnElementSelected:                eventObject = SelectionItemPatternIdentifiers.ElementSelectedEvent; break;

            case AutomationEvents.SelectionPatternOnInvalidated:                        eventObject = SelectionPatternIdentifiers.InvalidatedEvent; break;

            case AutomationEvents.TextPatternOnTextSelectionChanged:                    eventObject = TextPatternIdentifiers.TextSelectionChangedEvent; break;

            case AutomationEvents.TextPatternOnTextChanged:                             eventObject = TextPatternIdentifiers.TextChangedEvent; break;

            case AutomationEvents.AsyncContentLoaded:                                   eventObject = AutomationElementIdentifiers.AsyncContentLoadedEvent; break;

            case AutomationEvents.PropertyChanged:                                      eventObject = AutomationElementIdentifiers.AutomationPropertyChangedEvent; break;

            case AutomationEvents.StructureChanged:                                     eventObject = AutomationElementIdentifiers.StructureChangedEvent; break;

            case AutomationEvents.InputReachedTarget:                                   eventObject = SynchronizedInputPatternIdentifiers.InputReachedTargetEvent; break;

            case AutomationEvents.InputReachedOtherElement:                             eventObject = SynchronizedInputPatternIdentifiers.InputReachedOtherElementEvent; break;

            case AutomationEvents.InputDiscarded:                                       eventObject = SynchronizedInputPatternIdentifiers.InputDiscardedEvent; break;

            default:
                throw new ArgumentException(SR.Get(SRID.Automation_InvalidEventId), "eventId");
            }

            if ((eventObject != null) && (!_eventsTable.ContainsKey(eventObject.Id)))
            {
                eventObject = null;
            }

            return(eventObject);
        }
        // Token: 0x06005E78 RID: 24184 RVA: 0x001A7918 File Offset: 0x001A5B18
        private void InvokeMenuOpenedClosedAutomationEvent(bool open)
        {
            AutomationEvents automationEvent = open ? AutomationEvents.MenuOpened : AutomationEvents.MenuClosed;

            if (AutomationPeer.ListenerExists(automationEvent))
            {
                AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this);
                if (peer != null)
                {
                    if (open)
                    {
                        base.Dispatcher.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(delegate(object param)
                        {
                            peer.RaiseAutomationEvent(automationEvent);
                            return(null);
                        }), null);
                        return;
                    }
                    peer.RaiseAutomationEvent(automationEvent);
                }
            }
        }
Beispiel #9
0
        private static AutomationEvent GetRegisteredEventObjectHelper(AutomationEvents eventId)
        {
            AutomationEvent eventObject = null;

            switch(eventId)
            {
                case AutomationEvents.ToolTipOpened:                                        eventObject = AutomationElementIdentifiers.ToolTipOpenedEvent; break;
                case AutomationEvents.ToolTipClosed:                                        eventObject = AutomationElementIdentifiers.ToolTipClosedEvent; break;
                case AutomationEvents.MenuOpened:                                           eventObject = AutomationElementIdentifiers.MenuOpenedEvent; break;
                case AutomationEvents.MenuClosed:                                           eventObject = AutomationElementIdentifiers.MenuClosedEvent; break;
                case AutomationEvents.AutomationFocusChanged:                               eventObject = AutomationElementIdentifiers.AutomationFocusChangedEvent; break;
                case AutomationEvents.InvokePatternOnInvoked:                               eventObject = InvokePatternIdentifiers.InvokedEvent; break;
                case AutomationEvents.SelectionItemPatternOnElementAddedToSelection:        eventObject = SelectionItemPatternIdentifiers.ElementAddedToSelectionEvent; break;
                case AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection:    eventObject = SelectionItemPatternIdentifiers.ElementRemovedFromSelectionEvent; break;
                case AutomationEvents.SelectionItemPatternOnElementSelected:                eventObject = SelectionItemPatternIdentifiers.ElementSelectedEvent; break;
                case AutomationEvents.SelectionPatternOnInvalidated:                        eventObject = SelectionPatternIdentifiers.InvalidatedEvent; break;
                case AutomationEvents.TextPatternOnTextSelectionChanged:                    eventObject = TextPatternIdentifiers.TextSelectionChangedEvent; break;
                case AutomationEvents.TextPatternOnTextChanged:                             eventObject = TextPatternIdentifiers.TextChangedEvent; break;
                case AutomationEvents.AsyncContentLoaded:                                   eventObject = AutomationElementIdentifiers.AsyncContentLoadedEvent; break;
                case AutomationEvents.PropertyChanged:                                      eventObject = AutomationElementIdentifiers.AutomationPropertyChangedEvent; break;
                case AutomationEvents.StructureChanged:                                     eventObject = AutomationElementIdentifiers.StructureChangedEvent; break;
                case AutomationEvents.InputReachedTarget:                                   eventObject = SynchronizedInputPatternIdentifiers.InputReachedTargetEvent; break;
                case AutomationEvents.InputReachedOtherElement:                             eventObject = SynchronizedInputPatternIdentifiers.InputReachedOtherElementEvent; break;
                case AutomationEvents.InputDiscarded:                                       eventObject = SynchronizedInputPatternIdentifiers.InputDiscardedEvent; break;

                default:
                    throw new ArgumentException(SR.Get(SRID.Automation_InvalidEventId), "eventId");
            }

            if ((eventObject != null) && (!_eventsTable.ContainsKey(eventObject.Id)))
            {
                eventObject = null;
            }

            return (eventObject);
        }
        private void OnselectionModelChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "SelectedIndices")
            {
                bool oldValue = IsSelected;
                bool newValue = SelectionModel.IsSelected(RepeatedIndex).Value;
                if (oldValue != newValue)
                {
                    IsSelected = newValue;

                    // AutomationEvents.PropertyChanged is used as a value that means dont raise anything
                    AutomationEvents eventToRaise =
                        oldValue ?
                        (SelectionModel.SingleSelect ? AutomationEvents.PropertyChanged : AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection) :
                        (SelectionModel.SingleSelect ? AutomationEvents.SelectionItemPatternOnElementSelected : AutomationEvents.SelectionItemPatternOnElementAddedToSelection);

                    if (eventToRaise != AutomationEvents.PropertyChanged && AutomationPeer.ListenerExists(eventToRaise))
                    {
                        var peer = FrameworkElementAutomationPeer.CreatePeerForElement(this);
                        peer.RaiseAutomationEvent(eventToRaise);
                    }
                }
            }
        }
Beispiel #11
0
 public AutomationEventEventArgs(AutomationPeer peer, AutomationEvents eventId)
 {
     Peer  = peer;
     Event = eventId;
 }
Beispiel #12
0
 public static bool ListenerExists(AutomationEvents eventId)
 {
     return(AutomationSingleton.Instance.ListenerExists(eventId));
 }
 /// <summary>
 /// Raise an automation peer event for the selection of a day button.
 /// </summary>
 /// <param name="calendar">
 /// The Calendar associated with this automation peer.
 /// </param>
 /// <param name="date">The selected date.</param>
 /// <param name="eventToRaise">The selection event to raise.</param>
 private static void RaiseDayButtonSelectionEvent(Calendar calendar, DateTime date, AutomationEvents eventToRaise)
 {
     CalendarDayButton button = calendar.FindDayButtonFromDay(date);
     if (button != null)
     {
         AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(button);
         if (peer != null)
         {
             peer.RaiseAutomationEvent(eventToRaise);
         }
     }
 }
Beispiel #14
0
 internal static bool ListenerExists(this AutomationEvents eventId)
 {
     return(AutomationPeer.ListenerExists(eventId));
 }
Beispiel #15
0
 internal static void RaiseEventIfListener(DependencyObject target, AutomationEvents eventId) => Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.Xaml.Automation.Peers.AutomationPeer", "RaiseEventIfListener");
Beispiel #16
0
 public static bool ListenerExists(AutomationEvents eventId)
 {
     return(false);
 }
Beispiel #17
0
		public AutomationEventEventArgs (AutomationPeer peer, AutomationEvents eventId)
		{
			Peer = peer;
			Event = eventId;
		}
Beispiel #18
0
 internal static bool ListenerExistsHelper(AutomationEvents eventId) => false;
Beispiel #19
0
        public void RaiseAutomationEvent(AutomationEvents eventId)
        {
            AutomationEvent eventObject = EventMap.GetRegisteredEvent(eventId);

            if (eventObject == null)
            {
                // nobody is listening to this event
                return;
            }

            IRawElementProviderSimple provider = ProviderFromPeer(this);
            if (provider != null)
            {
                AutomationInteropProvider.RaiseAutomationEvent(
                    eventObject,
                    provider,
                    new AutomationEventArgs(eventObject));
            }
        }
 public static bool ListenerExists(AutomationEvents eventId)
 {
     return(default(bool));
 }
Beispiel #21
0
 ///<summary>
 /// Used to check if Automation is indeed listening for the event.
 /// Typical usage is to check this before even creating the peer that will fire the event.
 /// Basically, this is a performance measure since if the Automation does not listen for the event,
 /// it does not make sense to create a peer to fire one.
 /// NOTE: the method is static and only answers if there is some listener in Automation,
 /// not specifically for some element. The Automation can hook up "broadcast listeners" so the
 /// per-element info is basically unavailable.
 ///</summary>
 static public bool ListenerExists(AutomationEvents eventId)
 {
     return (EventMap.HasRegisteredEvent(eventId));
 }
 public void RaiseAutomationEvent(AutomationEvents eventId)
 {
 }
 public static bool ListenerExists(AutomationEvents eventId)
 {
   return default(bool);
 }
Beispiel #24
0
 public void RaiseAutomationEvent(AutomationEvents eventId)
 {
     AutomationSingleton.Instance.RaiseAutomationEvent(this, eventId);
 }
        /// <summary>
        /// Raise an automation peer event for the selection of a day button.
        /// </summary>
        /// <param name="calendar">
        /// The Calendar associated with this automation peer.
        /// </param>
        /// <param name="date">The selected date.</param>
        /// <param name="eventToRaise">The selection event to raise.</param>
        private static void RaiseDayButtonSelectionEvent(Calendar calendar, DateTime date, AutomationEvents eventToRaise)
        {
            CalendarDayButton button = calendar.FindDayButtonFromDay(date);

            if (button != null)
            {
                AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(button);
                if (peer != null)
                {
                    peer.RaiseAutomationEvent(eventToRaise);
                }
            }
        }
Beispiel #26
0
 public bool ListenerExists(AutomationEvents events)
 {
     return(AccessibilityEnabled);
 }
Beispiel #27
0
		public void RaiseAutomationEvent (AutomationEvents eventId)
		{
			AutomationSingleton.Instance.RaiseAutomationEvent (this, eventId);
		}
Beispiel #28
0
 public static bool ListenerfExists(AutomationEvents eventId)
 {
     Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.Xaml.Automation.Peers.AutomationPeer", "bool AutomationPeer.ListenerExists");
     return(false);
 }
Beispiel #29
0
		public static bool ListenerExists (AutomationEvents eventId)
		{
			return AutomationSingleton.Instance.ListenerExists (eventId);
		}
Beispiel #30
0
		public bool ListenerExists (AutomationEvents events)
		{
			return AccessibilityEnabled;
		}
Beispiel #31
0
 private static bool ListenerExistsHelper(AutomationEvents eventId)
 {
     return(AutomationPeer.ListenerExists(eventId));
 }
 public void RaiseAutomationEvent(AutomationEvents eventId)
 {
 }
Beispiel #33
0
        internal static AutomationEvent GetRegisteredEvent(AutomationEvents eventId)
        {
            lock (_lock)
            {
                if (_eventsTable != null && _eventsTable.Count != 0)
                {
                    return (GetRegisteredEventObjectHelper(eventId));
                }
            }

            return (null);
        }