public HookCommandInvoker(ControllerRemotingHandlers remotingCommandHandlers) { // provide the mouse/keyboard event handlers from the controller MouseHookCommands mouseCommands = new MouseHookCommands() { DoubleLeftClickCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.DoubleLeftClick], DoubleRightClickCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.DoubleRightClick], MiddleClickCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.MiddleClick], DoubleMiddleClickCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.DoubleMiddleClick], LeftMouseDownCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.LeftMouseDown], LeftMouseUpCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.LeftMouseUp], RightMouseDownCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.RightMouseDown], RightMouseUpCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.RightMouseUp], MiddleMouseDownCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.MiddleMouseDown], MiddleMouseUpCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.MiddleMouseUp], MoveCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.Move], WheelCommand = remotingCommandHandlers.MouseCommands[GenericEnums.MouseCommandType.Wheel] }; mouseCommands.BindCommands(); commands = new Dictionary<GenericEnums.RemotingCommandType, IHookCommands>(); commands.Add(GenericEnums.RemotingCommandType.Mouse, mouseCommands); KeyboardHookCommands keyboardCommands = new KeyboardHookCommands() { KeyDownCommand = remotingCommandHandlers.KeyboardCommands[GenericEnums.KeyboardCommandType.KeyDown], KeyPressCommand = remotingCommandHandlers.KeyboardCommands[GenericEnums.KeyboardCommandType.KeyPress], KeyUpCommand = remotingCommandHandlers.KeyboardCommands[GenericEnums.KeyboardCommandType.KeyUp] }; keyboardCommands.BindCommands(); commands.Add(GenericEnums.RemotingCommandType.Keyboard, keyboardCommands); }
void InitializeRemotingCommandHandlers() { try { // add mouse & keyboard delegate from the controller RemotingCommand = Program.Controller.SendRemotingCommand; Dictionary<GenericEnums.KeyboardCommandType, Delegates.HookCommandDelegate> keyboardDelegates = new Dictionary<GenericEnums.KeyboardCommandType, Delegates.HookCommandDelegate>(); keyboardDelegates.Add(GenericEnums.KeyboardCommandType.KeyDown, Program.Controller.KeyDown); keyboardDelegates.Add(GenericEnums.KeyboardCommandType.KeyPress, Program.Controller.KeyPress); keyboardDelegates.Add(GenericEnums.KeyboardCommandType.KeyUp, Program.Controller.KeyUp); IDictionary<GenericEnums.MouseCommandType, Delegates.HookCommandDelegate> mouseDelegates = new Dictionary<GenericEnums.MouseCommandType, Delegates.HookCommandDelegate>(); mouseDelegates.Add(GenericEnums.MouseCommandType.DoubleRightClick, Program.Controller.DoubleRightClickCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.DoubleLeftClick, Program.Controller.DoubleLeftClickCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.MiddleClick, Program.Controller.MiddleClickCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.DoubleMiddleClick, Program.Controller.DoubleMiddleClickCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.LeftMouseDown, Program.Controller.LeftMouseDownCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.LeftMouseUp, Program.Controller.LeftMouseUpCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.RightMouseDown, Program.Controller.RightMouseDownCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.RightMouseUp, Program.Controller.RightMouseUpCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.MiddleMouseDown, Program.Controller.MiddleMouseDownCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.MiddleMouseUp, Program.Controller.MiddleMouseUpCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.Move, Program.Controller.MouseMoveCommand); mouseDelegates.Add(GenericEnums.MouseCommandType.Wheel, Program.Controller.MouseWheelCommand); _remotingCommandHandlers = new ControllerRemotingHandlers() { KeyboardCommands = keyboardDelegates, MouseCommands = mouseDelegates }; } catch (Exception ex) { Tools.Instance.Logger.LogError(ex.ToString()); } }