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; }
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()); } }
private void WrapGlControl_MouseUp(object sender, MouseEventArgs e) { MouseUpAction?.Invoke(sender, e); }