예제 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="config"></param>
 /// <param name="ec"></param>
 /// <param name="listener"></param>
 private ListenAction(ListenScope listenScope, ElementContext ec, HandleUIAutomationEventMessage listener)
 {
     this.Id               = Guid.NewGuid();
     this.ElementContext   = ec;
     this.EventListener    = new EventListenerFactory(ec.Element, listenScope);
     this.ExternalListener = listener;
 }
 /// <summary>
 /// Cosntructor.
 /// </summary>
 /// <param name="peDelegate"></param>
 /// <param name="rootElement">can be null but it is only for global events like focusChanged</param>
 /// <param name="scope"></param>
 public EventListenerFactory(A11yElement rootElement, ListenScope scope)
 {
     this.RootElement    = rootElement;
     this.Scope          = GetUIAScope(scope);
     this.EventListeners = new Dictionary <int, EventListener>();
     //Start worker thread
     StartWorkerThread();
 }
예제 #3
0
        /// <summary>
        /// Create new Instance of ListenAction
        /// </summary>
        /// <param name="config"></param>
        /// <param name="ecId"></param>
        /// <param name="listener"></param>
        /// <returns></returns>
        public static Guid CreateInstance(ListenScope listenScope, Guid ecId, HandleUIAutomationEventMessage listener)
        {
            var ec = DataManager.GetDefaultInstance().GetElementContext(ecId);
            var la = new ListenAction(listenScope, ec, listener);

            sListenActions.Add(la.Id, la);

            return(la.Id);
        }
        private static TreeScope GetUIAScope(ListenScope listenScope)
        {
            switch (listenScope)
            {
            case ListenScope.Element:
                return(TreeScope.TreeScope_Element);

            case ListenScope.Descendants:
                return(TreeScope.TreeScope_Descendants);

            default:
                return(TreeScope.TreeScope_Subtree);
            }
        }