Example #1
0
        public MainViewModel(IXInputService xinputService,
                             ISendKeysService sendKeysService,
                             IGamepadService gamepadService,
                             IKeyboardEmulatorService keyboardEmulatorService)
        {
            this.XInputService           = xinputService;
            this.SendKeysService         = sendKeysService;
            this.GamepadService          = gamepadService;
            this.KeyboardEmulatorService = keyboardEmulatorService;

            this.PropertyChanged += this_PropertyChanged;

            this.IsListening = true;
        }
Example #2
0
 public KeyboardEmulatorService(ISendKeysService sendKeysService,
                                IXInputService xinputService,
                                IInputFactory inputFactory,
                                IMappingService mappingService)
 {
     this.KeystrokeSubscription = xinputService.Keystrokes.Subscribe(keystroke =>
     {
         if (this.IsEnabled)
         {
             if (keystroke.Flags == KeyStrokeFlags.KeyDown)
             {
                 var key = mappingService.Map(keystroke.VirtualKey);
                 if (key != null)
                 {
                     var inputs = inputFactory.GetKeyDownUp(key.Value);
                     sendKeysService.SendKeys(inputs);
                 }
             }
         }
     });
 }