public MouseActionHandler(PythonWrapper pythonWrapper, IntPtr windowHandle) { this.mouseControlApi = new MouseControlApi(pythonWrapper); this.windowHandle = windowHandle; var t = new Thread(() => { while (true) { if (0 == mouseActionQueue.Count) { Thread.Sleep(10); } else { try { HandleMouseAction(mouseActionQueue.Dequeue(), this.windowHandle); } catch (NullReferenceException e) { Logger.Debug(e); } } } }); t.IsBackground = true; t.Start(); }
public KeyboardActionHandler(PythonWrapper pythonWrapper) { keyboardControlApi = new KeyboardControlApi(pythonWrapper); var t = new Thread(() => { while (true) { if (0 == keyboardActionQueue.Count) { Thread.Sleep(10); } else { try { HandleKeyboardAction(keyboardActionQueue.Dequeue()); } catch (NullReferenceException e) { Logger.Debug(e); } } } }); t.IsBackground = true; t.Start(); }
public SlaveController(Port portForRegistrationToRouter, ModuleType moduleType, message_based_communication.encoding.Encoding customEncoding, string nameOfApplicationToControl) : base(portForRegistrationToRouter, moduleType, customEncoding) { PythonStarter.StartPythonMouseControlApi(); PythonStarter.StartPythonKeyboardControlApi(); Thread.Sleep(10); // the mouse control api must be running before the mouseActionHandler can be instanciated // FIRST USE THE GetWindowByWindowTitle and GetClassName - when you know the class name, switch to GetWindowByClass Console.WriteLine("Getting window handle"); appWindow = WindowUtils.GetWindowHandle(windowTitleText: new Regex(nameOfApplicationToControl)); Console.WriteLine("Got window handle"); var pyAutoGuiForMouseControl = new PythonWrapper(new Port() { ThePort = 60606 }); //TODO FIX, not sure what I mean here anymore this.mouseActionHandler = new MouseActionHandler(pyAutoGuiForMouseControl, appWindow); var pyAutoGuiForKeyboardControl = new PythonWrapper(new Port() { ThePort = 60600 }); this.keyboardActionHandler = new KeyboardActionHandler(pyAutoGuiForKeyboardControl); WindowUtils.PutWindowOnTop(appWindow); PythonStarter.StartPythonScreenCapture(appWindow); //ensure that a folder is created to store files from the fileserver filesDirectory = Directory.CreateDirectory(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "ccfeu-files"); //make sure the filesDirectory is empty; EmptyDirectory(filesDirectory); IsRunning = true; }
static void Main(string[] args) {/* * CommonTools.PyWrapper test = new CommonTools.PyWrapper(); * string res; * test.("*****@*****.**", "invalid", "testSubject", "sender", out res); * */ PythonWrapper wrapper = new PythonWrapper(); string res; wrapper.SingIn("Vasua", out res); if (args.Length == 0) { Init(); CommandLine cmd = new CommandLine(); cmd.WriteHelp(); } if (args.Length != 0) { RunAsync(args); } Console.ReadKey(); }
public KeyboardControlApi(PythonWrapper pythonWrapper) { this.pythonWrapper = pythonWrapper; }
public MouseControlApi(PythonWrapper pyAutoGui) { this.pyAutoGui = pyAutoGui; }