/// <summary> /// OnStop(): Put your stop code here /// - Stop threads, set final data, etc. /// </summary> protected override void OnStop() { base.OnStop(); //Stop the key manager keykookManager.Stop(); }
public void Stop() { if (_keyManager != null) { _keyManager.Stop(); } }
static void Exit_Click(object sender, EventArgs e) { _icon.Visible = false; _icon.Dispose(); _keyMgr.Stop(); Application.Exit(); Environment.Exit(0); }
protected void Dispose(bool disposing) { if (!disposing) { return; } _keyMgr.Stop(); _keyMgr.Dispose(); }
protected override void Dispose(bool disposing) { _winHook.WindowCreated -= _winHook_WindowSetChanged; _winHook.WindowDestroyed -= _winHook_WindowSetChanged; _keyMgr.Stop(); _keyMgr.Dispose(); HideSwitcher(); HideOverlays(); base.Dispose(disposing); }
/// <summary> /// Stop the process /// </summary> public void Stop() { if (keyManager != null) { keyManager.Stop(); } if (fileManager != null) { fileManager.Stop(); } }
static void Main(string[] args) { ProcessArgs(args); _random = new Random(); _keyMgr = new KeyHookManager(); _keyMgr.KeyDown += new KeyEventHandler(_keyMgr_KeyDown); _keyMgr.KeyPress += new KeyPressEventHandler(_keyMgr_KeyPress); _keyMgr.Start(); Application.Run(); _keyMgr.Stop(); }
static void Exit(object sender, EventArgs e) { //one of the rare instances I'd like an old sk00l ON ERROR RESUME NEXT try { _icon.Visible = false; } catch { } try { _icon.Dispose(); } catch { } try { _keyHook.Stop(); } catch { } try { Application.Exit(); } catch { } Environment.Exit(0); }
static void Exit_Click(object sender, EventArgs e) { lock (_exitMonitor) { _stop = true; Monitor.PulseAll(_exitMonitor); } _mgr.Stop(); _icon.Visible = false; _icon.Dispose(); Application.Exit(); Thread.Sleep(1000); Environment.Exit(0); }
static void _keyMgr_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Back && KeyHookManager.IsKeyHeld(Keys.ControlKey)) { _keyMgr.Stop(); Environment.Exit(0); } bool handled = false; if (consumeKeys) { int num = _random.Next(1, consumeRate + 1); if (num == 1) { //do the consume here e.SuppressKeyPress = true; handled = true; } } if (!handled && changeKeys) { int num = _random.Next(1, consumeRate + 1); if (num == 1) { //do the change here int rnd = _random.Next(-3, 4); if (rnd == 0) //0 is no fun { rnd = 1; } char newKey = (char)((int)e.KeyCode + rnd); //would be better to check state of shift and capslock, but alas, always do lower string newString = new string(newKey, 1).ToLower(); SendKeys.Send(newString); e.SuppressKeyPress = true; handled = true; } } } catch { //shhhhhhhhhhh } }
static void _cmd_Exiting(object sender, EventArgs e) { _hookMgr.Stop(); }
static void _mouseHook_OnMouseActivity(object sender, MouseEventArgs e) { _mouseHook.Stop(); _keyHook.Stop(); Environment.Exit(0); }