Example #1
0
        internal void RaiseAutomationPropertyChangedEvent(IRawElementProviderSimple provider,
                                                          AutomationPropertyChangedEventArgs e)
        {
            if (provider == null)
            {
                return;
            }
            var wrapper = AutomationBridge.Instance.FindWrapperByProvider(provider);

            if (wrapper == null)
            {
                return;
            }
            lock (propertyEventHandlers) {
                foreach (AutomationPropertyChangedHandlerData handler in propertyEventHandlers)
                {
                    if (IsProviderInScope(provider, handler.Provider, handler.Scope))
                    {
                        int eventPropId = e.Property.Id;
                        foreach (int propId in handler.Properties)
                        {
                            if (eventPropId == propId)
                            {
                                var oldValue = SerializeAutomationPropertyValue(propId, e.OldValue);
                                var newValue = SerializeAutomationPropertyValue(propId, e.NewValue);
                                OnAutomationPropertyChanged(handler.HandlerId,
                                                            e.EventId.Id, wrapper.Path,
                                                            eventPropId, oldValue, newValue);
                                break;
                            }
                        }
                    }
                }
            }
        }
Example #2
0
 public static void RaiseAutomationPropertyChangedEvent(
     IRawElementProviderSimple element,
     AutomationPropertyChangedEventArgs e)
 {
     Validate.ArgumentNotNull(parameter: element, parameterName: nameof(element));
     Validate.ArgumentNotNull(parameter: e, parameterName: nameof(e));
     Marshal.ThrowExceptionForHR(errorCode: NativeMethods.UiaRaiseAutomationPropertyChangedEvent(provider: element, id: e.Property.Id, oldValue: e.OldValue, newValue: e.NewValue));
 }
Example #3
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        // Recursively Raise an Event for all the sub elements
        override internal void RecursiveRaiseEvents(object idProp, AutomationPropertyChangedEventArgs e)
        {
            AutomationInteropProvider.RaiseAutomationPropertyChangedEvent(this, e);
            for (ProxySimple el = GetFirstChild(); el != null; el = this.GetNextSibling(el))
            {
                el.RecursiveRaiseEvents(idProp, e);
            }
        }
Example #4
0
        internal static void RaisePropertyChangedEvent(IElement element, AutomationProperty property, object oldValue, object newValue)
        {
            AutomationPropertyChangedEventArgs e;

            e = new AutomationPropertyChangedEventArgs(property,
                                                       oldValue,
                                                       newValue);
            RaisePropertyChangedEvent(element, e);
        }
Example #5
0
        private void HideOnMinimize(object sender, AutomationPropertyChangedEventArgs e)
        {
            this.Minimized?.Invoke(sender, new WindowInfoEventArgs(this));

            if ((WindowVisualState)e.NewValue == WindowVisualState.Minimized)
            {
                this.Hide();
            }
        }
Example #6
0
        public override void RaiseAutomationPropertyChangedEvent(AutomationPropertyChangedEventArgs e)
        {
            if (editableTextExpert.RaiseAutomationPropertyChangedEvent(e))
            {
                return;
            }

            base.RaiseAutomationPropertyChangedEvent(e);
        }
Example #7
0
        private void OnAutomationPropertyChanged(object o, AutomationPropertyChangedEventArgs args)
        {
            if (args.Property == ValuePatternIdentifiers.ValueProperty)
            {
                AutomationControlType controlType
                    = peer.GetAutomationControlType();
                if (controlType == AutomationControlType.Edit ||
                    controlType == AutomationControlType.Document)
                {
                    TextAdapter textAdapter
                        = new TextAdapter((TextImplementor)adapter);

                    string oldValue = (string)args.OldValue;
                    string newValue = (string)args.NewValue;

                    if (oldValue == newValue)
                    {
                        return;
                    }

                    if (newValue.StartsWith(oldValue))
                    {
                        textAdapter.EmitTextChanged(Atk.TextChangedDetail.Insert,
                                                    oldValue.Length,
                                                    newValue.Length - oldValue.Length);
                    }
                    else if (oldValue.StartsWith(newValue))
                    {
                        textAdapter.EmitTextChanged(Atk.TextChangedDetail.Delete,
                                                    newValue.Length,
                                                    oldValue.Length - newValue.Length);
                    }
                    else
                    {
                        // XXX: Improve this algorithm so that
                        // it diffs the two values (maybe using
                        // a modified Levenshtein alg?) and
                        // send just what is deleted or
                        // inserted to avoid thrashing ATs.
                        textAdapter.EmitTextChanged(Atk.TextChangedDetail.Delete,
                                                    0, oldValue.Length);

                        textAdapter.EmitTextChanged(Atk.TextChangedDetail.Insert,
                                                    0, newValue.Length);
                    }
                }
                else
                {
                    // Mirror Gtk+'s behavior here somewhat
                    // and only fire visible_data_changed
                    // in the case of label and label-like
                    // elements.
                    adapter.EmitSignal("visible_data_changed");
                }
            }
        }
Example #8
0
// </Snippet122>

// <Snippet123>
        /// <summary>
        /// Raises an event when the IsEnabled property on a control is changed.
        /// </summary>
        /// <param name="provider">The UI Automation provider for the control.</param>
        /// <param name="newValue">The current enabled state.</param>
        private void RaiseEnabledEvent(IRawElementProviderSimple provider, bool newValue)
        {
            if (AutomationInteropProvider.ClientsAreListening)
            {
                AutomationPropertyChangedEventArgs args =
                    new AutomationPropertyChangedEventArgs(AutomationElement.IsEnabledProperty,
                                                           !newValue, newValue);
                AutomationInteropProvider.RaiseAutomationPropertyChangedEvent(provider, args);
            }
        }
        public void RaiseAutomationPropertyChangedEvent(object provider, AutomationPropertyChangedEventArgs e)
        {
            var providerSimple = provider as IRawElementProviderSimple;

            if (providerSimple == null)
            {
                return;
            }
            ClientEventManager.RaiseAutomationPropertyChangedEvent(providerSimple, e);
        }
Example #10
0
 public override void RaiseAutomationPropertyChangedEvent(AutomationPropertyChangedEventArgs e)
 {
     if (e.Property == RangeValuePatternIdentifiers.ValueProperty)
     {
         Notify("accessible-value");
     }
     else
     {
         base.RaiseAutomationPropertyChangedEvent(e);
     }
 }
Example #11
0
        /// <summary>
        /// Handler for property change events
        /// </summary>
        /// <param name="src">The source whose properties changed.</param>
        /// <param name="e">Event arguments.</param>
        private void OnPropertyChange(object src, AutomationPropertyChangedEventArgs e)
        {
            if (src == null)
            {
                return;
            }

            AutomationEventVerifier.EventFired(_targetEvent);

            RemovePropertyChangeHandler();
        }
Example #12
0
 public override void RaiseAutomationPropertyChangedEvent(AutomationPropertyChangedEventArgs e)
 {
     if (e.Property == TogglePatternIdentifiers.ToggleStateProperty)
     {
         NotifyStateChange(Atk.StateType.Checked, IsToggled((ToggleState)e.NewValue));
     }
     else
     {
         base.RaiseAutomationPropertyChangedEvent(e);
     }
 }
Example #13
0
 private void OnAutomationPropertyChanged(object o, AutomationPropertyChangedEventArgs args)
 {
     if (args.Property == SelectionItemPatternIdentifiers.IsSelectedProperty)
     {
         if (WasSelected != (bool)args.NewValue)
         {
             WasSelected = !WasSelected;
             adapter.NotifyStateChange(Atk.StateType.Selected);
         }
     }
 }
Example #14
0
 public override void RaiseAutomationPropertyChangedEvent(AutomationPropertyChangedEventArgs e)
 {
     if (e.Property == SelectionPatternIdentifiers.SelectionProperty)
     {
         EmitSignal("selection_changed");
         EmitVisibleDataChanged();
     }
     else
     {
         base.RaiseAutomationPropertyChangedEvent(e);
     }
 }
Example #15
0
        // When the test app crashes because of a catchable exception,
        // it posts the exception's contents to a TextBox immediately before closing,
        // which enables us to find out what the exception was.
        // We normally can't since the application exists in a different process,
        // so we don't catch any exceptions that it encounters, but this works around that.
        public void SinkEvent(WaiterEventArgs eventArgs)
        {
            AutomationPropertyChangedEventArgs args = eventArgs.EventArgs as AutomationPropertyChangedEventArgs;
            string exceptionMessage = args.NewValue as string;

            // For some reason, the exception message uses \r as the only newline character, which console windows don't like.
            // We need to make sure that it uses the correct newline character everywhere.
            exceptionMessage = exceptionMessage.Replace("\n\r", "\n").Replace("\r", "\n").Replace("\n", Environment.NewLine);

            Log.Error("Test app has crashed! This will likely be the root cause of any ElementNotAvailableExceptions for this test.");
            Log.Error("Exception from app: " + exceptionMessage);
        }
        static bool ExpandCollapseStateFilter(
            AutomationPropertyChangedEventArgs args,
            ExpandCollapseState state)
        {
            var flag = false;

            if (ExpandCollapsePattern.ExpandCollapseStateProperty == args.Property && state == (ExpandCollapseState)args.NewValue)
            {
                flag = true;
            }
            return(flag);
        }
Example #17
0
 public override void RaiseAutomationPropertyChangedEvent(AutomationPropertyChangedEventArgs e)
 {
     if (e.Property.Id == SelectionItemPatternIdentifiers.IsSelectedProperty.Id)
     {
         bool selected = (bool)e.NewValue;
         NotifyStateChange(Atk.StateType.Checked, selected);
     }
     else
     {
         base.RaiseAutomationPropertyChangedEvent(e);
     }
 }
Example #18
0
 public override void RaiseAutomationPropertyChangedEvent(AutomationPropertyChangedEventArgs e)
 {
     if (e.Property == TogglePatternIdentifiers.ToggleStateProperty)
     {
         //if it's a toggle, it should not be a basic Button class, but CheckBox or other
         throw new NotSupportedException("Toggle events should not land here (should not be reached)");
     }
     else
     {
         base.RaiseAutomationPropertyChangedEvent(e);
     }
 }
Example #19
0
 /// -------------------------------------------------------------------
 /// <summary>
 /// Event handler
 /// </summary>
 /// -------------------------------------------------------------------
 private void ExpandCollapseEventHandler(object src, AutomationPropertyChangedEventArgs arguments)
 {
     if (Automation.Compare((AutomationElement)src, _element))
     {
         if (arguments.Property == ExpandCollapsePattern.ExpandCollapseStateProperty)
         {
             if (_desiredState == (ExpandCollapseState)arguments.NewValue)
             {
                 _ev.Set();
             }
         }
     }
 }
Example #20
0
        // DON'T USE THIS SNIPPET -- PROBABLY NOT RAISING CORRECT EVENTS

        // <Snippet118>
        /// <summary>
        /// Selects an item in the myItems collection.
        /// </summary>
        /// <param name="index">Index of the selected item.</param>
        /// <remarks>
        /// This is a single-selection list whose current selection is stored
        /// internally in mySelection.
        /// MyListItem is the provider class for list items.
        /// </remarks>
        public void Select(int index)
        {
            if (index >= myItems.Count)
            {
                throw new ArgumentOutOfRangeException();
            }
            else if (index < 0)
            {
                mySelection = -1;
                return;
            }
            else
            // If within range, clear the Selected property on the current item
            // and set it on the new item.
            {
                MyListItem newItem;
                MyListItem oldItem = null;

                // Deselect old item, if there is one; list might not be initialized.
                if (mySelection >= 0)
                {
                    oldItem          = myItems[mySelection] as MyListItem;
                    oldItem.Selected = false;
                }
                mySelection      = index;
                newItem          = myItems[mySelection] as MyListItem;
                newItem.Selected = true;
                // Raise events that clients can receive.
                if (AutomationInteropProvider.ClientsAreListening)
                {
                    // Generic event for selection made.
                    AutomationEventArgs args = new AutomationEventArgs(SelectionItemPatternIdentifiers.ElementSelectedEvent);
                    AutomationInteropProvider.RaiseAutomationEvent(SelectionItemPattern.ElementSelectedEvent,
                                                                   (IRawElementProviderSimple)myItems[mySelection], args);

                    // Property-changed event for old item's Selection property.
                    AutomationPropertyChangedEventArgs propArgs;
                    if (oldItem != null)
                    {
                        propArgs = new AutomationPropertyChangedEventArgs(
                            SelectionItemPatternIdentifiers.IsSelectedProperty, true, false);
                        AutomationInteropProvider.RaiseAutomationPropertyChangedEvent(oldItem, propArgs);
                    }

                    // Property-changed event for new item's Selection property.
                    propArgs = new AutomationPropertyChangedEventArgs(
                        SelectionItemPatternIdentifiers.IsSelectedProperty, false, true);
                    AutomationInteropProvider.RaiseAutomationPropertyChangedEvent(newItem, propArgs);
                }
            }
        }
Example #21
0
        internal void HandleAutomationPropertyChanged(AutomationPropertyChangedEventArgs args)
        {
            if (args.Property == AEIds.HasKeyboardFocusProperty)
            {
                bool focused = (bool)args.NewValue;
                NotifyFocused(focused);

                foreach (FocusHandler handler in focusHandlers.Values)
                {
                    handler(this, focused);
                }
            }
            else if (args.Property == AEIds.IsOffscreenProperty)
            {
                bool offscreen = (bool)args.NewValue;
                NotifyStateChange(Atk.StateType.Visible, !offscreen);
            }
            else if (args.Property == AEIds.IsEnabledProperty)
            {
                bool enabled = (bool)args.NewValue;
                NotifyStateChange(Atk.StateType.Enabled, enabled);
                NotifyStateChange(Atk.StateType.Sensitive, enabled);
            }
            else if (args.Property == AEIds.HelpTextProperty)
            {
                Description = (string)args.NewValue;
            }
            else if (args.Property == AEIds.BoundingRectangleProperty)
            {
                EmitBoundsChanged((System.Windows.Rect)args.NewValue);
            }
            else if (args.Property == AEIds.NameProperty)
            {
                Notify("accessible-name");
            }
            else if (args.Property == AEIds.ControlTypeProperty)
            {
                // Assume that the RootVisual will never change
                // its control type.
                Adapter parent = Parent as Adapter;
                if (parent != null)
                {
                    parent.HandleControlTypeChange(Peer);
                }
            }

            if (AutomationPropertyChanged != null)
            {
                AutomationPropertyChanged(args.Peer, args);
            }
        }
Example #22
0
        /// <summary>
        /// Handler for property change events
        /// </summary>
        /// <param name="src">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Automation.AutomationPropertyChangedEventArgs"/> instance containing the event data.</param>
        private static void OnPropertyChange(object src, AutomationPropertyChangedEventArgs e)
        {
            if (src == null)
            {
                return;
            }

            if (_propertyChangeHandler == null)
            {
                return;
            }

            RemovePropertyChangeHandler();
        }
        private UserEvent UserEvent(AutomationPropertyChangedEventArgs e)
        {
            UserEvent userEvent;

            try
            {
                userEvent = createUserEvent.Invoke(new object[] { e });
            }
            catch (Exception exception)
            {
                userEvent = new ExceptionEvent(uiItem, exception);
            }
            return(userEvent);
        }
Example #24
0
        void UIAutomationClient.IUIAutomationPropertyChangedEventHandler.HandlePropertyChangedEvent(
            UIAutomationClient.IUIAutomationElement sender,
            int propertyId,
            object newValue)
        {
            AutomationProperty property             = AutomationProperty.LookupById(propertyId);
            object             wrappedObj           = Utility.WrapObjectAsProperty(property, newValue);
            AutomationPropertyChangedEventArgs args = new AutomationPropertyChangedEventArgs(
                property,
                null,
                wrappedObj);

            this._propChangeHandler(AutomationElement.Wrap(sender), args);
        }
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        private void OnStateChange(IntPtr hwnd, int idObject, int idChild)
        {
            NativeMethods.HWND nativeHwnd = NativeMethods.HWND.Cast(hwnd);

            // Ignore windows that have been destroyed
            if (!SafeNativeMethods.IsWindow(nativeHwnd))
            {
                return;
            }

            AutomationElement rawEl = AutomationElement.FromHandle(hwnd);

            try
            {
                rawEl.GetCurrentPattern(WindowPattern.Pattern);
            }
            catch (InvalidOperationException)
            {
                // Only raise this event for elements with the WindowPattern.
                return;
            }

            Object windowInteractionState = rawEl.GetPatternPropertyValue(WindowPattern.WindowInteractionStateProperty, false);

            // if has no state value just return
            if (!(windowInteractionState is WindowInteractionState))
            {
                return;
            }

            WindowInteractionState state = (WindowInteractionState)windowInteractionState;

            // Filter... avoid duplicate events
            if (hwnd == _lastHwnd && state == _lastState)
            {
                return;
            }

            AutomationPropertyChangedEventArgs e = new AutomationPropertyChangedEventArgs(
                WindowPattern.WindowInteractionStateProperty,
                hwnd == _lastHwnd ? _lastState : WindowInteractionState.Running,
                state);

            ClientEventManager.RaiseEventInThisClientOnly(AutomationElement.AutomationPropertyChangedEvent, rawEl, e);

            // save the last hwnd/rect for filtering out duplicates
            _lastHwnd  = hwnd;
            _lastState = state;
        }
Example #26
0
        private void OnVisualStateChange(object sender, AutomationPropertyChangedEventArgs e)
        {
            WindowVisualState visualState = WindowVisualState.Normal;

            try
            {
                visualState = (WindowVisualState)e.NewValue;
            }
            catch (InvalidCastException)
            {
                // ignore
            }

            WindowStateChange?.Invoke(this, new WindowStateChangeEventArgs((WindowState)visualState));
        }
Example #27
0
        /// <summary>
        /// Handler for property changes.
        /// </summary>
        /// <param name="src">The source whose properties changed.</param>
        /// <param name="e">Event arguments.</param>
        private void OnPropertyChange(object src, AutomationPropertyChangedEventArgs e)
        {
            AutomationElement sourceElement = src as AutomationElement;

            if (e.Property == AutomationElement.IsEnabledProperty)
            {
                bool enabled = (bool)e.NewValue;
                // TODO: Do something with the new value.
                // The element that raised the event can be identified by its runtime ID property.
            }
            else
            {
                // TODO: Handle other property-changed events.
            }
        }
Example #28
0
        public override void RaiseAutomationPropertyChangedEvent(AutomationPropertyChangedEventArgs e)
        {
            if (fakeLabel != null && balloonWindow && e.Property == AutomationElementIdentifiers.NameProperty)
            {
                fakeLabel.RaiseAutomationPropertyChangedEvent(e);
            }
            else if (e.Property == TransformPatternIdentifiers.CanResizeProperty)
            {
                NotifyStateChange(Atk.StateType.Resizable, (bool)e.NewValue);
            }
            else if (e.Property == WindowPatternIdentifiers.WindowVisualStateProperty)
            {
                WindowVisualState newValue = (WindowVisualState)e.NewValue;

                if (newValue == WindowVisualState.Maximized)
                {
                    EmitSignal("maximize");
                }
                else if (newValue == WindowVisualState.Minimized)
                {
                    EmitSignal("minimize");
                }
                else                 // Back to Normal, so is Restored
                {
                    EmitSignal("restore");
                }
            }
            else if (e.Property == AutomationElementIdentifiers.BoundingRectangleProperty)
            {
                Rect oldValue = (Rect)e.OldValue;
                Rect newValue = (Rect)e.NewValue;

                if (oldValue.X != newValue.X || oldValue.Y != newValue.Y)
                {
                    EmitSignal("move");
                }
                if (oldValue.Width != newValue.Width || oldValue.Height != newValue.Height)
                {
                    EmitSignal("resize");
                }

                base.RaiseAutomationPropertyChangedEvent(e);
            }
            else
            {
                base.RaiseAutomationPropertyChangedEvent(e);
            }
        }
Example #29
0
 public override void RaiseAutomationPropertyChangedEvent(AutomationPropertyChangedEventArgs e)
 {
     if (e.Property.Id == SelectionItemPatternIdentifiers.IsSelectedProperty.Id)
     {
         NotifyStateChange(Atk.StateType.Selected, Selected);
     }
     else if (e.Property.Id == AutomationElementIdentifiers.IsOffscreenProperty.Id)
     {
         showing = !((bool)e.NewValue);
         NotifyStateChange(Atk.StateType.Showing, showing);
     }
     else
     {
         base.RaiseAutomationPropertyChangedEvent(e);
     }
 }
Example #30
0
        internal static void RaisePropertyChangedEvent(IElement element,
                                                       AutomationPropertyChangedEventArgs e)
        {
            // To always use public API
            // - AutomationElement[]
            if (e.Property.Id == TableItemPatternIdentifiers.ColumnHeaderItemsProperty.Id ||
                e.Property.Id == TableItemPatternIdentifiers.RowHeaderItemsProperty.Id ||
                e.Property.Id == TablePatternIdentifiers.ColumnHeadersProperty.Id ||
                e.Property.Id == TablePatternIdentifiers.RowHeadersProperty.Id ||
                e.Property.Id == SelectionPatternIdentifiers.SelectionProperty.Id)
            {
                IElement[] oldIElements = e.OldValue as IElement[];
                IElement[] newIElements = e.NewValue as IElement[];

                e = new AutomationPropertyChangedEventArgs(e.Property,
                                                           SourceManager.GetOrCreateAutomationElements(oldIElements),
                                                           SourceManager.GetOrCreateAutomationElements(newIElements));
                // - AutomationElement
            }
            else if (e.Property.Id == TableItemPatternIdentifiers.ColumnHeaderItemsProperty.Id ||
                     e.Property.Id == GridItemPatternIdentifiers.ContainingGridProperty.Id ||
                     e.Property.Id == SelectionItemPatternIdentifiers.SelectionContainerProperty.Id)
            {
                IElement oldElement = e.OldValue as IElement;
                IElement newElement = e.NewValue as IElement;

                e = new AutomationPropertyChangedEventArgs(e.Property,
                                                           SourceManager.GetOrCreateAutomationElement(oldElement),
                                                           SourceManager.GetOrCreateAutomationElement(newElement));
            }

            foreach (PropertyChangedEventHandlerData handler in propertyEventHandlers)
            {
                if (IsElementInScope(element, handler.Element, handler.Scope))
                {
                    foreach (AutomationProperty property in handler.Properties)
                    {
                        if (property == e.Property)
                        {
                            handler.EventHandler(SourceManager.GetOrCreateAutomationElement(element),
                                                 e);
                            break;
                        }
                    }
                }
            }
        }
Example #31
0
		private void OnAutomationPropertyChanged (object o, AutomationPropertyChangedEventArgs args)
		{
			if (args.Property == ValuePatternIdentifiers.ValueProperty) {
				AutomationControlType controlType
					= peer.GetAutomationControlType ();
				if (controlType == AutomationControlType.Edit
				    || controlType == AutomationControlType.Document) {
					TextAdapter textAdapter
						= new TextAdapter ((TextImplementor) adapter);

					string oldValue = (string) args.OldValue;
					string newValue = (string) args.NewValue;

					if (oldValue == newValue)
						return;

					if (newValue.StartsWith (oldValue)) {
						textAdapter.EmitTextChanged (Atk.TextChangedDetail.Insert,
									     oldValue.Length,
						                             newValue.Length - oldValue.Length);
					} else if (oldValue.StartsWith (newValue)) {
						textAdapter.EmitTextChanged (Atk.TextChangedDetail.Delete,
									     newValue.Length,
						                             oldValue.Length - newValue.Length);
					} else {
						// XXX: Improve this algorithm so that
						// it diffs the two values (maybe using
						// a modified Levenshtein alg?) and
						// send just what is deleted or
						// inserted to avoid thrashing ATs.
						textAdapter.EmitTextChanged (Atk.TextChangedDetail.Delete,
									     0, oldValue.Length);

						textAdapter.EmitTextChanged (Atk.TextChangedDetail.Insert,
									     0, newValue.Length);
					}
				} else {
					// Mirror Gtk+'s behavior here somewhat
					// and only fire visible_data_changed
					// in the case of label and label-like
					// elements.
					adapter.EmitSignal ("visible_data_changed");
				}
			}
		}
Example #32
0
		private void OnAutomationPropertyChanged (object o, AutomationPropertyChangedEventArgs args)
		{
			if (args.Property == RangeValuePatternIdentifiers.ValueProperty)
				adapter.NotifyPropertyChanged ("accessible-value");
		}
Example #33
0
		private void OnAutomationPropertyChanged (object o, AutomationPropertyChangedEventArgs args)
		{
			if (args.Property == SelectionItemPatternIdentifiers.IsSelectedProperty)
				adapter.NotifyStateChange (Atk.StateType.Checked);
		}
		private void OnAutomationPropertyChanged (object o, AutomationPropertyChangedEventArgs args)
		{
			if (args.Property == ECPIs.ExpandCollapseStateProperty) {
				adapter.NotifyStateChange (Atk.StateType.Expanded);
				adapter.EmitSignal ("visible_data_changed");
			} else if (args.Property == TogglePatternIdentifiers.ToggleStateProperty) {
				adapter.NotifyStateChange (Atk.StateType.Checked);

				var oldValue = (ToggleState) args.OldValue;
				var newValue = (ToggleState) args.NewValue;
				if (oldValue == ToggleState.Indeterminate
				    || newValue == ToggleState.Indeterminate)
					adapter.NotifyStateChange (Atk.StateType.Indeterminate);
			}
		}
 public static void RaiseAutomationPropertyChangedEvent(IRawElementProviderSimple element, AutomationPropertyChangedEventArgs e)
 {
     Utility.ValidateArgumentNonNull(element, "element");
     Utility.ValidateArgumentNonNull(e, "e");
     UiaCoreProviderApi.UiaRaiseAutomationPropertyChangedEvent(element, e.Property.Id, e.OldValue, e.NewValue);
 }
Example #36
0
		private void OnAutomationPropertyChanged (object o, AutomationPropertyChangedEventArgs args)
		{
			if (args.Property == SelectionItemPatternIdentifiers.IsSelectedProperty) {
				if (WasSelected != (bool) args.NewValue) {
					WasSelected = !WasSelected;
					adapter.NotifyStateChange (Atk.StateType.Selected);
				}
			}
		}
Example #37
0
		private void OnAutomationPropertyChanged (
			object o, AutomationPropertyChangedEventArgs args)
		{
			if (args.Peer == null)
				return;

			if (Log.CurrentLogLevel == LogLevel.Information) {
				string propertyName = GetProgrammaticName (args.Property);
				Log.Info ("OnAutomationPropertyChanged: Peer = {0}, Property = {1}, Old = {2}, New = {3}",
				          args.Peer, propertyName, args.OldValue, args.NewValue);
			}

			Adapter adapter
				= DynamicAdapterFactory.Instance.GetAdapter (args.Peer, false);
			if (adapter == null)
				return;

			adapter.HandleAutomationPropertyChanged (args);
		}