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

C# RoutedEvent类代码示例

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

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



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

示例1: UIElement_RaiseEvent_FocusChangedEvent_Test2

        public MFTestResults UIElement_RaiseEvent_FocusChangedEvent_Test2()
        {
            MFTestResults testResult = MFTestResults.Pass;
            Log.Comment("Raising FocusChangedEventEvents and Verifying");
            //addToEvtRoute = false;
            btnEvent = false;
            fcsEvent = true;
            _fcsEventCntr = 0;
            rEvents = new RoutedEvent[] { Buttons.GotFocusEvent, Buttons.LostFocusEvent };
            for (int i = 0; i < rEvents.Length; i++)
            {
                mainWindow.Dispatcher.Invoke(new TimeSpan(0, 0, 5),
                 new DispatcherOperationCallback(AddToHandler), rEvents[i]);

                FocusChangedEventArgs fcea = new FocusChangedEventArgs(null, DateTime.Now, mainWindow, mainWindow);
                fcea.RoutedEvent = rEvents[i];

                mainWindow.Dispatcher.Invoke(new TimeSpan(0, 0, 5),
                    new DispatcherOperationCallback(RaiseEvent), fcea);
                if (_fcsEventCntr != i + 1)
                {
                    Log.Comment("FocusChangedEvent '" + rEvents[i].Name + "' event not raised");
                    testResult = MFTestResults.Fail;
                }
            }
            fcsEvent = false;

            return testResult;
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:29,代码来源:UIElementTests.cs


示例2: AddRoutedEventHandler

        private static void AddRoutedEventHandler(
            Hashtable table,
            RoutedEvent routedEvent,
            RoutedEventHandler handler,
            bool handledEventsToo)
        {
            if (routedEvent == null || handler == null)
            {
                throw new ArgumentNullException();
            }

            // Create a new RoutedEventHandler
            RoutedEventHandlerInfo routedEventHandlerInfo =
                new RoutedEventHandlerInfo(handler, handledEventsToo);

            // Get the entry corresponding to the given RoutedEvent
            ArrayList handlers = (ArrayList)table[routedEvent];
            if (handlers == null)
            {
                table[routedEvent] = (handlers = new ArrayList());
            }

            // Add the RoutedEventHandlerInfo to the list
            handlers.Add(routedEventHandlerInfo);
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:25,代码来源:UIElement.cs


示例3: UIElement_RaiseEvent_ButtonEvent_Test1

        public MFTestResults UIElement_RaiseEvent_ButtonEvent_Test1()
        {
            MFTestResults testResult = MFTestResults.Pass;
            Log.Comment("Raising ButtonEvents and Verifying");
            //addToEvtRoute = false;
            btnEvent = true;
            fcsEvent = false;
            _btnEventCntr = 0;
            rEvents = new RoutedEvent[] { Buttons.ButtonDownEvent, Buttons.ButtonUpEvent,             
                Buttons.PreviewButtonDownEvent, Buttons.PreviewButtonUpEvent};
            for (int i = 0; i < rEvents.Length; i++)
            {
                //rEvent = rEvents[i];
                mainWindow.Dispatcher.Invoke(new TimeSpan(0, 0, 5),
                    new DispatcherOperationCallback(AddToHandler), rEvents[i]);

                ButtonEventArgs bea = new ButtonEventArgs(null, null, DateTime.Now, Hardware.Button.AppDefined1);
                bea.RoutedEvent = rEvents[i];

                mainWindow.Dispatcher.Invoke(new TimeSpan(0, 0, 5),
                    new DispatcherOperationCallback(RaiseEvent), bea);
                if (_btnEventCntr != i + 1)
                {
                    Log.Comment("ButtonEvent '" + rEvents[i].Name + "' event not raised");
                    testResult = MFTestResults.Fail;
                }
            }
            btnEvent = false;

            return testResult;
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:31,代码来源:UIElementTests.cs


示例4: PropertyValueChangedEventArgs

 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyValueChangedEventArgs"/> class.
 /// </summary>
 /// <param name="routedEvent">The routed event.</param>
 /// <param name="property">The property.</param>
 /// <param name="oldValue">The old value.</param>
 public PropertyValueChangedEventArgs(RoutedEvent routedEvent, PropertyItem property, object oldValue)
     : base(routedEvent, property)
 {
     Property = property;
     NewValue = property.PropertyValue;
     OldValue = oldValue;
 }
开发者ID:denkhaus,项目名称:WPG,代码行数:13,代码来源:PropertyValueChangedEventArgs.cs


示例5: AddHandler

 public static void AddHandler(object target, RoutedEvent routedEvent, Delegate handler, bool handledEventsToo) {
     if (null == target)
         throw new ArgumentNullException("target");
     if (null == routedEvent)
         throw new ArgumentNullException("routedEvent");
     if (null == handler)
         throw new ArgumentNullException("handler");
     //
     RoutedEventKey key = routedEvent.Key;
     if (!routedEvents.ContainsKey(key))
         throw new ArgumentException("Specified routed event is not registered.", "routedEvent");
     RoutedEventInfo routedEventInfo = routedEvents[key];
     bool needAddTarget = true;
     if (routedEventInfo.targetsList != null) {
         RoutedEventTargetInfo targetInfo = routedEventInfo.targetsList.FirstOrDefault(info => info.target == target);
         if (null != targetInfo) {
             if (targetInfo.handlersList == null)
                 targetInfo.handlersList = new List<DelegateInfo>();
             targetInfo.handlersList.Add(new DelegateInfo(handler, handledEventsToo));
             needAddTarget = false;
         }
     }
     if (needAddTarget) {
         RoutedEventTargetInfo targetInfo = new RoutedEventTargetInfo(target);
         targetInfo.handlersList = new List<DelegateInfo>();
         targetInfo.handlersList.Add(new DelegateInfo(handler, handledEventsToo));
         if (routedEventInfo.targetsList == null)
             routedEventInfo.targetsList = new List<RoutedEventTargetInfo>();
         routedEventInfo.targetsList.Add(targetInfo);
     }
 }
开发者ID:CxSoftware,项目名称:consoleframework,代码行数:31,代码来源:EventManager.cs


示例6: MouseButtonEventArgs

 public MouseButtonEventArgs(RoutedEvent routedEvent, object originalSource, MouseDevice mouseDevice, int timestamp, Point absolutePosition, MouseButton changedButton, MouseButtonState buttonState, int clickCount)
     : base(routedEvent, originalSource, mouseDevice, timestamp, absolutePosition)
 {
     this.ChangedButton = changedButton;
     this.ButtonState = buttonState;
     this.ClickCount = clickCount;
 }
开发者ID:highzion,项目名称:Granular,代码行数:7,代码来源:MouseEventArgs.cs


示例7: UvmlRoutedEventHandlerMutator

        /// <summary>
        /// Initializes a new instance of the <see cref="UvmlRoutedEventHandlerMutator"/> class.
        /// </summary>
        /// <param name="revtID">The event which is being mutated.</param>
        /// <param name="revtHandler">The event handler to add to the event.</param>
        public UvmlRoutedEventHandlerMutator(RoutedEvent revtID, UvmlNode revtHandler)
        {
            Contract.Require(revtID, nameof(revtID));
            Contract.Require(revtHandler, nameof(revtHandler));

            this.revtID = revtID;
            this.revtHandler = revtHandler;
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:13,代码来源:UvmlRoutedEventHandlerMutator.cs


示例8: MouseButtonEventArgs

 public MouseButtonEventArgs(object source, RoutedEvent routedEvent, Point rawPosition,
                             MouseButtonState leftButton, MouseButtonState middleButton,
                             MouseButtonState rightButton,
                             MouseButton button, int clickCount = 1)
     : base(source, routedEvent, rawPosition, leftButton, middleButton, rightButton) {
     this.button = button;
     this.clickCount = clickCount;
 }
开发者ID:CxSoftware,项目名称:consoleframework,代码行数:8,代码来源:MouseEventArgs.cs


示例9: WpfXamlMember

 public WpfXamlMember(RoutedEvent re, 
     EventInfo eventInfo,
     XamlSchemaContext schemaContext, 
     bool useV3Rules) 
     : base(eventInfo, schemaContext)
 { 
     RoutedEvent = re;
     _useV3Rules = useV3Rules;
     _underlyingMemberIsKnown = true;
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:10,代码来源:WpfXamlMember.cs


示例10: ScrollChangedEventArgs

 public ScrollChangedEventArgs(RoutedEvent routedEvent, object originalSource, Point offset, Point offsetChange, Size extent, Point extentChange, Size viewport, Point viewportChange)
     : base(routedEvent, originalSource)
 {
     this.Offset = offset;
     this.OffsetChange = offsetChange;
     this.Extent = extent;
     this.ExtentChange = extentChange;
     this.Viewport = viewport;
     this.ViewportChange = viewportChange;
 }
开发者ID:highzion,项目名称:Granular,代码行数:10,代码来源:ScrollChangedEventArgs.cs


示例11: RemoveHandler

        /// <summary>
        /// Removes a handler for a routed event from the specified input element.
        /// </summary>
        /// <param name="dobj">The input element from which to remove the event handler.</param>
        /// <param name="routedEvent">A <see cref="RoutedEvent"/> that identifies the routed event for which to remove a handler.</param>
        /// <param name="handler">A delegate that represents the handler to remove from the element for the specified routed event.</param>
        public static void RemoveHandler(DependencyObject dobj, RoutedEvent routedEvent, Delegate handler)
        {
            var element = dobj as IInputElement;
            if (element != null)
            {
                element.RemoveHandler(routedEvent, handler);
                return;
            }

            throw new ArgumentException(PresentationStrings.NotAnInputElement.Format("dobj"));
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:17,代码来源:IInputElementHelper.cs


示例12: Direct_Event_Should_Go_Straight_To_Source

        public void Direct_Event_Should_Go_Straight_To_Source()
        {
            var ev = new RoutedEvent("test", RoutingStrategies.Direct, typeof(RoutedEventArgs), typeof(TestInteractive));
            var invoked = new List<string>();
            EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
            var target = CreateTree(ev, handler, RoutingStrategies.Direct);

            var args = new RoutedEventArgs(ev, target);
            target.RaiseEvent(args);

            Assert.Equal(new[] { "2b" }, invoked);
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:12,代码来源:InteractiveTests.cs


示例13: Tunneling_Event_Should_Tunnel

        public void Tunneling_Event_Should_Tunnel()
        {
            var ev = new RoutedEvent("test", RoutingStrategies.Tunnel, typeof(RoutedEventArgs), typeof(TestInteractive));
            var invoked = new List<string>();
            EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
            var target = CreateTree(ev, handler, RoutingStrategies.Bubble | RoutingStrategies.Tunnel);

            var args = new RoutedEventArgs(ev, target);
            target.RaiseEvent(args);

            Assert.Equal(new[] { "1", "2b" }, invoked);
        }
开发者ID:CarlSosaDev,项目名称:Avalonia,代码行数:12,代码来源:InteractiveTests.cs


示例14: MouseButtonEventArgs

 internal MouseButtonEventArgs(RoutedEvent routedEvent,
     MouseButton changedButton,
     MouseButtonState buttonState,
     int clickCount,
     System.Windows.Input.MouseButtonEventArgs args)
     : base(routedEvent)
 {
     this.ChangedButton = changedButton;
     this.ButtonState = buttonState;
     this.ClickCount = clickCount;
     this.originalMouseButtonEventArgs = args;
 }
开发者ID:mparsin,项目名称:Elements,代码行数:12,代码来源:MouseButtonState.cs


示例15: Activate

        /// <inheritdoc/>
        void IRoutedEventRaisedNotificationSubscriber.ReceiveRoutedEventRaisedNotification(DependencyObject dobj, RoutedEvent evt, RoutedEventData data)
        {
            if (!data.Handled || handled)
            {
                Activate(dobj);

                if (setHandled)
                {
                    data.Handled = true;
                }
            }
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:13,代码来源:UvssEventTrigger.cs


示例16: ContentShouldBeScrolledEventArgs

 public ContentShouldBeScrolledEventArgs( object source, RoutedEvent routedEvent,
     int? mostLeftVisibleX, int? mostRightVisibleX,
     int? mostTopVisibleY, int? mostBottomVisibleY)
     : base(source, routedEvent) {
     if (mostLeftVisibleX.HasValue && mostRightVisibleX.HasValue)
         throw new ArgumentException("Only one of X values can be specified");
     if (mostTopVisibleY.HasValue && mostBottomVisibleY.HasValue)
         throw new ArgumentException("Only one of Y values can be specified");
     this.mostLeftVisibleX = mostLeftVisibleX;
     this.mostRightVisibleX = mostRightVisibleX;
     this.mostTopVisibleY = mostTopVisibleY;
     this.mostBottomVisibleY = mostBottomVisibleY;
 }
开发者ID:furesoft,项目名称:consoleframework,代码行数:13,代码来源:ScrollViewer.cs


示例17: DetachEvent

		private static void DetachEvent(RoutedEvent e, PointerEventHandler Handler)
		{
			foreach (var item in Panels)
			{
				if (e == UIElement.PointerPressedEvent)
					item.PointerPressed -= Handler;
				else if (e == UIElement.PointerEnteredEvent)
					item.PointerEntered -= Handler;
				else if (e == UIElement.PointerExitedEvent)
					item.PointerExited -= Handler;
			}
			foreach (var item in NonPanels)
			{
				item.RemoveHandler(e, Handler);
			}
		}
开发者ID:theplaymate,项目名称:AppScreenshot,代码行数:16,代码来源:ScreenshotManager.cs


示例18: AttachEvent

		private static void AttachEvent(RoutedEvent e, PointerEventHandler Handler)
		{
			foreach (var item in Panels)
			{
				if (e == UIElement.PointerPressedEvent)
					item.PointerPressed += Handler;
				else if (e == UIElement.PointerEnteredEvent)
					item.PointerEntered += Handler;
				else if (e == UIElement.PointerExitedEvent)
					item.PointerExited += Handler;
			}
			foreach (var item in NonPanels)
			{
				item.AddHandler(e, Handler, true);
			}
		}
开发者ID:theplaymate,项目名称:AppScreenshot,代码行数:16,代码来源:ScreenshotManager.cs


示例19: TextChangedEventArgs

        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="id">event id</param>
        /// <param name="action">UndoAction</param>
        /// <param name="changes">ReadOnlyCollection</param>
        public TextChangedEventArgs(RoutedEvent id, UndoAction action, ICollection<TextChange> changes) : base()
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }

            if (action < UndoAction.None || action > UndoAction.Create)
            {
                throw new InvalidEnumArgumentException("action", (int)action, typeof(UndoAction));
            }

            RoutedEvent=id;
            _undoAction = action;
            _changes = changes;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:22,代码来源:TextChangedEventArgs.cs


示例20: RegisterRoutedEvent

 public static RoutedEvent RegisterRoutedEvent(string name, RoutingStrategy routingStrategy, Type handlerType, Type ownerType) {
     if (string.IsNullOrEmpty(name))
         throw new ArgumentException("name");
     if (null == handlerType)
         throw new ArgumentNullException("handlerType");
     if (null == ownerType)
         throw new ArgumentNullException("ownerType");
     //
     RoutedEventKey key = new RoutedEventKey(name, ownerType);
     if (routedEvents.ContainsKey(key)) {
         throw new InvalidOperationException("This routed event is already registered.");
     }
     RoutedEvent routedEvent = new RoutedEvent(handlerType, name, ownerType, routingStrategy);
     RoutedEventInfo routedEventInfo = new RoutedEventInfo(routedEvent);
     routedEvents.Add(key, routedEventInfo);
     return routedEvent;
 }
开发者ID:CxSoftware,项目名称:consoleframework,代码行数:17,代码来源:EventManager.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# RoutedEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# RouteValueDictionary类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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