示例#1
0
        public ConditionalKeyHook(IHookCondition condition, IKeyDispatcher dispatcher)
        {
            if (ConditionalKeyHook.activeInstance != null)
            {
                ConditionalKeyHook.activeInstance.Dispose();
            }

            ConditionalKeyHook.activeInstance = this;
            this.condition  = condition;
            this.dispatcher = dispatcher;
            this.hookId     = InstallHook(proc);
            Debug.Print($"Hook installed {this.hookId}");
        }
        public ConditionalKeyDispatcher(IDispatchCondition condition, IKeyDispatcher dispatcher, DebugLogger logger)
        {
            if (ConditionalKeyDispatcher.activeInstance != null)
            {
                ConditionalKeyDispatcher.activeInstance.Dispose();
            }

            ConditionalKeyDispatcher.activeInstance = this;
            this.condition  = condition;
            this.dispatcher = dispatcher;
            this.hookId     = InstallHook(proc);
            this.logger     = logger;
            logger.Log($"Hook installed {this.hookId}");
        }