Exemplo n.º 1
0
		public void RaiseAutomationPropertyChangedEvent (object provider, AutomationPropertyChangedEventArgs e)
		{
			var providerSimple = provider as IRawElementProviderSimple;
			if (providerSimple == null)
				return;
			ClientEventManager.RaiseAutomationPropertyChangedEvent (providerSimple, e);
		}
Exemplo n.º 2
0
		public override void RaiseAutomationPropertyChangedEvent (AutomationPropertyChangedEventArgs e)
		{
			if (e.Property == RangeValuePatternIdentifiers.ValueProperty)
				Notify ("accessible-value");
			else
				base.RaiseAutomationPropertyChangedEvent (e);
		}
Exemplo n.º 3
0
        public override void RaiseAutomationPropertyChangedEvent(System.Windows.Automation.AutomationPropertyChangedEventArgs e)
        {
            if (e.Property.Id != ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty.Id)
            {
                base.RaiseAutomationPropertyChangedEvent(e);
                return;
            }

            ExpandCollapseState newState = (ExpandCollapseState)e.NewValue;

            if (newState == ExpandCollapseState.Expanded)
            {
                if (fakeWindow == null)
                {
                    fakeWindow = new DropDownWindow();
                    fakeWindow.AddOneChild((Adapter)RefAccessibleChild(0));
                }
                TopLevelRootItem.Instance.AddOneChild(fakeWindow);
                TopLevelRootItem.Instance.CheckAndHandleNewActiveWindow(fakeWindow);
            }
            else if (newState == ExpandCollapseState.Collapsed)
            {
                Atk.Object realWindow = this;
                while (realWindow != null && !(realWindow is Window))
                {
                    realWindow = realWindow.Parent;
                }
                if (realWindow != null)
                {
                    TopLevelRootItem.Instance.CheckAndHandleNewActiveWindow(fakeWindow, (Window)realWindow);
                }
                TopLevelRootItem.Instance.RemoveChild(fakeWindow, false);
            }
            InnerMenu.RaiseExpandedCollapsed();
        }
Exemplo n.º 4
0
        private void HandlePropertyChangedEvent(object sender, UIA.AutomationPropertyChangedEventArgs automationPropertyChangedEventArgs)
        {
            var basicAutomationElement = new UIA2BasicAutomationElement((UIA2Automation)Automation, (UIA.AutomationElement)sender);
            var senderElement          = new AutomationElement(basicAutomationElement);
            var propertyId             = PropertyId.Find(AutomationType.UIA2, automationPropertyChangedEventArgs.Property.Id);

            HandlePropertyChangedEvent(senderElement, propertyId, automationPropertyChangedEventArgs.NewValue);
        }
Exemplo n.º 5
0
Arquivo: Tab.cs Projeto: mono/uia2atk
		public override void RaiseAutomationPropertyChangedEvent (AutomationPropertyChangedEventArgs e)
		{
			if (e.Property == SelectionPatternIdentifiers.SelectionProperty) {
				EmitSignal ("selection_changed");
				EmitVisibleDataChanged ();
			} else
				base.RaiseAutomationPropertyChangedEvent (e);
		}
 public virtual void PropertyChange(object sender, AutomationPropertyChangedEventArgs e)
 {
     UserEvent userEvent = UserEvent(e);
     if (null == userEvent) return;
     try
     {
         eventListener.EventOccured(userEvent);
     }
     catch (Exception exception)
     {
         WhiteLogger.Instance.Error("", exception);
     }
 }
 private UserEvent UserEvent(AutomationPropertyChangedEventArgs e)
 {
     UserEvent userEvent;
     try
     {
         userEvent = createUserEvent.Invoke(new object[] {e});
     }
     catch (Exception exception)
     {
         userEvent = new ExceptionEvent(uiItem, exception);
     }
     return userEvent;
 }
Exemplo n.º 8
0
		protected void RaiseAutomationPropertyChangedEvent ()
		{
			if (AutomationInteropProvider.ClientsAreListening == true) {				
				object newValue = GetNewPropertyValue ();

				if (object.Equals (OldValue, newValue) == false) {
					AutomationPropertyChangedEventArgs args =					
						new AutomationPropertyChangedEventArgs (Property,
						                                        OldValue,
						                                        newValue);
					AutomationInteropProvider.RaiseAutomationPropertyChangedEvent (Provider, 
					                                                               args);
					OldValue = newValue;
				}
			}
		}
Exemplo n.º 9
0
		public override void RaiseAutomationPropertyChangedEvent (AutomationPropertyChangedEventArgs e)
		{
			if (e.Property == AutomationElementIdentifiers.ControlTypeProperty) {
				//We remove the current Adapter and add it again to reflect the ControlType change
				StructureChangedEventArgs args 
					= new StructureChangedEventArgs (StructureChangeType.ChildRemoved, 
					                                 new int[] { 0 }); //TODO: Fix ?
				AutomationInteropProvider.RaiseStructureChangedEvent (Provider,
				                                                      args);

				args = new StructureChangedEventArgs (StructureChangeType.ChildAdded,
				                                      new int[] { 0 }); //TODO: Fix ?
				AutomationInteropProvider.RaiseStructureChangedEvent (Provider,
				                                                      args);
			} else
				base.RaiseAutomationPropertyChangedEvent (e);
		}
Exemplo n.º 10
0
		public override void RaiseAutomationPropertyChangedEvent (AutomationPropertyChangedEventArgs e)
		{
			if (e.Property == RangeValuePatternIdentifiers.ValueProperty) {
				Notify ("accessible-value");
				if (valueProvider == null)
					NewText (e.NewValue.ToString ());
			} else if (e.Property == RangeValuePatternIdentifiers.IsReadOnlyProperty) {
				NotifyStateChange (Atk.StateType.Editable, !(bool)e.NewValue);
			} else if (rangeValueProvider == null && e.Property == ValuePatternIdentifiers.IsReadOnlyProperty) {
				// If we have both rangeValueProvider and
				// Valueprovider, we'll get two notifications,
				// so we should ignore one
				NotifyStateChange (Atk.StateType.Editable, !(bool)e.NewValue);
			} else if (e.Property == ValuePatternIdentifiers.ValueProperty) {
				NewText ((string)e.NewValue);
			} else
				base.RaiseAutomationPropertyChangedEvent (e);
		}
Exemplo n.º 11
0
 public static UserEvent Create(ListView listView, AutomationPropertyChangedEventArgs eventArgs)
 {
     var columnPosition = (int) Mouse.Instance.Location.X;
     if (listView.SelectedRows.Count == 0)
     {
         var listViewEvent = new ListViewEvent(listView, TryUnSelectAll, new object[] {});
         return listViewEvent;
     }
     if (true.Equals(eventArgs.NewValue))
     {
         string column = null;
         if (listView.Header != null)
         {
             ListViewColumn listViewColumn =
                 listView.Header.Columns.Find(obj => obj.Bounds.Left < columnPosition && columnPosition < obj.Bounds.Right);
             column = listViewColumn.Text;
         }
         string value = column == null ? listView.SelectedRows[0].Cells[0].Text : listView.SelectedRows[0].Cells[column].Text;
         return new ListViewEvent(listView, Select, new object[] {column, value});
     }
     return null;
 }
Exemplo n.º 12
0
Arquivo: Tree.cs Projeto: mono/uia2atk
		public override void RaiseAutomationPropertyChangedEvent (AutomationPropertyChangedEventArgs e)
		{
			if (e.Property == AutomationElementIdentifiers.ControlTypeProperty) {
				//We remove the current Adapter and add it again to reflect the ControlType change
				StructureChangedEventArgs args 
					= new StructureChangedEventArgs (StructureChangeType.ChildRemoved, 
					                                 new int[] { 0 }); //TODO: Fix ?
				AutomationInteropProvider.RaiseStructureChangedEvent (Provider,
				                                                      args);

				args = new StructureChangedEventArgs (StructureChangeType.ChildAdded,
				                                      new int[] { 0 }); //TODO: Fix ?
				AutomationInteropProvider.RaiseStructureChangedEvent (Provider,
				                                                      args);
			} else if (e.Property == TogglePatternIdentifiers.ToggleStateProperty) {
				//if it's a toggle, it should not be a basic Button class, but CheckBox or other
				Log.Error ("Tree: Toggle events should not land here (should not be reached)");
			} else if (e.Property == AutomationElementIdentifiers.HasKeyboardFocusProperty) {
				hasFocus = (bool)e.NewValue;
				base.RaiseAutomationPropertyChangedEvent (e);
			} else
				base.RaiseAutomationPropertyChangedEvent (e);
		}
Exemplo n.º 13
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);
		}
Exemplo n.º 14
0
 /// -------------------------------------------------------------------
 /// <summary>
 /// Method registered by AddEventHandler() as an event handler
 /// </summary>
 /// -------------------------------------------------------------------
 public virtual void OnEvent(object element, AutomationPropertyChangedEventArgs argument)
 {
     _gotNotifiedEvent.Set();
 }
		private void OnProviderBehaviorSet (object sender, ProviderBehaviorEventArgs eventArgs)
		{
			if (AutomationInteropProvider.ClientsAreListening == false)
				return;
			else if ((eventArgs.Replaced == true && eventArgs.Behavior == null)
			    || (eventArgs.Replaced == false && eventArgs.Behavior != null)) {

				AutomationProperty property = null;
	
				if (eventArgs.Pattern == DockPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsDockPatternAvailableProperty;
				else if (eventArgs.Pattern == ExpandCollapsePatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsExpandCollapsePatternAvailableProperty;
				else if (eventArgs.Pattern == GridItemPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsGridItemPatternAvailableProperty;
				else if (eventArgs.Pattern == GridPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsGridPatternAvailableProperty;
				else if (eventArgs.Pattern == InvokePatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsInvokePatternAvailableProperty;
				else if (eventArgs.Pattern == MultipleViewPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsMultipleViewPatternAvailableProperty;
				else if (eventArgs.Pattern == RangeValuePatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsRangeValuePatternAvailableProperty;
				else if (eventArgs.Pattern == ScrollItemPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsScrollItemPatternAvailableProperty;
				else if (eventArgs.Pattern == ScrollPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsScrollPatternAvailableProperty;
				else if (eventArgs.Pattern == SelectionItemPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsSelectionItemPatternAvailableProperty;
				else if (eventArgs.Pattern == SelectionPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsSelectionPatternAvailableProperty;
				else if (eventArgs.Pattern == TableItemPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsTableItemPatternAvailableProperty;
				else if (eventArgs.Pattern == TablePatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsTablePatternAvailableProperty;
				else if (eventArgs.Pattern == TextPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsTextPatternAvailableProperty;
				else if (eventArgs.Pattern == TogglePatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsTogglePatternAvailableProperty;
				else if (eventArgs.Pattern == TransformPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsTransformPatternAvailableProperty;
				else if (eventArgs.Pattern == ValuePatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsValuePatternAvailableProperty;
				else if (eventArgs.Pattern == WindowPatternIdentifiers.Pattern)
					property = AutomationElementIdentifiers.IsWindowPatternAvailableProperty;
				
				if (property == null) //This never should happen, theoretically
					return;
				
				bool? val = Provider.GetPropertyValue (property.Id) as bool?;
	
				// This should never happen.
				if (val == null)
					return;
				
				bool newValue = val ?? false;
				
				AutomationPropertyChangedEventArgs args 
					= new AutomationPropertyChangedEventArgs (property,
					                                          !newValue,
					                                          newValue);
				AutomationInteropProvider.RaiseAutomationPropertyChangedEvent (Provider, 
				                                                               args);
			}
		}
Exemplo n.º 16
0
 void LocationChanged(object sender, AutomationPropertyChangedEventArgs e)
 {
     _syncContext.Post(delegate 
         {
             UpdateEditState(true);
         }, null);
 }
Exemplo n.º 17
0
        protected void OnUIAutomationPropertyChangedEvent(object src, AutomationPropertyChangedEventArgs e)
        {
            if (!checkNotNull(src, e)) return;
            if (this.AutomationProperty == e.Property) {

            try {
            WriteVerbose(this, "RunEventScriptBlocks(this) ran");
            } catch { }

                RunEventScriptBlocks(this);
            }
            try {
                WriteVerbose(this, e.EventId + "on " + (src as AutomationElement) + " fired");
            } catch { }
        }
Exemplo n.º 18
0
		public override void RaiseAutomationPropertyChangedEvent (AutomationPropertyChangedEventArgs e)
		{
			base.RaiseAutomationPropertyChangedEvent (e);
		}
Exemplo n.º 19
0
 /// <summary>
 ///     Window move event handler.
 /// </summary>
 /// <param name="src">The object that raised the event.</param>
 /// <param name="e">Event arguments.</param>
 private void OnWindowMove(object src, AutomationPropertyChangedEventArgs e)
 {
     // Pass the same function to BeginInvoke.
     Dispatcher.BeginInvoke(
         DispatcherPriority.Send,
         new ClientControlsDelegate(UpdateClientControls), src);
 }
Exemplo n.º 20
0
        private void HideOnMinimize(object sender, AutomationPropertyChangedEventArgs e)
        {
            this.Minimized?.Invoke(sender, new WindowInfoEventArgs(this));

            if ((WindowVisualState) e.NewValue == WindowVisualState.Minimized)
                this.Hide();
        }
Exemplo n.º 21
0
		public override void RaiseAutomationPropertyChangedEvent (AutomationPropertyChangedEventArgs e)
		{
			if (editableTextExpert.RaiseAutomationPropertyChangedEvent (e)
			    || textExpert.RaiseAutomationPropertyChangedEvent (e))
				return;

			base.RaiseAutomationPropertyChangedEvent (e);
		}
Exemplo n.º 22
0
		public bool RaiseAutomationPropertyChangedEvent (AutomationPropertyChangedEventArgs e)
		{
			UpdateCaretToValidValue ();
			
			if (e.Property.Id == ValuePatternIdentifiers.ValueProperty.Id) {
				// Don't fire spurious events if the text hasn't changed
				string oldText = (string) e.OldValue;
				if (HandleSimpleChange (ref oldText,
				                        ref caretOffset, 
				                        caretProvider == null))
					return false;

				if (caretProvider == null)
					caretOffset = Length;

				return false;
			}
			
			return false;
		}
Exemplo n.º 23
0
		public static void RaiseAutomationPropertyChangedEvent (IRawElementProviderSimple provider,
			AutomationPropertyChangedEventArgs e)
		{
			lock (propertyChangedEventEntries)
				foreach (var entry in propertyChangedEventEntries)
					if (IsProviderInScope (provider, entry.Provider, entry.Scope) &&
						Array.Exists (entry.Properties, i => i == e.Property.Id)) {
						var clientElement =
							ClientAutomationSource.Instance.GetOrCreateElement (provider);
						var element = SourceManager.GetOrCreateAutomationElement (clientElement);
						// TODO implement
						// Translate e.NewValue && e.OldValue
						entry.Handler (element, e);
					}
		}
Exemplo n.º 24
0
        // fire the property change event if there is a client listening for it.
        // pattern is the pattern that the property belongs to. the provider is tested to ensure it supports that pattern.
        private void MaybeFirePropertyChangeEvent(AutomationPattern pattern, AutomationProperty property, Hashtable eventTable, IntPtr hwnd, int idObject, int idChild, bool clientToo)
        {
            // if the 2-nd level table contains an entry for this property and the root element should be included (or not)
            if (eventTable.ContainsKey(property) && (clientToo || !IsClientObject(idObject, idChild)))
            {
                // create a provider associated with this event and check whether it supports the pattern, if specified.
                MsaaNativeProvider provider = (MsaaNativeProvider)MsaaNativeProvider.Create(hwnd, idChild, idObject);
                if (provider != null && (pattern==null || provider.IsPatternSupported(pattern)))
                {
                    // get the new property value from the provider.
                    object newValue = ((IRawElementProviderSimple)provider).GetPropertyValue(property.Id);

                    // fire the event
                    AutomationPropertyChangedEventArgs eventArgs = new AutomationPropertyChangedEventArgs(property, null, newValue);
                    //Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Firing {0} change event for {1}", property, hwnd), "NativeMsaaProxy");
                    AutomationInteropProvider.RaiseAutomationPropertyChangedEvent(provider, eventArgs);
                }
            }
        }
Exemplo n.º 25
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);
            }
        }
Exemplo n.º 26
0
 public override void RaiseAutomationPropertyChangedEvent(System.Windows.Automation.AutomationPropertyChangedEventArgs e)
 {
     base.RaiseAutomationPropertyChangedEvent(e);
 }
Exemplo n.º 27
0
 void ScrollHandler(object obj, AutomationPropertyChangedEventArgs args)
 {
     Comment("Event ################### ");
     _notifiedEvent.Set();
 }
Exemplo n.º 28
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);
		}
Exemplo n.º 29
0
		public override void RaiseAutomationPropertyChangedEvent (AutomationPropertyChangedEventArgs e)
		{
			if (e.Property == TogglePatternIdentifiers.ToggleStateProperty)
				NotifyStateChange (Atk.StateType.Checked, IsChecked ((ToggleState)e.NewValue));
			else
				base.RaiseAutomationPropertyChangedEvent (e);
		}
Exemplo n.º 30
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);
 }
Exemplo n.º 31
0
 public void HandleEvent(object sender, AutomationPropertyChangedEventArgs e)
 {
     OnMatchingEvent((AutomationElement)sender);
 }
Exemplo n.º 32
0
        void LocationChanged(object sender, AutomationPropertyChangedEventArgs e)
        {
            _syncContext.Post(delegate
            {
                if (_popupListList != null)
                {
                    var selPat = _popupListList.GetCurrentPattern(SelectionPattern.Pattern) as SelectionPattern;
                    Automation.AddAutomationEventHandler(
                        SelectionItemPattern.ElementSelectedEvent, _popupListList, TreeScope.Children, PopupListElementSelectedHandler);

                    // Update the current selection, if any
                    var curSel = selPat.Current.GetSelection();
                    if (curSel.Length > 0)
                    {
                        try
                        {
                            UpdateSelectedItem(curSel[0]);
                        }
                        catch (Exception ex)
                        {
                            Debug.Print("Error during UpdateSelected! " + ex);
                        }
                    }
                }
            }, null);
        }
Exemplo n.º 33
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);
			}
		}