• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Automation.AutomationEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Automation.AutomationEvent的典型用法代码示例。如果您正苦于以下问题:C# AutomationEvent类的具体用法?C# AutomationEvent怎么用?C# AutomationEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AutomationEvent类属于System.Windows.Automation命名空间,在下文中一共展示了AutomationEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AdviseEventAdded

        //------------------------------------------------------
        //
        //  Patterns Implementation
        //
        //------------------------------------------------------

        #region ProxyHwnd Methods

        // ------------------------------------------------------
        //
        // Internal Methods
        //
        // ------------------------------------------------------

        // Advises proxy that an event has been added.
        // Maps the Automation Events into WinEvents and add those to the list of WinEvents notification hooks
        internal virtual void AdviseEventAdded (AutomationEvent eventId, AutomationProperty [] aidProps)
        {
            // No RawElementBase creation callback, exit from here
            if (_createOnEvent == null)
            {
                return;
            }

            int cEvents = 0;
            WinEventTracker.EvtIdProperty [] aEvents;

            // Gets an Array of WinEvents to trap on a per window handle basis
            if (eventId == AutomationElement.AutomationPropertyChangedEvent)
            {
                aEvents = PropertyToWinEvent (aidProps, out cEvents);
            }
            else
            {
                aEvents = EventToWinEvent (eventId, out cEvents);
            }

            // If we have WinEvents to trap, add those to the list of WinEvent
            // notification list
            if (cEvents > 0)
            {
                WinEventTracker.AddToNotificationList (_hwnd, _createOnEvent, aEvents, cEvents);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:44,代码来源:ProxyHwnd.cs


示例2: RaiseAutomationEvent

		public void RaiseAutomationEvent (AutomationEvent eventId, object provider, AutomationEventArgs e)
		{
			var providerSimple = provider as IRawElementProviderSimple;
			if (providerSimple == null)
				return;
			ClientEventManager.RaiseAutomationEvent (eventId, providerSimple, e);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:7,代码来源:ClientAutomationBridge.cs


示例3: WindowPatternIdentifiers

		static WindowPatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "WindowPatternIdentifiers.Pattern");
			CanMaximizeProperty =
				new AutomationProperty (CanMaximizePropertyId,
				                        "WindowPatternIdentifiers.CanMaximizeProperty");
			CanMinimizeProperty =
				new AutomationProperty (CanMinimizePropertyId,
				                        "WindowPatternIdentifiers.CanMinimizeProperty");
			IsModalProperty =
				new AutomationProperty (IsModalPropertyId,
				                        "WindowPatternIdentifiers.IsModalProperty");
			IsTopmostProperty =
				new AutomationProperty (IsTopmostPropertyId,
				                        "WindowPatternIdentifiers.IsTopmostProperty");
			WindowInteractionStateProperty =
				new AutomationProperty (WindowInteractionStatePropertyId,
				                        "WindowPatternIdentifiers.WindowInteractionStateProperty");
			WindowVisualStateProperty =
				new AutomationProperty (WindowVisualStatePropertyId,
				                        "WindowPatternIdentifiers.WindowVisualStateProperty");
			WindowClosedEvent =
				new AutomationEvent (WindowClosedEventId,
				                     "WindowPatternIdentifiers.WindowClosedProperty");
			WindowOpenedEvent =
				new AutomationEvent (WindowOpenedEventId,
				                     "WindowPatternIdentifiers.WindowOpenedProperty");
		}
开发者ID:mono,项目名称:uia2atk,代码行数:30,代码来源:WindowPatternIdentifiers.cs


示例4: RemoveAutomationEventHandler

		public static void RemoveAutomationEventHandler (AutomationEvent eventId, IRawElementProviderSimple provider, AutomationEventHandler eventHandler)
		{
			lock (automationEventEntries)
				automationEventEntries.RemoveAll (e =>
					e.EventId == eventId &&
					e.Provider == provider &&
					e.Handler == eventHandler);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:8,代码来源:ClientEventManager.cs


示例5: AddAutomationEventHandler

		public static void AddAutomationEventHandler (AutomationEvent eventId,
			IRawElementProviderSimple provider, TreeScope scope,
			AutomationEventHandler eventHandler)
		{
			var entry = new AutomationEventEntry (eventId, provider, scope, eventHandler);
			lock (automationEventEntries)
				automationEventEntries.Add (entry);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:8,代码来源:ClientEventManager.cs


示例6: RaiseAutomationEvent

		public override void RaiseAutomationEvent (AutomationEvent eventId, AutomationEventArgs e)
		{
			if (eventId == GridPatternIdentifiers.ColumnReorderedEvent)
				EmitSignal ("column_reordered");
			else
				base.RaiseAutomationEvent (eventId, e);
			// TODO
		}
开发者ID:mono,项目名称:uia2atk,代码行数:8,代码来源:Table.cs


示例7: RaiseAutomationEvent

		public override void RaiseAutomationEvent (AutomationEvent eventId, AutomationEventArgs e)
		{
			if (eventId != AutomationElementIdentifiers.MenuClosedEvent)
				base.RaiseAutomationEvent (eventId, e);

			TopLevelRootItem.Instance.RemoveChild (Parent);
			((ParentAdapter)Parent).RemoveChild (this);
			AutomationBridge.HandleTotalElementRemoval (this.Provider);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:9,代码来源:ContextMenu.cs


示例8: InvokePatternIdentifiers

		static InvokePatternIdentifiers ()
		{
			InvokedEvent =
				new AutomationEvent (InvokedEventId, 
				                     "InvokePatternIdentifiers.InvokedEvent");
			Pattern =
				new AutomationPattern (PatternId,
				                       "InvokePatternIdentifiers.Pattern");
		}
开发者ID:mono,项目名称:uia2atk,代码行数:9,代码来源:InvokePatternIdentifiers.cs


示例9: RaiseAutomationEvent

		public override void RaiseAutomationEvent (AutomationEvent eventId, AutomationEventArgs e)
		{
			if (eventId == AutomationElementIdentifiers.AsyncContentLoadedEvent) {
				// TODO: Handle AsyncContentLoadedEvent
			} else if (eventId == AutomationElementIdentifiers.StructureChangedEvent) {
				// TODO: Handle StructureChangedEvent
			}
			else
				base.RaiseAutomationEvent (eventId, e);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:10,代码来源:Container.cs


示例10: Event

	internal static async Task<AutomationEventArgs> Event(
		AutomationEvent eventId, 
		AutomationElement element = null, 
		TreeScope scope = TreeScope.Descendants)
	{
		using (var waitr = new Waiter(eventId, element, scope))
		{
			await waitr.Completion.Task;
			return waitr.EvtArgs;
		}
	}
开发者ID:peterson1,项目名称:ErrH,代码行数:11,代码来源:WaitFor.cs


示例11: AddAutomationEventHandler

		public void AddAutomationEventHandler (AutomationEvent eventId, IElement element, TreeScope scope, AutomationEventHandler eventHandler)
		{
			if (element == null)
				// elements from local providers are not descendants of the RootElement.
				return;
			ClientElement clientElement = element as ClientElement;
			if (clientElement == null) {
				Log.Error ("[ClientAutomationSource.AddAutomationEventHandler] Not ClientElement");
				return;
			}
			ClientEventManager.AddAutomationEventHandler (eventId,
				clientElement.Provider, scope, eventHandler);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:13,代码来源:ClientAutomationSource.cs


示例12: EventListener

        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        // full ctor
        internal EventListener(
            AutomationEvent eventId, 
            TreeScope scope, 
            AutomationProperty [] properties,
            UiaCoreApi.UiaCacheRequest cacheRequest
            )
        {
            _eventId = eventId;
            _scope = scope;
            if (properties != null)
                _properties = (AutomationProperty[])properties.Clone();
            else
                _properties = null;
            _cacheRequest = cacheRequest;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:24,代码来源:EventListener.cs


示例13: AddEventHandler

        private void AddEventHandler(
			AutomationEvent automationEvent,
			AutomationEventHandler eventHandler)
        {
            _currentElement = AutomationElement.FocusedElement;
            if (_currentElement != null)
            {
                Automation.AddAutomationEventHandler(
                    automationEvent,
                    _currentElement,
                    TreeScope.Element,
                    eventHandler);
            }
            else
                this.UiFeedback("(no element)");
        }
开发者ID:jfbosch,项目名称:Tsillah,代码行数:16,代码来源:MainForm.cs


示例14: GridPatternIdentifiers

		static GridPatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
						"GridPatternIdentifiers.Pattern");

			RowCountProperty =
				new AutomationProperty (RowCountPropertyId,
						"GridPatternIdentifiers.RowCountProperty");

			ColumnCountProperty =
				new AutomationProperty (ColumnCountPropertyId,
						"GridPatternIdentifiers.ColumnCountProperty");
			ColumnReorderedEvent =
				new AutomationEvent (ColumnReorderedEventId,
				                     "GridPatternIdentifiers.ColumnReorderedEvent");
		}
开发者ID:mono,项目名称:uia2atk,代码行数:17,代码来源:GridPatternIdentifiers.cs


示例15: Remove

 public static EventListener Remove(AutomationEvent eventId, AutomationElement element, Delegate handler)
 {
     // Create a prototype to seek
     int[] runtimeId = (element == null) ? null : element.GetRuntimeId();
     EventListener prototype = new EventListener(eventId.Id, runtimeId, handler);
     lock (_events)
     {
         LinkedListNode<EventListener> node = _events.Find(prototype);
         if (node == null)
         {
             throw new ArgumentException("event handler not found");
         }
         EventListener result = node.Value;
         _events.Remove(node);
         return result;
     }
 }
开发者ID:van800,项目名称:UIAComWrapper,代码行数:17,代码来源:ClientEventList.cs


示例16: Waiter

		internal Waiter(AutomationEvent eventId, 
						AutomationElement element = null, 
						TreeScope scope = TreeScope.Descendants)
		{
			this._eventId = eventId;
			this._element = element ?? AutomationElement.RootElement;
			this._scope   = scope;
			this._handler = new AutomationEventHandler((src, e) => 
			{
				this.EvtArgs = e;
				this.Completion.SetResult(true);
			});

			Automation.AddAutomationEventHandler(
				this._eventId, this._element,
				this._scope,   this._handler);
		}
开发者ID:peterson1,项目名称:ErrH,代码行数:17,代码来源:WaitFor.cs


示例17: AdviseEventAdded

        // a client is listening for an event on object(s) in the specified window.
        internal void AdviseEventAdded(IntPtr hwnd, AutomationEvent eventId, AutomationProperty[] properties)
        {
            // 





            // we have a two-level table structure. the top-level table maps an hwnd to another table.
            // the second-level table maps an event (or a property in the case of property-changed-event)
            // in that hwnd to a reference count of the number of clients listening for that event.

            // use a lock to update our tables in one atomic operation.
            lock (this)
            {
                // if we aren't listening for WinEvents then start listening.
                if (_hwndTable.Count == 0)
                {
                    //Debug.WriteLine("Starting listening for WinEvents.", "NativeMsaaProxy");
                    // Posting an item to the queue to start listening for WinEvents. This makes sure it is done on the proper thread
                    // Notably the same thread WinEventTracker uses, which guarantees the thread that SetWinEventHook is called on is
                    // actively pumping messages, which is required for SetWinEventHook to function properly.
                    WinEventTracker.GetCallbackQueue().PostSyncWorkItem(new QueueItem.MSAAWinEventItem(StartListening));
                }

                // if we already have a 2-nd level table for this hwnd then simply update the 2nd-level table.
                // otherwise we need to create a 2-nd level table.
                Hashtable eventTable;
                if (_hwndTable.ContainsKey(hwnd))
                {
                    eventTable = (Hashtable)(_hwndTable[hwnd]);
                }
                else
                {
                    eventTable = new Hashtable();
                    _hwndTable[hwnd] = eventTable;
                }

                // for the single event or each of possibly multiple properties increment the reference counter.
                foreach (AutomationIdentifier key in EventKeys(eventId, properties))
                {
                    eventTable[key] = eventTable.ContainsKey(key) ? (int)eventTable[key] + 1 : 1;
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:46,代码来源:MSAAEventDispatcher.cs


示例18: SelectionPatternIdentifiers

		static SelectionPatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "SelectionPatternIdentifiers.Pattern");
			CanSelectMultipleProperty =
				new AutomationProperty (CanSelectMultiplePropertyId,
				                        "SelectionPatternIdentifiers.CanSelectMultipleProperty");
			IsSelectionRequiredProperty =
				new AutomationProperty (IsSelectionRequiredPropertyId,
				                        "SelectionPatternIdentifiers.IsSelectionRequiredProperty");
			SelectionProperty =
				new AutomationProperty (SelectionPropertyId,
				                        "SelectionPatternIdentifiers.SelectionProperty");
			InvalidatedEvent =
				new AutomationEvent (InvalidatedEventId,
				                     "SelectionPatternIdentifiers.InvalidatedEvent");
		}
开发者ID:mono,项目名称:uia2atk,代码行数:18,代码来源:SelectionPatternIdentifiers.cs


示例19: SelectionItemPatternIdentifiers

		static SelectionItemPatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "SelectionItemPatternIdentifiers.Pattern");
			ElementAddedToSelectionEvent =
				new AutomationEvent (ElementAddedToSelectionEventId,
				                     "SelectionItemPatternIdentifiers.ElementAddedToSelectionEvent");
			ElementRemovedFromSelectionEvent =
				new AutomationEvent (ElementRemovedFromSelectionEventId,
				                     "SelectionItemPatternIdentifiers.ElementRemovedFromSelectionEvent");
			ElementSelectedEvent =
				new AutomationEvent (ElementSelectedEventId,
				                     "SelectionItemPatternIdentifiers.ElementSelectedEvent");
			IsSelectedProperty =
				new AutomationProperty (IsSelectedPropertyId,
				                     "SelectionItemPatternIdentifiers.IsSelectedProperty");
			SelectionContainerProperty =
				new AutomationProperty (SelectionContainerPropertyId,
				                     "SelectionItemPatternIdentifiers.SelectionContainerProperty");
		}
开发者ID:mono,项目名称:uia2atk,代码行数:21,代码来源:SelectionItemPatternIdentifiers.cs


示例20: AdviseEventRemoved

        internal override void AdviseEventRemoved (AutomationEvent eventId, AutomationProperty [] aidProps)
        {
            // we need to create the menu proxy so that the global event for menu will be listened for.
            // This proxy will get advise of events needed for menus
            ProxyHwnd menuProxy = CreateNonClientMenu();
            if (menuProxy == null)
            {
                // If the window does not have a menu, it at least has a system menu.
                WindowsTitleBar titleBar = (WindowsTitleBar)CreateNonClientChild(NonClientItem.TitleBar);
                if (titleBar != null)
                {
                    menuProxy = (ProxyHwnd)titleBar.CreateTitleBarChild(WindowsTitleBar._systemMenu);
                }
            }

            if (menuProxy != null)
            {
                menuProxy.AdviseEventRemoved(eventId, aidProps);
            }

            base.AdviseEventRemoved(eventId, aidProps);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:22,代码来源:NonClientArea.cs



注:本文中的System.Windows.Automation.AutomationEvent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Automation.AutomationPattern类代码示例发布时间:2022-05-26
下一篇:
C# Automation.AutomationElement类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap