当前位置: 首页>>代码示例>>C#>>正文


C# Interactivity.RoutedEventArgs类代码示例

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


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

示例1: 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:Sergey-Terekhin,项目名称:Perspex,代码行数:12,代码来源:InteractiveTests.cs

示例2: Bubbling_Event_Should_Bubble_Up

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

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

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

示例3: PointerReleased

        private static void PointerReleased(RoutedEventArgs ev)
        {
            if (ev.Route == RoutingStrategies.Bubble)
            {
                var e = (PointerReleasedEventArgs)ev;

                if (s_lastPress == e.Source)
                {
                    s_lastPress.RaiseEvent(new RoutedEventArgs(TappedEvent));
                }
            }
        }
开发者ID:KvanTTT,项目名称:Perspex,代码行数:12,代码来源:Gestures.cs

示例4: PointerPressed

        private static void PointerPressed(RoutedEventArgs ev)
        {
            if (ev.Route == RoutingStrategies.Bubble)
            {
                var e = (PointerPressedEventArgs)ev;

                if (e.ClickCount <= 1)
                {
                    s_lastPress = e.Source;
                }
                else if (e.ClickCount == 2 && s_lastPress == e.Source)
                {
                    e.Source.RaiseEvent(new RoutedEventArgs(DoubleTappedEvent));
                }
            }
        }
开发者ID:KvanTTT,项目名称:Perspex,代码行数:16,代码来源:Gestures.cs

示例5: Direct_Event_Should_Have_Route_Set_To_Direct

        public void Direct_Event_Should_Have_Route_Set_To_Direct()
        {
            var ev = new RoutedEvent("test", RoutingStrategies.Direct, typeof(RoutedEventArgs), typeof(TestInteractive));
            bool called = false;

            EventHandler<RoutedEventArgs> handler = (s, e) =>
            {
                Assert.Equal(RoutingStrategies.Direct, e.Route);
                called = true;
            };

            var target = CreateTree(ev, handler, RoutingStrategies.Direct);

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

            Assert.True(called);
        }
开发者ID:Sergey-Terekhin,项目名称:Perspex,代码行数:18,代码来源:InteractiveTests.cs

示例6: Bubbling_Subscription_Should_Not_Catch_Tunneling

        public void Bubbling_Subscription_Should_Not_Catch_Tunneling()
        {
            var ev = new RoutedEvent(
                "test",
                RoutingStrategies.Bubble | RoutingStrategies.Tunnel,
                typeof(RoutedEventArgs),
                typeof(TestInteractive));
            var count = 0;

            EventHandler<RoutedEventArgs> handler = (s, e) =>
            {
                Assert.Equal(RoutingStrategies.Bubble, e.Route);
                ++count;
            };

            var target = this.CreateTree(ev, handler, RoutingStrategies.Bubble);

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

            Assert.Equal(2, count);
        }
开发者ID:Robertofon,项目名称:Perspex,代码行数:22,代码来源:InteractiveTests.cs

示例7: ContainerSelectionChanged

        /// <summary>
        /// Called when a container raises the <see cref="IsSelectedChangedEvent"/>.
        /// </summary>
        /// <param name="e">The event.</param>
        private void ContainerSelectionChanged(RoutedEventArgs e)
        {
            if (!_ignoreContainerSelectionChanged)
            {
                var selectable = (ISelectable)e.Source;

                if (selectable != null)
                {
                    UpdateSelectionFromEventSource(e.Source, selectable.IsSelected);
                }
            }
        }
开发者ID:rdterner,项目名称:Perspex,代码行数:16,代码来源:SelectingItemsControl.cs

示例8: OnMenuClick

 /// <summary>
 /// Called when a submenu is clicked somewhere in the menu.
 /// </summary>
 /// <param name="e">The event args.</param>
 private void OnMenuClick(RoutedEventArgs e)
 {
     Close();
     FocusManager.Instance.Focus(null);
     e.Handled = true;
 }
开发者ID:KvanTTT,项目名称:Perspex,代码行数:10,代码来源:Menu.cs

示例9: OnLostFocus

 /// <summary>
 /// Called when the menu loses focus.
 /// </summary>
 /// <param name="e">The event args.</param>
 protected override void OnLostFocus(RoutedEventArgs e)
 {
     base.OnLostFocus(e);
     SelectedItem = null;
 }
开发者ID:KvanTTT,项目名称:Perspex,代码行数:9,代码来源:Menu.cs

示例10: ItemIsSelectedChanged

        /// <summary>
        /// Called when the selection on a child item changes.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected virtual void ItemIsSelectedChanged(RoutedEventArgs e)
        {
            var selectable = e.Source as ISelectable;

            if (selectable != null && selectable != this && selectable.IsSelected)
            {
                var container = this.ItemContainerGenerator.GetItemForContainer((Control)selectable);

                if (container != null)
                {
                    this.SelectedItem = container;
                    e.Handled = true;
                }
            }
        }
开发者ID:MarkWalls,项目名称:Perspex,代码行数:19,代码来源:SelectingItemsControl.cs

示例11: OnPreviewPointerPressed

        /// <summary>
        /// Global handler for pointer pressed events.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event args.</param>
        private void OnPreviewPointerPressed(object sender, RoutedEventArgs e)
        {
            if (sender == e.Source)
            {
                var ev = (PointerPressEventArgs)e;
                var element = (ev.Device.Captured as IInputElement) ?? (e.Source as IInputElement);

                if (element == null || !CanFocus(element))
                {
                    element = element.GetSelfAndVisualAncestors()
                        .OfType<IInputElement>()
                        .FirstOrDefault(x => CanFocus(x));
                }

                if (element != null)
                {
                    this.Focus(element);
                }
            }
        }
开发者ID:MarkWalls,项目名称:Perspex,代码行数:25,代码来源:FocusManager.cs

示例12: Events_Should_Have_Route_Set

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

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

            Assert.Equal(new[]
            {
                RoutingStrategies.Tunnel,
                RoutingStrategies.Tunnel,
                RoutingStrategies.Bubble,
                RoutingStrategies.Bubble,
            },
            invoked);
        }
开发者ID:Robertofon,项目名称:Perspex,代码行数:23,代码来源:InteractiveTests.cs

示例13: RaiseClickEvent

        /// <summary>
        /// Raises the <see cref="Click"/> event.
        /// </summary>
        private void RaiseClickEvent()
        {
            RoutedEventArgs click = new RoutedEventArgs
            {
                RoutedEvent = ClickEvent,
            };

            this.RaiseEvent(click);
        }
开发者ID:Scellow,项目名称:Perspex,代码行数:12,代码来源:Button.cs

示例14: OnSubmenuOpened

        /// <summary>
        /// Called when a submenu is opened on this MenuItem or a child MenuItem.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected virtual void OnSubmenuOpened(RoutedEventArgs e)
        {
            var menuItem = e.Source as MenuItem;

            if (menuItem != null && menuItem.Parent == this)
            {
                foreach (var child in this.Items.OfType<MenuItem>())
                {
                    if (child != menuItem && child.IsSubMenuOpen)
                    {
                        child.IsSubMenuOpen = false;
                    }
                }
            }
        }
开发者ID:MarkWalls,项目名称:Perspex,代码行数:19,代码来源:MenuItem.cs

示例15: Direct_Class_Handlers_Should_Be_Called

        public void Direct_Class_Handlers_Should_Be_Called()
        {
            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 = this.CreateTree(ev, null, 0);

            ev.AddClassHandler(typeof(TestInteractive), handler, RoutingStrategies.Direct);

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

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


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