示例#1
0
            protected IEnumerator DoDelayedRelease(IKeyPress keyPress)
            {
                var time = Time.unscaledTime;

                yield return(keyPress.WaitForKeySent());

                keyPress.Release();
            }
示例#2
0
        /**
         * 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());
        }
示例#3
0
        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;
        }
示例#4
0
        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,
            };
        }
示例#5
0
 public Manager(IKeyPress keyPress, ILogger logger)
 {
     _keyPress = keyPress;
     _logger   = logger;
 }
示例#6
0
 public void DelayedRelease(IKeyPress keyPress)
 {
     StartCoroutine(DoDelayedRelease(keyPress));
 }