Пример #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_MouseUp(object sender, MouseEventArgs e)
        {
            try
            {
                UpdateWorkingDir(e, true);
                lock (_locker)
                {
                    if (_is_monitoring)
                    {
                        UserAction action;

                        Window window = null;
                        if (_is_recording)
                        {
                            if (_macro.UserActions.Count > 0)
                            {
                                if (_macro.UserActions[_macro.UserActions.Count - 1].IsType(UserAction.UserActionType.MouseDownAction))
                                {
                                    window = _macro.UserActions[_macro.UserActions.Count - 1].Window;
                                }
                            }
                        }
                        else
                        {
                            if (_actions.UserActions.Count > 0)
                            {
                                if (_actions.UserActions[_actions.UserActions.Count - 1].IsType(UserAction.UserActionType.MouseDownAction))
                                {
                                    window = _actions.UserActions[_actions.UserActions.Count - 1].Window;
                                }
                            }
                        }
                        if (window != null)
                        {
                            action = new MouseUpAction(window, e.Button, (uint)e.X, (uint)e.Y, _modifiers);
                        }
                        else
                        {
                            action = new MouseUpAction(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 WrapGlControl_MouseUp(object sender, MouseEventArgs e)
 {
     MouseUpAction?.Invoke(sender, e);
 }