Exemple #1
0
 /// <summary>
 /// Event handler for the NodeDoubleClickEvent
 /// </summary>
 /// <param name="args">Arguments for the event</param>
 public void NodeDoubleClickEventHandler(NodeViewModelMouseEventArgs <System.Windows.Input.MouseButtonEventArgs> args)
 {
     if (NodeDoubleClicked != null)
     {
         NodeDoubleClicked(this, ScriptableNodeEventArgs.Create(args));
     }
 }
Exemple #2
0
 /// <summary>
 /// Event handler for the NodeMouseLeaveEvent
 /// </summary>
 /// <param name="args">Arguments for the event</param>
 public void NodeMouseLeaveEventHandler(NodeViewModelMouseEventArgs <System.Windows.Input.MouseEventArgs> args)
 {
     if (NodeMouseLeave != null)
     {
         NodeMouseLeave(this, ScriptableNodeEventArgs.Create(args));
     }
 }
Exemple #3
0
 /// <summary>
 /// Handles the MouseLeftButtonDown event
 /// </summary>
 /// <param name="args">The arguments for the event</param>
 public void NodeMouseLeftButtonDownEventHandler(NodeViewModelMouseEventArgs <MouseButtonEventArgs> args)
 {
     // Turn on node dragging if we are in node selection mode
     if (!isPanMode)
     {
         isLeftButtonDown   = true;
         dragTargetNode     = args.NodeViewModel;
         isMouseDownHandled = true;
     }
 }
Exemple #4
0
        /// <summary>
        /// Handles the NodeMouseEnter event
        /// </summary>
        /// <param name="args">The arguments for the event</param>
        public void NodeMouseEnterEventHandler(NodeViewModelMouseEventArgs <MouseEventArgs> args)
        {
            // Positioning of the popup (the horizontal and vertical offsets) are
            // handled by a Behavior on the view.

            if (args.NodeViewModel.ParentNode != null && args.NodeViewModel.ParentNode.Attributes != null)
            {
                Show(args.NodeViewModel.ParentNode.Attributes.Select((record) => new KeyValuePair <string, string>(record.Key, record.Value.DisplayValue)));
            }
            else
            {
                Show(null);
            }
        }
Exemple #5
0
        /// <summary>
        /// Handles the MouseRightButtonDown event for the Node
        /// </summary>
        /// <param name="args">Arguments for the event</param>
        public void NodeMouseRightButtonDownEventHandler(NodeViewModelMouseEventArgs <MouseButtonEventArgs> args)
        {
            // Ensure that the context menu has not already been initialized
            if (nodeContextMenu == null)
            {
                nodeContextMenu             = new ContextMenu();
                nodeContextMenu.ItemsSource = nodeMenuItems;
                nodeContextMenu.Opening    += new RoutedEventHandler(NodeContextMenuOpeningHandler);
                nodeContextMenu.Closed     += new RoutedEventHandler(NodeContextMenuClosedHandler);
            }

            // Save the NodeViewModel that the right click was on
            targetNodeVM = args.NodeViewModel;

            // Open the Node's ContextMenu
            nodeContextMenu.OpenPopup(args.MouseArgs.GetPosition(null));
        }
Exemple #6
0
 /// <summary>
 /// Handles the NodeMouseMoveEvent
 /// </summary>
 /// <param name="args">The arguments for the event</param>
 public void NodeMouseMoveEventHandler(NodeViewModelMouseEventArgs <MouseEventArgs> args)
 {
     // If the left mouse button is down while the mouse is being moved
     // we can assume the user is dragging the node and shouldn't show
     // the attribute popup
     if (this.mouseLeftButtonDown)
     {
         if (IsOpen)
         {
             IsOpen = false;
         }
         else
         {
             this.openTimer.Stop();
         }
     }
 }
Exemple #7
0
 /// <summary>
 /// Event handler for the NodeDoubleClickEvent
 /// </summary>
 /// <param name="args">Arguments for the event</param>
 public void NodeDoubleClickEventHandler(NodeViewModelMouseEventArgs<System.Windows.Input.MouseButtonEventArgs> args)
 {
     if (NodeDoubleClicked != null)
     {
         NodeDoubleClicked(this, ScriptableNodeEventArgs.Create(args));
     }
 }
Exemple #8
0
        /// <summary>
        /// Handles the MouseRightButtonDown event for the Node
        /// </summary>
        /// <param name="args">Arguments for the event</param>
        public void NodeMouseRightButtonDownEventHandler(NodeViewModelMouseEventArgs<MouseButtonEventArgs> args)
        {
            // Ensure that the context menu has not already been initialized
                if (nodeContextMenu == null)
                {
                    nodeContextMenu = new ContextMenu();
                    nodeContextMenu.ItemsSource = nodeMenuItems;
                    nodeContextMenu.Opening += new RoutedEventHandler(NodeContextMenuOpeningHandler);
                    nodeContextMenu.Closed += new RoutedEventHandler(NodeContextMenuClosedHandler);
                }

                // Save the NodeViewModel that the right click was on
                targetNodeVM = args.NodeViewModel;

                // Open the Node's ContextMenu
                nodeContextMenu.OpenPopup(args.MouseArgs.GetPosition(null));
        }
Exemple #9
0
 public void OnNodeMouseMove(NodeViewModelMouseEventArgs <MouseEventArgs> eventArgs)
 {
     Events.Add(string.Format("NodeMoved - {0}", eventArgs.NodeViewModel.ParentNode.ID));
 }
Exemple #10
0
 public void OnNodeMouseLeftButtonDown(NodeViewModelMouseEventArgs <MouseButtonEventArgs> eventArgs)
 {
     Events.Add(string.Format("NodeMouseLeftButtonDown - {0}", eventArgs.NodeViewModel.ParentNode.ID));
 }
 public void OnNodeMouseMove(NodeViewModelMouseEventArgs<MouseEventArgs> eventArgs)
 {
     Events.Add(string.Format("NodeMoved - {0}", eventArgs.NodeViewModel.ParentNode.ID));
 }
Exemple #12
0
 /// <summary>
 /// Handles the NodeMouseLeftButtonUp event
 /// </summary>
 /// <param name="args">The arguments for the event</param>
 public void NodeMouseLeftButtonUpEventHandler(NodeViewModelMouseEventArgs <MouseButtonEventArgs> args)
 {
     // Update the flag that indicates the state of the left
     // mouse button on the node
     this.mouseLeftButtonDown = false;
 }
 /// <summary>
 /// Event handler to handle when a node is clicked
 /// </summary>
 /// <param name="eventArgs">Any event arguments that might be passed</param>
 public void OnNodeMouseLeftButtonUp(NodeViewModelMouseEventArgs<MouseButtonEventArgs> eventArgs)
 {
     Events.Add(string.Format("NodeMouseLeftButtonUp - {0}", eventArgs.NodeViewModel.ParentNode.ID));
 }
 /// <summary>
 /// Handles the NodeDoubleClick event
 /// </summary>
 /// <param name="args">The arguments for the event</param>
 public void NodeDoubleClickEventHandler(NodeViewModelMouseEventArgs<MouseButtonEventArgs> args)
 {
     CollapseOrExpandNode(args.NodeViewModel);
 }
 /// <summary>
 /// Handles the NodeMouseLeftButtonUp event
 /// </summary>
 /// <param name="args">The arguments for the event</param>
 public void NodeMouseLeftButtonUpEventHandler(NodeViewModelMouseEventArgs<MouseButtonEventArgs> args)
 {
     // Update the flag that indicates the state of the left
     // mouse button on the node
     this.mouseLeftButtonDown = false;
 }
 /// <summary>
 /// Handles the NodeMouseLeave event
 /// </summary>
 /// <param name="args">The arguments for the event</param>
 public void NodeMouseLeaveEventHandler(NodeViewModelMouseEventArgs<MouseEventArgs> args)
 {
     Close();
 }
        /// <summary>
        /// Handles the NodeMouseEnter event
        /// </summary>
        /// <param name="args">The arguments for the event</param>
        public void NodeMouseEnterEventHandler(NodeViewModelMouseEventArgs<MouseEventArgs> args)
        {
            // Positioning of the popup (the horizontal and vertical offsets) are
            // handled by a Behavior on the view.

            if (args.NodeViewModel.ParentNode != null && args.NodeViewModel.ParentNode.Attributes != null)
            {
                Show(args.NodeViewModel.ParentNode.Attributes.Select((record) => new KeyValuePair<string, string>(record.Key, record.Value.DisplayValue)));
            }
            else
            {
                Show(null);
            }
        }
Exemple #18
0
 /// <summary>
 /// Raises the NodeMouseMove event
 /// </summary>
 /// <param name="e">The event arguments</param>
 protected virtual void OnNodeMouseMove(NodeViewModelMouseEventArgs <MouseEventArgs> args)
 {
     this.eventAggregator.GetEvent <NodeMouseMoveEvent>().Publish(args);
 }
Exemple #19
0
 /// <summary>
 /// Event handler for the NodeMouseLeaveEvent
 /// </summary>
 /// <param name="args">Arguments for the event</param>
 public void NodeMouseLeaveEventHandler(NodeViewModelMouseEventArgs<System.Windows.Input.MouseEventArgs> args)
 {
     if (NodeMouseLeave != null)
     {
         NodeMouseLeave(this, ScriptableNodeEventArgs.Create(args));
     }
 }
Exemple #20
0
 /// <summary>
 /// Raises the NodeMouseMove event
 /// </summary>
 /// <param name="e">The event arguments</param>
 protected virtual void OnNodeMouseMove(NodeViewModelMouseEventArgs<MouseEventArgs> args)
 {
     this.eventAggregator.GetEvent<NodeMouseMoveEvent>().Publish(args);
 }
Exemple #21
0
 /// <summary>
 /// Handles the NodeDoubleClick event
 /// </summary>
 /// <param name="args">The arguments for the event</param>
 public void NodeDoubleClickEventHandler(NodeViewModelMouseEventArgs <MouseButtonEventArgs> args)
 {
     CollapseOrExpandNode(args.NodeViewModel);
 }
Exemple #22
0
        /// <summary>
        /// Handles the MouseLeftButtonUp event
        /// </summary>
        /// <param name="args">The arguments for the event</param>
        public void NodeMouseLeftButtonUpEventHandler(NodeViewModelMouseEventArgs <MouseButtonEventArgs> args)
        {
            // Only allow node manipulation if we are not in pan mode
            if (!isPanMode)
            {
                NodeSelector nodeSelector = GraphManager.Instance.DefaultGraphComponentsInstance.NodeSelector;

                // Check if we were dragging the node
                if (isNodeDragging)
                {
                    // Turn off node dragging
                    isNodeDragging = false;
                    dragTargetNode = null;
                }
                else
                {
                    // Check if any nodes are currently selected
                    if (nodeSelector.AreAnyNodesSelected)
                    {
                        // Check if Control is pressed
                        if ((Keyboard.Modifiers & ModifierKeys.Alt) > 0)
                        {
                            nodeSelector.InvertSelection();
                        }
                        else
                        {
                            // Check if multiple nodes are selected
                            if (nodeSelector.AreMultipleNodesSelected)
                            {
                                // Check if target node is already selected
                                if (nodeSelector.SelectedNodes.Contains(args.NodeViewModel))
                                {
                                    // Check if Control is pressed
                                    if ((Keyboard.Modifiers & ModifierKeys.Control) > 0)
                                    {
                                        nodeSelector.Unselect(args.NodeViewModel);
                                        return;
                                    }
                                    else
                                    {
                                        nodeSelector.UnselectAll();
                                    }
                                }
                                else     // Target node is not selected
                                {
                                    // Check if Control is pressed
                                    if ((Keyboard.Modifiers & ModifierKeys.Control) == 0)
                                    {
                                        nodeSelector.UnselectAll();
                                    }
                                }
                            }
                            else     // Only one node is selected
                            {
                                // Check if the target node is already selected
                                if (nodeSelector.SelectedNode.Equals(args.NodeViewModel))
                                {
                                    nodeSelector.Unselect(nodeSelector.SelectedNode);
                                    return;
                                }
                                else     // Target node is not selected
                                {
                                    // Check if Control is pressed
                                    if ((Keyboard.Modifiers & ModifierKeys.Control) == 0)
                                    {
                                        nodeSelector.Unselect(nodeSelector.SelectedNode);
                                    }
                                }
                            }
                        }
                    }

                    // Set the SELECTED state of the clicked node
                    nodeSelector.Select(args.NodeViewModel);
                }
            }
        }
 /// <summary>
 /// Handles the NodeMouseMoveEvent
 /// </summary>
 /// <param name="args">The arguments for the event</param>
 public void NodeMouseMoveEventHandler(NodeViewModelMouseEventArgs<MouseEventArgs> args)
 {
     // If the left mouse button is down while the mouse is being moved
     // we can assume the user is dragging the node and shouldn't show
     // the attribute popup
     if (this.mouseLeftButtonDown)
         if (IsOpen)
             IsOpen = false;
         else
             this.openTimer.Stop();
 }
Exemple #24
0
 /// <summary>
 /// Handles the NodeMouseLeave event
 /// </summary>
 /// <param name="args">The arguments for the event</param>
 public void NodeMouseLeaveEventHandler(NodeViewModelMouseEventArgs <MouseEventArgs> args)
 {
     Close();
 }