예제 #1
0
        private void ReadMouseAction()
        {
            MouseActionBase action;

            if (radMouseClick.Checked)
            {
                action = new MouseClickAction();
            }
            else if (radMouseDown.Checked)
            {
                action = new MouseDownAction();
            }
            else if (radMouseUp.Checked)
            {
                action = new MouseUpAction();
            }
            else
            {
                throw new ArgumentException("Mouse event type could not be determined.");
            }

            action.MoveMouse = chkMoveMouse.Checked;
            action.MoveX     = (int)numMouseMoveX.Value;
            action.MoveY     = (int)numMouseMoveY.Value;
            action.Button    = (MouseButtonType)Enum.Parse(typeof(MouseButtonType), cmbMouseClickType.SelectedValue.ToString());
            SetAction        = action;
        }
예제 #2
0
 private void HookManager_MouseDown(object sender, MouseEventArgs e)
 {
     try
     {
         UpdateWorkingDir(true);
         lock (_locker)
         {
             if (_is_monitoring)
             {
                 UserAction action = new MouseDownAction(e.Button, (uint)e.X, (uint)e.Y, _modifiers);
                 if (_is_recording)
                 {
                     _macro.AddAction(action);
                 }
                 if (!IsBrowsingExplorerWindow(action.Window))
                 {
                     _actions.AddAction(action);
                 }
                 else
                 {
                     _actions.ValidadeActions();
                 }
                 NotifyOtherAgents();
                 _last_user_action = DateTime.Now;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #3
0
        private void Canv_MouseUp(object sender, MouseButtonEventArgs e)
        {
            Point endPoint = e.GetPosition(null);

            if (this.pending_action == MouseDownAction.DrawNewLine)
            {
                this.curr_line.X2     = endPoint.X;
                this.curr_line.Y2     = endPoint.Y;
                this.curr_line.Cursor = Cursors.Hand;
                this.curr_line        = null;
            }
            else if (this.pending_action == MouseDownAction.MoveExistingLine)
            {
                this.line_selected.Stroke = new SolidColorBrush(Colors.Blue);
                this.line_selected        = null;
            }

            this.pending_action = MouseDownAction.Nothing;
        }
예제 #4
0
 private void Canv_MouseDown(object sender, MouseButtonEventArgs e)
 {
     this.startPoint = e.GetPosition(null);
     if (this.line_selected == null)
     {
         this.pending_action            = MouseDownAction.DrawNewLine;
         this.curr_line                 = new Line();
         this.curr_line.X1              = this.startPoint.X;
         this.curr_line.Y1              = this.startPoint.Y;
         this.curr_line.X2              = this.startPoint.X;
         this.curr_line.Y2              = this.startPoint.Y;
         this.curr_line.StrokeThickness = 5;
         this.curr_line.Stroke          = new SolidColorBrush(Colors.Blue);
         this.canv.Children.Add(this.curr_line);
     }
     else
     {
         this.pending_action = MouseDownAction.MoveExistingLine;
     }
 }
예제 #5
0
 private void Control_MouseDown(object sender, MouseEventArgs e)
 {
     MouseDownAction?.Invoke(sender, e);
 }
예제 #6
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.MouseUp"></see> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs"></see> that contains the event data.</param>
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (m_mouseDownAction == MouseDownAction.Picking)
            {
                HandlePick(e);
            }
            else if (m_mouseDownAction == MouseDownAction.ControllingCamera)
            {
                CameraController.MouseUp(this, e);
            }
            else if (m_mouseDownAction == MouseDownAction.Manipulating)
            {
                DesignView.Manipulator.OnEndDrag(this, e.Location);
            }
            else if (e.Button == MouseButtons.Right)
            {
                IEnumerable<IContextMenuCommandProvider>
                    contextMenuCommandProviders = Globals.MEFContainer.GetExportedValues<IContextMenuCommandProvider>();

                Point clientPoint = new Point(e.X, e.Y);
                Point screenPoint = PointToScreen(clientPoint);

                object target = this;
                IList<object> pickList = Pick(e);
                if (pickList.Count > 0)
                {
                    Path<object> pickedObj = (Path<object>)pickList[0];
                    target = pickedObj.Last;
                }

                IEnumerable<object> commands =
                    contextMenuCommandProviders.GetCommands(DesignView.Context, target);

                ICommandService commandService = Globals.MEFContainer.GetExportedValue<ICommandService>();
                commandService.RunContextMenu(commands, screenPoint);
            }

            m_mouseDownAction = MouseDownAction.None;

            DesignView.InvalidateViews();
            base.OnMouseUp(e);
        }
예제 #7
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.MouseDown"></see> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs"></see> that contains the event data.</param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            // reject additional mouse clicks until current is done.
            if (m_mouseDownAction != MouseDownAction.None)
                return;

            Focus();

            FirstMousePoint = CurrentMousePoint = new Point(e.X, e.Y);
            m_dragOverThreshold = false;

            if (DesignView.Context != null)
            {
                bool handled = CameraController.MouseDown(this, e);
                if (handled)
                {
                    m_mouseDownAction = MouseDownAction.ControllingCamera;
                }
                else if (e.Button == MouseButtons.Left)
                {// either regular pick or manipulator pick.
                    if (DesignView.Manipulator != null && DesignView.Manipulator.Pick(this, e.Location))
                    {
                        m_mouseDownAction = MouseDownAction.Manipulating;
                    }
                    else
                    {
                        m_mouseDownAction = MouseDownAction.Picking;
                    }
                }
            }
            DesignView.InvalidateViews();
            base.OnMouseDown(e);
        }