/// <summary> /// Creates a new instance of <see cref="MouseKeyHook"/>. /// </summary> public MouseKeyHook(MouseClickSettings mouseClickSettings, KeystrokesSettings keystrokesSettings, KeymapViewModel keymap, string fileName, Func <TimeSpan> elapsed) { _mouseClickSettings = mouseClickSettings; _keystrokesSettings = keystrokesSettings; _keymap = keymap; _hook = Hook.GlobalEvents(); _hook.MouseDown += (sender, e) => { _mouseClicked = true; _mouseButtons = e.Button; }; _hook.MouseUp += (sender, e) => _mouseClicked = false; if (keystrokesSettings.SeparateTextFile) { _textWriter = InitKeysToTextFile(fileName, elapsed); } else { _records = new KeyRecords(keystrokesSettings.HistoryCount); _hook.KeyDown += OnKeyDown; _hook.KeyUp += OnKeyUp; } }
public string ToString(KeymapViewModel Keymap) { var pressed = new List <string>(); if (Control) { pressed.Add(Keymap.Control); } if (Shift) { pressed.Add(Keymap.Shift); } if (Alt) { pressed.Add(Keymap.Alt); } if (pressed.Count == 0) { return(""); } return(string.Join(" + ", pressed)); }
public KeyOverlay(IMouseKeyHook Hook, KeystrokesSettings Settings, KeymapViewModel Keymap) { _settings = Settings; _keymap = Keymap; _records = new KeyRecords(Settings.HistoryCount); Hook.KeyDown += OnKeyDown; Hook.KeyUp += OnKeyUp; }
/// <summary> /// Creates a new instance of <see cref="MouseKeyHook"/>. /// </summary> public MouseKeyOverlay(IMouseKeyHook Hook, MouseClickSettings MouseClickSettings, KeymapViewModel Keymap, string FileName, Func <TimeSpan> Elapsed) { _keymap = Keymap; _hook = Hook; _mouseClickOverlay = new MouseClickOverlay(_hook, MouseClickSettings); _scrollOverlay = new ScrollOverlay(_hook, MouseClickSettings); }
public KeyRecord(KeyEventArgs KeyEventArgs, KeymapViewModel Keymap) { _keymap = Keymap; _eventArgs = KeyEventArgs; TimeStamp = DateTime.Now; Key = KeyEventArgs.KeyCode; Control = KeyEventArgs.Control; Shift = KeyEventArgs.Shift; Alt = KeyEventArgs.Alt; _capsLock = Console.CapsLock; Display = GetDisplay(); }
/// <summary> /// Creates a new instance of <see cref="MouseKeyHook"/>. /// </summary> public MouseKeyOverlay(IMouseKeyHook Hook, MouseClickSettings MouseClickSettings, KeystrokesSettings KeystrokesSettings, KeymapViewModel Keymap, string FileName, Func <TimeSpan> Elapsed) { _keystrokesSettings = KeystrokesSettings; _keymap = Keymap; _hook = Hook; _mouseClickOverlay = new MouseClickOverlay(_hook, MouseClickSettings); if (KeystrokesSettings.SeparateTextFile) { _textWriter = InitKeysToTextFile(FileName, Elapsed); } else { _keyOverlay = new KeyOverlay(_hook, KeystrokesSettings, Keymap); } }