/// <summary> /// Base constructor of <see cref="BaseHookListener"/> /// </summary> /// <param name="hooker">Depending on this parameter the listener hooks either application or global keyboard events.</param> /// <remarks> /// Hooks are not active after instantiation. You need to use either <see cref="BaseHookListener.Enabled"/> property or call <see cref="BaseHookListener.Start"/> method. /// </remarks> protected BaseHookListener(Hooker hooker) { if (hooker == null) { throw new ArgumentNullException("hooker"); } m_Hooker = hooker; }
/// <summary> /// Enables you to switch from application hooks to global hooks and vice versa on the fly /// without unsubscribing from events. Component remains enabled or disabled state after this call as it was before. /// </summary> /// <param name="hooker">An AppHooker or GlobalHooker object.</param> public void Replace(Hooker hooker) { bool rememberEnabled = Enabled; Enabled = false; m_Hooker = hooker; Enabled = rememberEnabled; }
/// <summary> /// Initializes a new instance of <see cref="KeyboardHookListener"/>. /// </summary> /// <param name="hooker">Depending on this parameter the listener hooks either application or global keyboard events.</param> /// <remarks>Hooks are not active after instantiation. You need to use either <see cref="BaseHookListener.Enabled"/> property or call <see cref="BaseHookListener.Start"/> method.</remarks> public KeyboardHookListener(Hooker hooker) : base(hooker) { }