protected IEnumerator DoDelayedRelease(IKeyPress keyPress) { var time = Time.unscaledTime; yield return(keyPress.WaitForKeySent()); keyPress.Release(); }
/** * Helper that implements the common pattern of pressing a KeyPress which may be null * and then returning an action to release that key. */ public static Action CallbackPress(IKeyPress keyPress) { if (keyPress == null) { return () => { } } ; keyPress.Press(); return(() => keyPress.Release()); }
public MainWindow() { InitializeComponent(); var container = ContainerConfig.Configure(); using (var scope = container.BeginLifetimeScope()) { _manager = scope.Resolve <IManager>(); _keyPress = scope.Resolve <IKeyPress>(); _logger = scope.Resolve <ILogger>(); } _viewModel = new KeyPressViewModel(_manager, _keyPress, _logger); DataContext = _viewModel; }
public KeyPressViewModel(IManager manager, IKeyPress keyPress, ILogger logger) { this.CloseWindowCommand = new RelayCommand <IClosable>(this.CloseWindow); _keyPress = keyPress; _logger = logger; _manager = manager; _settings = new Settings { AppName = "Notepad", KeyToPress = "a", SecoundsPerPress = 1, NumberOfTimes = 15, }; }
public Manager(IKeyPress keyPress, ILogger logger) { _keyPress = keyPress; _logger = logger; }
public void DelayedRelease(IKeyPress keyPress) { StartCoroutine(DoDelayedRelease(keyPress)); }