예제 #1
0
        public override bool Equals(object obj)
        {
            if (obj == null) // check if its null
            {
                return(false);
            }

            if (this.GetType() != obj.GetType()) // check if the type is the same
            {
                return(false);
            }

            MouseUpAction action = (MouseUpAction)obj;

            if (action == null) // check if it can be casted
            {
                return(false);
            }

            if (this.Id > -1 && action.Id > -1) // id already specified
            {
                if (this.Id == action.Id)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                if (action.ActionType == UserActionType.MouseUpAction)
                {
                    MouseUpAction m_action = (MouseUpAction)action;
                    if (m_action._button == this._button)
                    {
                        if (this._x <= (int)(m_action._x + MAX_X_OFFSET) &&
                            this._x >= (int)(m_action._x - MAX_X_OFFSET) &&
                            this._y <= (int)(m_action._y + MAX_Y_OFFSET) &&
                            this._y >= (int)(m_action._y - MAX_Y_OFFSET))
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
        }
예제 #2
0
        public override object Clone()
        {
            MouseUpAction action = new MouseUpAction(new Window(_window), _button, _x, _y, _modifiers);

            action.Id   = this.Id;
            action.Time = this.Time;
            return(action);
        }
예제 #3
0
        public override bool Equals(UserAction action)
        {
            if ((object)action == null)
            {
                return(false);
            }

            if (this.Id > -1 && action.Id > -1) // id already specified
            {
                if (this.Id == action.Id)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                if (action.ActionType == UserActionType.MouseUpAction)
                {
                    MouseUpAction m_action = (MouseUpAction)action;
                    if (m_action._button == this._button)
                    {
                        if (this._x <= (int)(m_action._x + MAX_X_OFFSET) &&
                            this._x >= (int)(m_action._x - MAX_X_OFFSET) &&
                            this._y <= (int)(m_action._y + MAX_Y_OFFSET) &&
                            this._y >= (int)(m_action._y - MAX_Y_OFFSET))
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
        }