コード例 #1
0
ファイル: Tree.cs プロジェクト: timotei/White
        public override void HookEvents(IUIItemEventListener eventListener)
        {
            clickedTreeNodeHandler = AutomationElement.RegisterPropertyChangedEvent(TreeScope.Subtree, delegate
            {
                TreeNode node = ClickedNode;
                eventListener.EventOccured(new TreeNodeClickedEvent(this, node, node.IsExpanded()));
            }, ExpandCollapsePattern.ExpandCollapseStateProperty);

            selectedTreeNodeHandler = AutomationElement.RegisterPropertyChangedEvent(TreeScope.Subtree, delegate
            {
                TreeNode node = SelectedNode;
                eventListener.EventOccured((new TreeNodeSelectEvent(this, node)));
            }, SelectionItemPattern.IsSelectedProperty);
        }
コード例 #2
0
ファイル: Tree.cs プロジェクト: govtmirror/TestStack.White
        public override void HookEvents(UIItemEventListener eventListener)
        {
            clickedTreeNodeHandler = delegate
            {
                TreeNode node = ClickedNode;
                eventListener.EventOccured((new TreeNodeClickedEvent(this, node, node.IsExpanded())));
            };

            selectedTreeNodeHandler = delegate
            {
                TreeNode node = SelectedNode;
                eventListener.EventOccured((new TreeNodeSelectEvent(this, node)));
            };

            Automation.AddAutomationPropertyChangedEventHandler(automationElement, TreeScope.Subtree, clickedTreeNodeHandler,
                                                                ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty);
            Automation.AddAutomationPropertyChangedEventHandler(automationElement, TreeScope.Subtree, selectedTreeNodeHandler,
                                                                SelectionItemPatternIdentifiers.IsSelectedProperty);
        }