private void Plugin_OnUserAction(IPlugin sender, IRecordEvent e) { vm.Plugin.Stop(); e.ClickHandled = true; // GenericTools.restore(GenericTools.mainWindow); GenericTools.restore(this); vm.Selector = e.Selector; vm.FocusElement(e.Selector); vm.NotifyPropertyChanged("json"); // e.Element }
public void onIdleOrComplete(WorkflowInstance instance) { Log.Debug("onIdleOrComplete state: " + instance.state); if (!string.IsNullOrEmpty(instance.errormessage)) { Log.Error(instance.errormessage); } if (instance.state != "idle") { Console.WriteLine("Workflow " + instance.state + " in " + string.Format("{0:mm\\:ss\\.fff}", instance.runWatch.Elapsed)); GenericTools.restore(GenericTools.mainWindow); } OnIdleOrComplete?.Invoke(instance, EventArgs.Empty); }
private void onIdle(WorkflowInstance instance, EventArgs e) { if (!string.IsNullOrEmpty(instance.queuename) && !string.IsNullOrEmpty(instance.correlationId)) { RobotCommand command = new RobotCommand(); var data = JObject.FromObject(instance.Parameters); command.command = "invoke" + instance.state; command.workflowid = instance.WorkflowId; command.data = data; _ = global.webSocketClient.QueueMessage(instance.queuename, command, instance.correlationId); } else { if (instance.state != "idle") { GenericTools.restore(GenericTools.mainWindow); } } }
private void OnKeyDown(Input.InputEventArgs e) { if (!isRecording) { return; } if (e.Key == KeyboardKey.Escape) { StopRecordPlugins(); InputDriver.Instance.CallNext = true; InputDriver.Instance.OnKeyDown -= OnKeyDown; InputDriver.Instance.OnKeyUp -= OnKeyUp; GenericTools.restore(GenericTools.mainWindow); return; } // if (e.Key == KeyboardKey. 255) return; try { if (mainTabControl.SelectedContent is Views.WFDesigner view) { if (view.lastinserted != null && view.lastinserted is Activities.TypeText) { Log.Debug("re-use existing TypeText"); var item = (Activities.TypeText)view.lastinserted; item.AddKey(new Activities.vKey((FlaUI.Core.WindowsAPI.VirtualKeyShort)e.Key, false), view.lastinsertedmodel); } else { Log.Debug("Add new TypeText"); var rme = new Activities.TypeText(); view.lastinsertedmodel = view.addActivity(rme); rme.AddKey(new Activities.vKey((FlaUI.Core.WindowsAPI.VirtualKeyShort)e.Key, false), view.lastinsertedmodel); view.lastinserted = rme; } } } catch (Exception ex) { Log.Error(ex.ToString()); } }
private void onStop(object item) { if (!(item is Views.WFDesigner)) { return; } var designer = (Views.WFDesigner)item; foreach (var i in designer.Workflow.Instances) { if (i.isCompleted == false) { i.Abort("User clicked stop"); } } if (isRecording) { StopRecordPlugins(); InputDriver.Instance.CallNext = true; InputDriver.Instance.OnKeyDown -= OnKeyDown; InputDriver.Instance.OnKeyUp -= OnKeyUp; GenericTools.restore(GenericTools.mainWindow); } }
private void Window_Closed(object sender, EventArgs e) { vm.Plugin.OnUserAction -= Plugin_OnUserAction; GenericTools.restore(GenericTools.mainWindow); }
private void OnCancel(EventArgs e) { vm.Plugin.Stop(); GenericTools.OnCancel -= OnCancel; GenericTools.restore(this); }
private void OnCancel() { vm.Plugin.Stop(); OpenRPA.Input.InputDriver.Instance.onCancel -= OnCancel; GenericTools.restore(this); }
public void LaunchBySelector(Selector selector, TimeSpan timeout) { IElement[] elements = { }; var sw = new Stopwatch(); sw.Start(); do { elements = OpenRPA.AutomationHelper.RunSTAThread <IElement[]>(() => { try { return(GetElementsWithSelector(selector, null, 1)); } catch (System.Threading.ThreadAbortException) { } catch (Exception ex) { Log.Error(ex, ""); } return(new UIElement[] { }); }, TimeSpan.FromMilliseconds(250)).Result; if (elements == null) { elements = new IElement[] { }; } } while (elements != null && elements.Length == 0 && sw.Elapsed < timeout); // elements = GetElementsWithSelector(selector, null, 1); Process process = null; if (elements.Length > 0) { elements[0].Focus(); return; } if (selector == null || selector.Count == 0) { return; } var f = selector.First(); SelectorItemProperty p; bool isImmersiveProcess = false; string applicationUserModelId = null; string filename = null; string processname = null; string arguments = null; p = f.Properties.Where(x => x.Name == "isImmersiveProcess").FirstOrDefault(); if (p != null) { isImmersiveProcess = bool.Parse(p.Value); } p = f.Properties.Where(x => x.Name == "applicationUserModelId").FirstOrDefault(); if (p != null) { applicationUserModelId = p.Value; } p = f.Properties.Where(x => x.Name == "filename").FirstOrDefault(); if (p != null) { filename = p.Value; } p = f.Properties.Where(x => x.Name == "processname").FirstOrDefault(); if (p != null) { processname = p.Value; } p = f.Properties.Where(x => x.Name == "arguments").FirstOrDefault(); if (p != null) { arguments = p.Value; } if (isImmersiveProcess) { process = FlaUI.Core.Tools.WindowsStoreAppLauncher.Launch(applicationUserModelId, arguments); } else { Log.Debug("Starting a new instance of " + processname); process = Process.Start(new ProcessStartInfo { FileName = Environment.ExpandEnvironmentVariables(filename), Arguments = Environment.ExpandEnvironmentVariables(arguments) }); } try { GenericTools.restore(process.MainWindowHandle); } catch (Exception ex) { Log.Error("restore window: " + ex.ToString()); } process.WaitForInputIdle(); }