protected override void Execute(NativeActivityContext context) { var relativelement = Element.Get(context); var match = relativelement.Rectangle; match.X += OffsetX.Get(context); match.Y += OffsetY.Get(context); match.Width = Width.Get(context); match.Height = Height.Get(context); var processname = relativelement.Processname; if (!string.IsNullOrEmpty(processname)) { var _element = AutomationHelper.GetFromPoint(match.X, match.Y); if (_element.ProcessId < 1) { throw new ElementNotFoundException("Failed locating Image, expected " + processname + " but found nothing"); } var p = System.Diagnostics.Process.GetProcessById(_element.ProcessId); if (p.ProcessName != processname) { throw new ElementNotFoundException("Failed locating Image, expected " + processname + " but found " + p.ProcessName); } } var b = Interfaces.Image.Util.Screenshot(match); //Interfaces.Image.Util.SaveImageStamped(b, "c:\\temp", "GetImage-result"); var v = new ImageElement(match, b); context.SetValue(Result, v); context.ScheduleAction(Body, v, OnBodyComplete); }
protected void Initialize(CodeActivityContext context) { doc = Document.Get(context); rec = Signer.Get(context); if (rec.RecipientType != "Signer") { throw new ArgumentException("Only Signers can have tabs added to them, not other Recipient types"); } sigX = PositionX.Get(context); sigY = PositionY.Get(context); anchorText = AnchorText.Get(context); offsetX = OffsetX.Get(context); offsetY = OffsetY.Get(context); tabLabel = TabLabel.Get(context); toolTip = ToolTip.Get(context); pageNumber = PageNumber.Get(context); if (anchorText != null && anchorText != "" && Path.GetExtension(doc.filename) != ".pdf") { throw new FormatException("Can only use relative positioning on .pdf files"); } }
protected override void Execute(CodeActivityContext context) { var el = Element.Get(context); if (el == null) { throw new ArgumentException("element cannot be null"); } var doubleclick = false; if (DoubleClick != null) { doubleclick = DoubleClick.Get(context); } var button = Button.Get(context); var virtualClick = false; if (VirtualClick != null) { virtualClick = VirtualClick.Get(context); } var animatemouse = false; if (AnimateMouse != null) { animatemouse = AnimateMouse.Get(context); } var keymodifiers = ""; if (KeyModifiers != null) { keymodifiers = KeyModifiers.Get(context); } var disposes = new List <IDisposable>(); var keys = TypeText.GetKeys(keymodifiers); foreach (var vk in keys) { disposes.Add(FlaUI.Core.Input.Keyboard.Pressing(vk)); } var _button = (Input.MouseButton)button; el.Click(virtualClick, _button, OffsetX.Get(context), OffsetY.Get(context), doubleclick, animatemouse); TimeSpan postwait = TimeSpan.Zero; if (PostWait != null) { postwait = PostWait.Get(context); } if (postwait != TimeSpan.Zero) { System.Threading.Thread.Sleep(postwait); // FlaUI.Core.Input.Wait.UntilInputIsProcessed(); } disposes.ForEach(x => { x.Dispose(); }); }
protected override void Execute(CodeActivityContext context) { var el = Element.Get(context); // if (el == null) throw new ArgumentException("element cannot be null"); var x = OffsetX.Get(context); var y = OffsetY.Get(context); if (el != null) { x += el.Rectangle.X; y += el.Rectangle.Y; } Result.Set(context, GetPixelColor(x, y)); }
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { recipientName = RecipientName.Get(context); recipientEmail = RecipientEmail.Get(context); subject = Subject.Get(context); documentFilePath = DocumentFilePath.Get(context); sigX = PositionX.Get(context); sigY = PositionY.Get(context); anchorText = AnchorText.Get(context); offsetX = OffsetX.Get(context); offsetY = OffsetY.Get(context); if (anchorText != null && anchorText != "" && Path.GetExtension(documentFilePath) != ".pdf") { throw new FormatException("Can only use relative positioning on .pdf files"); } LoadAuthentication(context); SendEnvelopeDelegate = new Action(SendEnvelope); return(SendEnvelopeDelegate.BeginInvoke(callback, state)); }
protected override void Execute(CodeActivityContext context) { var el = Element.Get(context); var animatemouse = false; if (AnimateMouse != null) { animatemouse = AnimateMouse.Get(context); } var button = -1; if (Button != null) { button = Button.Get(context); } var x = OffsetX.Get(context); var y = OffsetY.Get(context); if (el != null) { x += el.Rectangle.X; y += el.Rectangle.Y; } if (button > -1) { if (button == 1) // MouseButton.Left { NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); } else if (button == 1) // MouseButton.Right { NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0); } } if (animatemouse) { FlaUI.Core.Input.Mouse.MoveTo(new System.Drawing.Point(x, y)); } else { NativeMethods.SetCursorPos(x, y); } if (button > -1) { if (button == 1) // MouseButton.Left { NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } else if (button == 1) // MouseButton.Right { NativeMethods.mouse_event(NativeMethods.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); } } TimeSpan postwait = TimeSpan.Zero; if (PostWait != null) { postwait = PostWait.Get(context); } if (postwait != TimeSpan.Zero) { System.Threading.Thread.Sleep(postwait); } }