Пример #1
0
        /////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // HandleStructureChangedEvent()
        //
        // Sample application's handler for UIA StructureChanged events.
        //
        // Runs on a background thread create by UIA.
        //
        /////////////////////////////////////////////////////////////////////////////////////////////////
        public void HandleStructureChangedEvent(IUIAutomationElement sender, StructureChangeType changeType, int[] array)
        {
            // A structure changed event has been sent by the browser window element or some descendant of it.

            // Check that this event hasn't arrived around the time we're removing the event handler on shutdown.
            if (!_fAddedEventHandler)
            {
                return;
            }

            // For this sample, all the event handler needs to do is notify the main UI thread that the
            // list of hyperlinks should be refreshed to make sure it's showing the most current list.

            // A shipping event handler might want to interact with the sender of the events.
            // For example if this was a Focus Changed event handler, it might get the cached
            // bounding rect from the sender to highlight where focus is now. Preferably the
            // work done is kept to a minimum in the UIA event handler itself, so the handler
            // could signal to another thread that action is required.

            // Note that the browser window can send many Structure Changed events in rapid succession.
            // There's nothing to be gained by trying to act on every event received, so only refresh
            // the list of hyperlinks 2 seconds after an event is received. (This delay would want to
            // be tuned for the best user experience in a shipping app.)

            if (_timerRefresh == null)
            {
                _timerRefresh          = new System.Windows.Forms.Timer();
                _timerRefresh.Tick    += new EventHandler(timerRefresh_Tick);
                _timerRefresh.Interval = 2000;

                _timerRefresh.Start();
            }
        }
Пример #2
0
        private void MyStructureChangedHandler(object obj, StructureChangeType sct, bool isPropagated)
        {
            switch (sct)
            {
            case StructureChangeType.AddPreEdge:    SelfValidState = false; break;

            case StructureChangeType.RemovePreEdge: SelfValidState = false; break;

            case StructureChangeType.AddCostart:    SelfValidState = false; break;

            case StructureChangeType.RemoveCostart: SelfValidState = false; break;

            case StructureChangeType.AddPostEdge:                                                   break;

            case StructureChangeType.RemovePostEdge:                                                break;

            case StructureChangeType.AddCofinish:                                                   break;

            case StructureChangeType.RemoveCofinish:                                                break;

            case StructureChangeType.AddChildEdge:                                                  break;

            case StructureChangeType.RemoveChildEdge:                                               break;

            case StructureChangeType.NewSynchronizer: SelfValidState = false; break;

            case StructureChangeType.Unknown: SelfValidState = false; if (s_diagnostics)
                {
                    Debugger.Break();
                }
                break;

            default: throw new ApplicationException("Unknown StructureChangeType, " + sct + ", referenced.");
            }
        }
Пример #3
0
        private void OnStructureChange(object obj, StructureChangeType chType, bool isPropagated)
        {
            #region Rule #1. If a vertex loses or gains a predecessor, it invalidates all of its sucessors.
            if (StructureChangeTypeSvc.IsPreEdgeChange(chType))
            {
                if (obj is Vertex)
                {
                    Vertex    vertex     = (Vertex)obj;
                    ArrayList successors = new ArrayList();
                    successors.AddRange(vertex.GetSuccessors());
                    while (successors.Count > 0)
                    {
                        IHasValidity ihv = (IHasValidity)successors[0];
                        successors.RemoveAt(0);
                        if (ihv is Tasks.Task)
                        {
                            ((Tasks.Task)ihv).SelfValidState = false;
                        }
                        else
                        {
                            successors.AddRange(ihv.GetSuccessors());
                        }
                    }
                }
            }
            #endregion

            m_dirty = true;
        }
Пример #4
0
        internal static void RaiseStructureChangedEvent(StructureChangeType type,
                                                        IRawElementProviderFragment provider)
        {
            if (AutomationInteropProvider.ClientsAreListening)
            {
                int [] runtimeId = null;
                if (type == StructureChangeType.ChildRemoved)
                {
                    if (provider.FragmentRoot == null)                     //FIXME: How to fix it?
                    {
                        runtimeId = provider.GetRuntimeId();
                    }
                    else
                    {
                        runtimeId = provider.FragmentRoot.GetRuntimeId();
                    }
                }
                else if (type == StructureChangeType.ChildrenBulkAdded ||
                         type == StructureChangeType.ChildrenBulkRemoved)
                {
                    runtimeId = new int[] { 0 }
                }
                ;
                else
                {
                    runtimeId = provider.GetRuntimeId();
                }

                var invalidatedArgs = new StructureChangedEventArgs(type, runtimeId);
                AutomationInteropProvider.RaiseStructureChangedEvent(provider, invalidatedArgs);
            }
        }
 public StructureChangedEventArgs(StructureChangeType structureChangeType, int[] runtimeId)
     : base(eventId: AutomationElement.StructureChangedEvent)
 {
     Validate.ArgumentNotNull(parameter: runtimeId, parameterName: nameof(runtimeId));
     StructureChangeType = structureChangeType;
     this._runtimeId     = (int[])runtimeId.Clone();
 }
Пример #6
0
        public void HandleStructureChangedEvent(IUIAutomationElement sender, StructureChangeType changeType, int[] runtimeId)
        {
            StructureChangedEventArgs args = new StructureChangedEventArgs(
                (StructureChangeType)changeType,
                (int[])runtimeId);

            this._structureChangeHandler(AutomationElement.Wrap(sender), args);
        }
Пример #7
0
 /// <summary>
 /// Determines whether the StructureChangeType signifies a removal.
 /// </summary>
 /// <param name="sct">The StructureChangeType.</param>
 /// <returns>true if the StructureChangeType  signifies a removal.</returns>
 public static bool IsRemovalChange(StructureChangeType sct)
 {
     return(sct.Equals(StructureChangeType.RemovePostEdge) ||
            sct.Equals(StructureChangeType.RemovePreEdge) ||
            sct.Equals(StructureChangeType.RemoveCostart) ||
            sct.Equals(StructureChangeType.RemoveCofinish) ||
            sct.Equals(StructureChangeType.RemoveChildEdge));
 }
Пример #8
0
 /// <summary>
 /// Determines whether the StructureChangeType signifies an addition.
 /// </summary>
 /// <param name="sct">The StructureChangeType.</param>
 /// <returns>true if the StructureChangeType  signifies an addition.</returns>
 public static bool IsAdditionChange(StructureChangeType sct)
 {
     return(sct.Equals(StructureChangeType.AddPostEdge) ||
            sct.Equals(StructureChangeType.AddPreEdge) ||
            sct.Equals(StructureChangeType.AddCostart) ||
            sct.Equals(StructureChangeType.AddCofinish) ||
            sct.Equals(StructureChangeType.NewSynchronizer) ||
            sct.Equals(StructureChangeType.AddChildEdge));
 }
Пример #9
0
 public StructureChangedEventArgs(StructureChangeType structureChangeType, int[] runtimeId) : base(AutomationElementIdentifiers.StructureChangedEvent)
 {
     if (runtimeId == null)
     {
         throw new ArgumentNullException("runtimeId");
     }
     this._structureChangeType = structureChangeType;
     this._runtimeID           = (int[])runtimeId.Clone();
 }
        public void ValuesTest()
        {
            int[] fakeRuntimeId            = { 0 };
            StructureChangeType       sct  = StructureChangeType.ChildrenBulkAdded;
            StructureChangedEventArgs args =
                new StructureChangedEventArgs(sct, fakeRuntimeId);

            Assert.AreEqual(AutomationElementIdentifiers.StructureChangedEvent, args.EventId, "Check Event Id");
            Assert.AreEqual(sct, args.StructureChangeType, "Check StructureChangeType member");
        }
Пример #11
0
 public NavigationEventArgs(bool raiseEvent,
                            StructureChangeType changeType,
                            FragmentControlProvider childProvider,
                            int index)
     : base()
 {
     this.raiseEvent    = raiseEvent;
     this.changeType    = changeType;
     this.childProvider = childProvider;
     this.index         = index;
 }
Пример #12
0
		public NavigationEventArgs (bool raiseEvent,
		                            StructureChangeType changeType,
		                            FragmentControlProvider childProvider,
		                            int index)
			: base ()
		{
			this.raiseEvent = raiseEvent;
			this.changeType = changeType;
			this.childProvider = childProvider;
			this.index = index;
		}
Пример #13
0
        public StructureChangedEventTuple GetStructureChangedEventFrom(StructureChangeType changeType)
        {
            foreach (StructureChangedEventTuple tuple in StructureChangedEvents)
            {
                if (tuple.e.StructureChangeType == changeType)
                {
                    return(tuple);
                }
            }

            return(null);
        }
Пример #14
0
        public int GetStructureChangedEventCount(StructureChangeType changeType)
        {
            int count = 0;

            foreach (StructureChangedEventTuple tuple in StructureChangedEvents)
            {
                if (tuple.e.StructureChangeType == changeType)
                {
                    count++;
                }
            }
            return(count);
        }
        public void HandleStructureChangedEvent(IUIAutomationElement sender, StructureChangeType changeType, int[] runtimeId)
        {
            var m = EventMessage.GetInstance(EventType.UIA_StructureChangedEventId, sender);

            if (m != null)
            {
                m.Properties = new List <KeyValuePair <string, dynamic> >
                {
                    new KeyValuePair <string, dynamic>("StructureChangeType", changeType),
                    new KeyValuePair <string, dynamic>("Runtime Id", runtimeId.ConvertInt32ArrayToString()),
                };
                this.ListenEventMessage(m);
            }
        }
Пример #16
0
        protected void NotifyOnChildStructureChanged(
            FragmentControlProvider subjectProvider, StructureChangeType structureChangeType, bool emitUiaEvents)
        {
            if (NavigationUpdated != null)
            {
                var args = new NavigationEventArgs(emitUiaEvents, structureChangeType, subjectProvider);
                NavigationUpdated(this, args);
            }

            if (emitUiaEvents)
            {
                Helper.RaiseStructureChangedEvent(structureChangeType, subjectProvider);
                Helper.RaiseStructureChangedEvent(StructureChangeType.ChildrenInvalidated, this);
            }
        }
Пример #17
0
        public static Task <Option <NodeError> > addSyncStructureEventWatcher(AutomationElement node
                                                                              , TreeScope scope
                                                                              , StructureChangeType chgType)
        {
            var t = new TaskCompletionSource <Option <NodeError> >();

            Automation.AddStructureChangedEventHandler(
                node
                , scope
                , (sender, args) =>
            {
                try
                {
                    var autElem = sender as AutomationElement;

                    if (chgType == StructureChangeType.ChildrenBulkRemoved)
                    {
                        t.TrySetResult(None);
                    }
                    else if (chgType == StructureChangeType.ChildRemoved)
                    {
                        t.TrySetResult(None);
                    }
                    else if (chgType == StructureChangeType.ChildAdded)
                    {
                        t.TrySetResult(None);
                    }
                    else if (chgType == StructureChangeType.ChildrenBulkAdded)
                    {
                        t.TrySetResult(None);
                    }
                    else if (chgType == StructureChangeType.ChildrenInvalidated)
                    {
                        t.TrySetResult(None);
                    }
                    else
                    {
                    }
                }
                catch (Exception)
                {
                    throw new NotImplementedException();
                }
            }
                );

            return(t.Task);
        }
Пример #18
0
 private void RaiseNavigationEvent(StructureChangeType type,
                                   ref FragmentControlProvider provider,
                                   SWF.ScrollBar scrollbar)
 {
     if (type == StructureChangeType.ChildAdded)
     {
         provider = subject.GetScrollbarProvider(scrollbar);
         provider.Initialize();
         subject.AddChildProvider(provider);
     }
     else
     {
         subject.RemoveChildProvider(provider);
         provider.Terminate();
         provider = null;
     }
 }
Пример #19
0
        internal static void RaiseStructureChangedEvent(IElement element, StructureChangeType type)
        {
            StructureChangedEventArgs e;

            int [] runtimeId = (element != null
                                ? element.RuntimeId
                                : new int [0]);
            e = new StructureChangedEventArgs(type, runtimeId);
            foreach (StructureChangedEventHandlerData handler in structureEventHandlers)
            {
                if (IsElementInScope(element, handler.Element, handler.Scope))
                {
                    handler.EventHandler(SourceManager.GetOrCreateAutomationElement(element),
                                         e);
                    break;
                }
            }
        }
Пример #20
0
        private void OnStructureChanged(AutomationElement ae,
                                        StructureChangeType changeType,
                                        int[]               values)
        {
            switch (changeType)
            {
            case StructureChangeType.ChildAdded:
            case StructureChangeType.ChildrenBulkAdded:
                Awaiter_DoFilter(ae,
                                 ElementAddedWaiters);
                break;

            case StructureChangeType.ChildRemoved:
            case StructureChangeType.ChildrenBulkRemoved:
                Awaiter_DoFilter(ae,
                                 ElementRemovedWaiters);
                break;
            }
        }
Пример #21
0
        public StructureChangedEventTuple GetStructureChangedEventAt(int index,
                                                                     StructureChangeType changeType)
        {
            if (index >= StructureChangedEvents.Count || index < 0)
            {
                return(null);
            }

            int counter = 0;

            foreach (StructureChangedEventTuple tuple in StructureChangedEvents)
            {
                if (tuple.e.StructureChangeType == changeType)
                {
                    if (counter++ == index)
                    {
                        return(tuple);
                    }
                }
            }

            return(null);
        }
Пример #22
0
		public StructureChangedEventTuple GetStructureChangedEventFrom (StructureChangeType changeType)
		{
			foreach (StructureChangedEventTuple tuple in StructureChangedEvents) {
				if (tuple.e.StructureChangeType == changeType)
					return tuple;
			}

			return null;
		}
Пример #23
0
		public StructureChangedEventTuple GetStructureChangedEventFrom (object element, StructureChangeType changeType)
		{
			foreach (StructureChangedEventTuple tuple in StructureChangedEvents) {
				if (tuple.e.StructureChangeType == changeType && tuple.provider == element)
					return tuple;
			}

			return null;
		}
        // fire the structure change event if there is a client listening for it.
        private void MaybeFireStructureChangeEvent(int eventId, Hashtable eventTable, IntPtr hwnd, int idObject, int idChild)
        {
            // if the 2-nd level table contains an entry for this event and element is not the root
            // (the host hwnd provider takes care of structure changed events for the root.)
            if (eventTable.ContainsKey(AutomationElement.StructureChangedEvent) && !IsClientObject(idObject, idChild))
            {
                // Note: src element for ChildRemoved cases needs to be the parent, but the runtime id is the child!

                // the type of structure changed event that we will fire depends on which event we are receiving.
                // the type then determines the src element -- either the parent or the child -- and the runtime id
                // -- either the parent or the child -- for the event arguments.
                IRawElementProviderFragment srcElement;
                int[] runtimeId          = null;
                StructureChangeType type = StructureChangeType.ChildAdded; // Actual value is assigned below; any value will do here, to init the var
                switch (eventId)
                {
                case NativeMethods.EVENT_OBJECT_CREATE:
                case NativeMethods.EVENT_OBJECT_SHOW:
                    // src element is child. runtime id is child.
                    srcElement = (IRawElementProviderFragment)MsaaNativeProvider.Create(hwnd, idChild, idObject);
                    if (srcElement != null)
                    {
                        runtimeId = srcElement.GetRuntimeId();
                        type      = StructureChangeType.ChildAdded;
                    }
                    break;

                //case NativeMethods.EVENT_OBJECT_DESTROY:
                // src element is parent. runtime id is child.

                // There is nothing we can do in this case. Since the object is destroyed we can't instantiate
                // it in order to get its runtime ID. Even if it had a non-zero child id such that we could
                // instantiate its parent we still couldn't determine the runtime ID of the child that was destroyed.
                // There's also no guarantee that an EVENT_OBJECT_DESTROY will have a corresponding EVENT_OBJECT_CREATE
                // and even if it did it might use a different object id so we can't cache the information either.
                // (Trident for example uses a cyclic counter to generate object ids so the object id can vary for
                // the same object from one event to the next!)

                case NativeMethods.EVENT_OBJECT_HIDE:
                    // src element is parent. runtime id is child.
                    srcElement = (IRawElementProviderFragment)MsaaNativeProvider.Create(hwnd, idChild, idObject);
                    if (srcElement != null)
                    {
                        runtimeId  = srcElement.GetRuntimeId();
                        srcElement = (IRawElementProviderFragment)srcElement.Navigate(NavigateDirection.Parent);
                        type       = StructureChangeType.ChildRemoved;
                    }
                    break;

                default:
                    Debug.Assert(eventId == NativeMethods.EVENT_OBJECT_REORDER);
                    // src element is parent. runtime id is parent.
                    srcElement = (IRawElementProviderFragment)MsaaNativeProvider.Create(hwnd, idChild, idObject);
                    if (srcElement != null)
                    {
                        runtimeId = srcElement.GetRuntimeId();
                        type      = StructureChangeType.ChildrenReordered;
                    }
                    break;
                }

                if (srcElement != null)
                {
                    // fire the event
                    StructureChangedEventArgs eventArgs = new StructureChangedEventArgs(type, runtimeId);
                    //Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Firing structure change event for {0}", hwnd), "NativeMsaaProxy");
                    AutomationInteropProvider.RaiseStructureChangedEvent(srcElement, eventArgs);
                }
            }
        }
Пример #25
0
 /// -------------------------------------------------------------------
 /// <summary>
 /// Method determines if the desired event was fired
 /// </summary>
 /// -------------------------------------------------------------------
 public virtual EventFired WasEventFired(AutomationElement element, StructureChangeType structureChangeType)
 {
     return EventObject.WasEventFired(new EventItem(element, structureChangeType));
 }
Пример #26
0
 private static extern int RawUiaRaiseStructureChangedEvent(IRawElementProviderSimple provider, StructureChangeType structureChangeType, int[] runtimeId, int runtimeIdLen);
 /// <inheritdoc/>
 public void HandleStructureChangedEvent(AutomationElement sender, StructureChangeType changeType, int[] runtimeId)
 {
     this.callAction(sender, changeType, runtimeId);
 }
Пример #28
0
 public StructureChangedEventArgs(StructureChangeType structureChangeType, int[] runtimeId)
     : base(AutomationElementIdentifiers.StructureChangedEvent)
 {
     if (runtimeId == null)
     {
         throw new ArgumentNullException("runtimeId");
     }
     this._structureChangeType = structureChangeType;
     this._runtimeID = (int[])runtimeId.Clone();
 }
Пример #29
0
 /// <summary>
 /// Determines whether the StructureChangeType signifies a change in a synchronizer.
 /// </summary>
 /// <param name="sct">The StructureChangeType.</param>
 /// <returns>true if the StructureChangeType  signifies a change in a synchronizer.</returns>
 public static bool IsSynchronizerChange(StructureChangeType sct)
 {
     return(sct.Equals(StructureChangeType.NewSynchronizer));
 }
Пример #30
0
		private void RaiseNavigationEvent (StructureChangeType type,
		                                   ref FragmentControlProvider provider,
		                                   SWF.ScrollBar scrollbar)
		{
			if (type == StructureChangeType.ChildAdded) {
				provider = subject.GetScrollbarProvider (scrollbar);
				provider.Initialize ();
				subject.AddChildProvider (provider);
			} else {
				subject.RemoveChildProvider (provider);
				provider.Terminate ();
				provider = null;
			}
		}
Пример #31
0
		public int GetStructureChangedEventCount (StructureChangeType changeType)
		{
			int count = 0;
			
			foreach (StructureChangedEventTuple tuple in StructureChangedEvents) {
				if (tuple.e.StructureChangeType == changeType)
					count++;
			}
			return count;
		}
Пример #32
0
 internal static void UiaRaiseStructureChangedEvent(IRawElementProviderSimple provider, StructureChangeType structureChangeType, int[] runtimeId)
 {
     CheckError(RawUiaRaiseStructureChangedEvent(provider, structureChangeType, runtimeId, (runtimeId == null) ? 0 : runtimeId.Length));
 }
Пример #33
0
 private static extern int RawUiaRaiseStructureChangedEvent(IRawElementProviderSimple provider, StructureChangeType structureChangeType, int[] runtimeId, int runtimeIdLen);
Пример #34
0
        /// -------------------------------------------------------------------
        /// <summary>
        /// Use the application's callback to cause a structure change to occur
        /// </summary>
        /// -------------------------------------------------------------------
        void TS_CauseStructureChange(AutomationElement element, StructureChangeType structureChangeType, CheckType ct)
        {
            if (_structChange == null)
                _structChange = _appCommands.GetIWUIStructureChange();

            _structChange.CauseStructureChange(element, structureChangeType);

            Comment(structureChangeType + " has occured");

            m_TestStep++;
        }
Пример #35
0
        /// -------------------------------------------------------------------
        /// <summary>
        /// Tests to see if the element supports testing the structure change events
        /// </summary>
        /// -------------------------------------------------------------------
        private void TS_ElementSupportChangeEvents(AutomationElement element, StructureChangeType structureChangeType, CheckType checkType)
        {
            if (_structChange == null)
                _structChange = _appCommands.GetIWUIStructureChange();

            if (!_structChange.DoesControlSupportStructureChange(element, structureChangeType))
                ThrowMe(checkType);

            Comment("Control supports testing " + structureChangeType.ToString());

            m_TestStep++;
        }
Пример #36
0
		internal static void RaiseStructureChangedEvent (IElement element, StructureChangeType type)
		{
			StructureChangedEventArgs e;
			int [] runtimeId = (element != null
				? element.RuntimeId
				: new int [0]);
			e = new StructureChangedEventArgs (type, runtimeId);
			foreach (StructureChangedEventHandlerData handler in structureEventHandlers) {
				if (IsElementInScope (element, handler.Element, handler.Scope)) {
					handler.EventHandler (SourceManager.GetOrCreateAutomationElement (element),
						e);
					break;
				}
			}
		}
Пример #37
0
		public StructureChangedEventArgs (StructureChangeType structureChangeType, int[] runtimeId) :
			base (AutomationElementIdentifiers.StructureChangedEvent)
		{
			this.structureChangeType = structureChangeType;
			this.runtimeId = runtimeId;
		}
Пример #38
0
 /// <summary>
 /// Determines whether StructureChangeType was a pre-edge change.
 /// </summary>
 /// <param name="sct">The StructureChangeType.</param>
 /// <returns>true if the StructureChangeType signifies a change in a predecessor-edge.
 /// </returns>
 public static bool IsPreEdgeChange(StructureChangeType sct)
 {
     return(sct.Equals(StructureChangeType.AddPreEdge) || sct.Equals(StructureChangeType.RemovePreEdge));
 }
Пример #39
0
public void ParseStructureChange (out StructureChangeType type, out Gst.Element owner, out bool busy) {
  if (Type != MessageType.StructureChange)
    throw new ArgumentException ();

  IntPtr raw_ptr;

  gst_message_parse_structure_change (Handle, out type, out raw_ptr, out busy);
  owner = Gst.GLib.Object.GetObject (raw_ptr, false) as Gst.Element;
}
Пример #40
0
        /// -------------------------------------------------------------------
        /// <summary>
        /// Verify that the property changed
        /// </summary>
        /// -------------------------------------------------------------------
        internal void TS_VerifyLogicalStructureChangedEventArgs(AutomationElement element, EventFired shouldFire, StructureChangeType properties, CheckType checkType)
        {
            if (_testEvents)
            {
                Comment("Start: Looking for event that might have been fired");

                EventFired ActualFired = m_StructureChangedEvents.WasEventFired(element, properties);

                Comment("End : Looking for event that might have been fired");
                TestIfEventShouldFire(shouldFire, ActualFired, properties, checkType);
            }
            else
            {
                Comment("Not testing for events");
            }

            m_TestStep++;
        }
Пример #41
0
static extern void gst_message_parse_structure_change (IntPtr msg, out StructureChangeType type, out IntPtr owner, out bool busy);
Пример #42
0
		public NavigationEventArgs (bool raiseEvent,
		                            StructureChangeType changeType,
		                            FragmentControlProvider childProvider)
			: this (raiseEvent, changeType, childProvider, -1)
		{
		}
Пример #43
0
public static Message NewStructureChange (Gst.Object src, StructureChangeType type, Gst.Element owner, bool busy) {
  Message msg = (Message) Gst.MiniObject.GetObject (gst_message_new_structure_change (src.Handle, type, owner.Handle, busy), true);

  return msg;
}
Пример #44
0
 private void StructureAction(AutomationElement automationAutomationElement, StructureChangeType arg2, int[] arg3)
 {
     AddToList($"Structure change on {ElementToString(automationAutomationElement)}: {arg2}");
 }
Пример #45
0
static extern IntPtr gst_message_new_structure_change (IntPtr src, StructureChangeType type, IntPtr owner, bool busy);
Пример #46
0
 internal static void UiaRaiseStructureChangedEvent(IRawElementProviderSimple provider, StructureChangeType structureChangeType, int[] runtimeId)
 {
     CheckError(RawUiaRaiseStructureChangedEvent(provider, structureChangeType, runtimeId, (runtimeId == null) ? 0 : runtimeId.Length));
 }
Пример #47
0
 /// <summary>
 /// Determines whether the StructureChangeType signifies a co-finish change.
 /// </summary>
 /// <param name="sct">The StructureChangeType.</param>
 /// <returns>true if the StructureChangeType signifies a change in a co-finish.</returns>
 public static bool IsCofinishChange(StructureChangeType sct)
 {
     return(sct.Equals(StructureChangeType.AddCofinish) || sct.Equals(StructureChangeType.RemoveCofinish));
 }
 public static extern HRESULT UiaRaiseStructureChangedEvent(IRawElementProviderSimple pProvider, StructureChangeType structureChangeType, int[] pRuntimeId, int cRuntimeIdLen);
Пример #49
0
 /// <summary>
 /// Determines whether the StructureChangeType signifies a change in a child.
 /// </summary>
 /// <param name="sct">The StructureChangeType.</param>
 /// <returns>true if the StructureChangeType  signifies a change in a child.</returns>
 public static bool IsChildChange(StructureChangeType sct)
 {
     return(sct.Equals(StructureChangeType.AddChildEdge) || sct.Equals(StructureChangeType.RemoveChildEdge));
 }
Пример #50
0
		public StructureChangedEventTuple GetStructureChangedEventAt (int index,
		                                                              StructureChangeType changeType)
		{
			if (index >= StructureChangedEvents.Count || index < 0)
				return null;

			int counter = 0;
			foreach (StructureChangedEventTuple tuple in StructureChangedEvents) {
				if (tuple.e.StructureChangeType == changeType) {
					if (counter++ == index) 
					    return tuple;
				}
			}			
			
			return null;
		}
Пример #51
0
        /// -------------------------------------------------------------------
        /// <summary>
        /// Main driver for the tests to call that will cause some structure 
        /// change even to occur.
        /// </summary>
        /// -------------------------------------------------------------------
        internal void TestLogicalStructureChangeEvent(StructureChangeType structureChangeType)
        {

            EventObject.EventList = new ArrayList();
            Exception caughtException = null;
            try
            {
                // 0) Precondition: Determine if the application supports the custom interface callback for specific test applications
                TS_SupportsApplicationCallback(CheckType.IncorrectElementConfiguration);

                // 1) Precondition: Determine is this appliction supports driving structure changes
                TS_SupportsStructureChangeEvents(CheckType.IncorrectElementConfiguration);

                // 2) Precondition: Determine if the specific element supports structure change
                TS_ElementSupportChangeEvents(m_le, structureChangeType, CheckType.IncorrectElementConfiguration);

                // 3) Step: Add LogicalTreeStructureListener
                TS_AddLogicalTreeStructureListener(true, m_le, TreeScope.Element, CheckType.Verification);

                // 4) Step: Invoke the 'Bulk Add' menu item	
                TS_CauseStructureChange(m_le, structureChangeType, CheckType.Verification);

                // 5) Step: Wait for the LogicalStructureChangedEvent to be fired
                TSC_WaitForEvents(1);

                // 6) Step: That LogicalStructureChangedEvent was fired
                if (m_le.Current.FrameworkId.ToLower() == "win32" &&
                    m_le.Current.ControlType == ControlType.List &&
                    (structureChangeType == StructureChangeType.ChildAdded || structureChangeType == StructureChangeType.ChildRemoved))
                {
                    // Win32 controls can't determine when ChildAdd?Remove happens so fire a ChildInvalidated instead
                    TS_VerifyLogicalStructureChangedEventArgs(m_le, EventFired.True, StructureChangeType.ChildrenInvalidated, CheckType.Verification);
                }
                else
                {
                    TS_VerifyLogicalStructureChangedEventArgs(m_le, EventFired.True, structureChangeType, CheckType.Verification);
                }
            }
            catch (Exception exception)
            {
                caughtException = exception;
            }
            finally
            {
                if (caughtException is IncorrectElementConfigurationForTestException)
                {
                    m_TestStep++;
                }
                else
                {
                    // 7) Step: Reset the control to it's initial state
                    TS_ResetControlToInitialState(m_le, CheckType.Verification);
                }
                if (null != caughtException)
                    throw caughtException;
            }

        }