public StandardInteractionProvider(Simulator simulator, AbstractWindowsEnvironment environmentInterface,
     out Action cancelCallback)
 {
     this.simulator = simulator;
     this.environmentInterface = environmentInterface;
     cancelCallback = HandleCancelCallback;
 }
Exemplo n.º 2
0
 public StandardInteractionProvider(
     Simulator simulator,
     AbstractWindowsEnvironment environmentInterface,
     out Action cancelCallback)
 {
     this.simulator            = simulator;
     this.environmentInterface = environmentInterface;
     cancelCallback            = HandleCancelCallback;
 }
Exemplo n.º 3
0
        public Simulator(IAction mainAction, AbstractWindowsEnvironment environmentInterface)
        {
            if (mainAction == null)
                throw new ArgumentNullException(nameof(mainAction));
            if (environmentInterface == null)
                throw new ArgumentNullException(nameof(environmentInterface));


            this.mainAction = mainAction;
            this.environmentInterface = environmentInterface;

            provider = new StandardInteractionProvider(this, environmentInterface, out cancelCallback);
        }
Exemplo n.º 4
0
        public Simulator(SimulatorConfiguration config, AbstractWindowsEnvironment environmentInterface)
        {
            if (config == null)
                throw new ArgumentNullException(nameof(config));
            if (environmentInterface == null)
                throw new ArgumentNullException(nameof(environmentInterface));
            if (config.MainAction == null)
                throw new ArgumentException("There must be an action specified in the SimulatorConfiguration.");
            

            this.config = config;
            this.environmentInterface = environmentInterface;

            provider = new StandardInteractionProvider(environmentInterface, out cancelCallback);
        }
        public void ReleaseKey(AbstractWindowsEnvironment.VirtualKeyShort key)
        {
            EnsureNotCanceled();

            int kcpIdx = keysCurrentlyPressed.IndexOf(key);
            if (kcpIdx >= 0)
            {
                environmentInterface.ReleaseKey(key);
                keysCurrentlyPressed.RemoveAt(kcpIdx);
            }
        }
        public void PressKey(AbstractWindowsEnvironment.VirtualKeyShort key)
        {
            EnsureNotCanceled();

            // Check if the window is still active and in foreground.
            GetMainWindowPosition();

            if (!keysCurrentlyPressed.Contains(key))
            {
                environmentInterface.PressKey(key);
                keysCurrentlyPressed.Add(key);
            }
        }
 public PressKeyAction(AbstractWindowsEnvironment.VirtualKeyShort key, int duration)
 {
     this.key = key;
     this.duration = duration;
 }