Skip to content

Commit

Permalink
Reverting getter expressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmamaladze committed Jan 16, 2018
1 parent 2e8db7b commit 14d362b
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 45 deletions.
11 changes: 9 additions & 2 deletions MouseKeyHook.Rx/KeyWithState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ public KeyWithState(Keys key, KeyboardState state)
{
}

public Keys KeyCode => Item1;
public KeyboardState State => Item2;
public Keys KeyCode
{
get { return Item1; }
}

public KeyboardState State
{
get { return Item2; }
}

public bool Matches(Trigger trigger)
{
Expand Down
5 changes: 4 additions & 1 deletion MouseKeyHook.Rx/Sequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public Sequence(params T[] elements)
_elements = elements;
}

public int Length => _elements.Length;
public int Length
{
get { return _elements.Length; }
}

public IEnumerator<T> GetEnumerator()
{
Expand Down
15 changes: 12 additions & 3 deletions MouseKeyHook.Rx/Trigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,20 @@ private Trigger(Keys triggerKey, IEnumerable<Keys> additionalKeys)

public Keys TriggerKey { get; }

public IEnumerable<Keys> AdditionalKeys => _addKeys;
public IEnumerable<Keys> AdditionalKeys
{
get { return _addKeys; }
}

public IEnumerable<Keys> AllKeys => _addKeys.Concat(Enumerable.Repeat(TriggerKey, 1));
public IEnumerable<Keys> AllKeys
{
get { return _addKeys.Concat(Enumerable.Repeat(TriggerKey, 1)); }
}

public int Length => _addKeys.Count + 1;
public int Length
{
get { return _addKeys.Count + 1; }
}

public static Trigger On(Keys key)
{
Expand Down
7 changes: 5 additions & 2 deletions MouseKeyHook/HotKeys/HotKeySet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,17 @@ public HotKeySet(IEnumerable<Keys> hotkeys)
/// <summary>
/// Returns whether the set of Keys is activated
/// </summary>
public bool HotKeysActivated => m_hotkeydowncount == m_hotkeystate.Count - m_remappingCount;
public bool HotKeysActivated
{
get { return m_hotkeydowncount == m_hotkeystate.Count - m_remappingCount; }
}

/// <summary>
/// Gets or sets the enabled state of the HotKey set.
/// </summary>
public bool Enabled
{
get => m_enabled;
get { return m_enabled; }
set
{
if (value)
Expand Down
68 changes: 34 additions & 34 deletions MouseKeyHook/Implementation/EventFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,104 +14,104 @@ internal abstract class EventFacade : IKeyboardMouseEvents

public event KeyEventHandler KeyDown
{
add => GetKeyListener().KeyDown += value;
remove => GetKeyListener().KeyDown -= value;
add { GetKeyListener().KeyDown += value; }
remove { GetKeyListener().KeyDown -= value; }
}

public event KeyPressEventHandler KeyPress
{
add => GetKeyListener().KeyPress += value;
remove => GetKeyListener().KeyPress -= value;
add { GetKeyListener().KeyPress += value; }
remove { GetKeyListener().KeyPress -= value; }
}

public event KeyEventHandler KeyUp
{
add => GetKeyListener().KeyUp += value;
remove => GetKeyListener().KeyUp -= value;
add { GetKeyListener().KeyUp += value; }
remove { GetKeyListener().KeyUp -= value; }
}

public event MouseEventHandler MouseMove
{
add => GetMouseListener().MouseMove += value;
remove => GetMouseListener().MouseMove -= value;
add { GetMouseListener().MouseMove += value; }
remove { GetMouseListener().MouseMove -= value; }
}

public event EventHandler<MouseEventExtArgs> MouseMoveExt
{
add => GetMouseListener().MouseMoveExt += value;
remove => GetMouseListener().MouseMoveExt -= value;
add { GetMouseListener().MouseMoveExt += value; }
remove { GetMouseListener().MouseMoveExt -= value; }
}

public event MouseEventHandler MouseClick
{
add => GetMouseListener().MouseClick += value;
remove => GetMouseListener().MouseClick -= value;
add { GetMouseListener().MouseClick += value; }
remove { GetMouseListener().MouseClick -= value; }
}

public event MouseEventHandler MouseDown
{
add => GetMouseListener().MouseDown += value;
remove => GetMouseListener().MouseDown -= value;
add { GetMouseListener().MouseDown += value; }
remove { GetMouseListener().MouseDown -= value; }
}

public event EventHandler<MouseEventExtArgs> MouseDownExt
{
add => GetMouseListener().MouseDownExt += value;
remove => GetMouseListener().MouseDownExt -= value;
add { GetMouseListener().MouseDownExt += value; }
remove { GetMouseListener().MouseDownExt -= value; }
}

public event MouseEventHandler MouseUp
{
add => GetMouseListener().MouseUp += value;
remove => GetMouseListener().MouseUp -= value;
add { GetMouseListener().MouseUp += value; }
remove { GetMouseListener().MouseUp -= value; }
}

public event EventHandler<MouseEventExtArgs> MouseUpExt
{
add => GetMouseListener().MouseUpExt += value;
remove => GetMouseListener().MouseUpExt -= value;
add { GetMouseListener().MouseUpExt += value; }
remove { GetMouseListener().MouseUpExt -= value; }
}

public event MouseEventHandler MouseWheel
{
add => GetMouseListener().MouseWheel += value;
remove => GetMouseListener().MouseWheel -= value;
add { GetMouseListener().MouseWheel += value; }
remove { GetMouseListener().MouseWheel -= value; }
}

public event EventHandler<MouseEventExtArgs> MouseWheelExt
{
add => GetMouseListener().MouseWheelExt += value;
remove => GetMouseListener().MouseWheelExt -= value;
add { GetMouseListener().MouseWheelExt += value; }
remove { GetMouseListener().MouseWheelExt -= value; }
}

public event MouseEventHandler MouseDoubleClick
{
add => GetMouseListener().MouseDoubleClick += value;
remove => GetMouseListener().MouseDoubleClick -= value;
add { GetMouseListener().MouseDoubleClick += value; }
remove { GetMouseListener().MouseDoubleClick -= value; }
}

public event MouseEventHandler MouseDragStarted
{
add => GetMouseListener().MouseDragStarted += value;
remove => GetMouseListener().MouseDragStarted -= value;
add { GetMouseListener().MouseDragStarted += value; }
remove { GetMouseListener().MouseDragStarted -= value; }
}

public event EventHandler<MouseEventExtArgs> MouseDragStartedExt
{
add => GetMouseListener().MouseDragStartedExt += value;
remove => GetMouseListener().MouseDragStartedExt -= value;
add { GetMouseListener().MouseDragStartedExt += value; }
remove { GetMouseListener().MouseDragStartedExt -= value; }
}

public event MouseEventHandler MouseDragFinished
{
add => GetMouseListener().MouseDragFinished += value;
remove => GetMouseListener().MouseDragFinished -= value;
add { GetMouseListener().MouseDragFinished += value; }
remove { GetMouseListener().MouseDragFinished -= value; }
}

public event EventHandler<MouseEventExtArgs> MouseDragFinishedExt
{
add => GetMouseListener().MouseDragFinishedExt += value;
remove => GetMouseListener().MouseDragFinishedExt -= value;
add { GetMouseListener().MouseDragFinishedExt += value; }
remove { GetMouseListener().MouseDragFinishedExt -= value; }
}

public void Dispose()
Expand Down
15 changes: 12 additions & 3 deletions MouseKeyHook/MouseEventExtArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ internal MouseEventExtArgs(MouseButtons buttons, int clicks, Point point, int de
/// <summary>
/// True if event contains information about wheel scroll.
/// </summary>
public bool WheelScrolled => Delta != 0;
public bool WheelScrolled
{
get { return Delta != 0; }
}

/// <summary>
/// True if event signals a click. False if it was only a move or wheel scroll.
/// </summary>
public bool Clicked => Clicks > 0;
public bool Clicked
{
get { return Clicks > 0; }
}

/// <summary>
/// True if event signals mouse button down.
Expand All @@ -66,7 +72,10 @@ internal MouseEventExtArgs(MouseButtons buttons, int clicks, Point point, int de

/// <summary>
/// </summary>
internal Point Point => new Point(X, Y);
internal Point Point
{
get { return new Point(X, Y); }
}

internal static MouseEventExtArgs FromRawDataApp(CallbackData data)
{
Expand Down

0 comments on commit 14d362b

Please sign in to comment.